source: java/main/src/main/java/com/framsticks/gui/EndpointAtFrame.java @ 77

Last change on this file since 77 was 77, checked in by psniegowski, 11 years ago

Add new java codebase.

File size: 1.0 KB
Line 
1package com.framsticks.gui;
2
3import java.util.HashMap;
4import java.util.Map;
5
6/**
7 * @author Piotr Sniegowski
8 */
9public class EndpointAtFrame {
10    protected final BrowserEndpoint endpoint;
11    protected final Frame frame;
12    protected final Map<String, Panel> knownPanels = new HashMap<String, Panel>();
13
14    public EndpointAtFrame(BrowserEndpoint endpoint, Frame frame) {
15        this.endpoint = endpoint;
16        this.frame = frame;
17    }
18
19
20    public BrowserEndpoint getEndpoint() {
21        return endpoint;
22    }
23
24    public Frame getFrame() {
25        return frame;
26    }
27
28    public void registerPanel(Panel panel) {
29        assert frame.isActive();
30        knownPanels.put(panel.getClassName(), panel);
31        frame.cardPanel.add(panel, panel.getFullName());
32    }
33
34    public Panel findPanel(String className) {
35        assert frame.isActive();
36        return (knownPanels.containsKey(className) ? knownPanels.get(className) : null);
37    }
38
39    public final String getName() {
40        return endpoint.getName();
41    }
42}
Note: See TracBrowser for help on using the repository browser.