Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | package com.framsticks.gui; |
---|
2 | |
---|
3 | import java.util.concurrent.atomic.AtomicInteger; |
---|
4 | |
---|
5 | import javax.swing.*; |
---|
6 | |
---|
7 | import org.apache.logging.log4j.Logger; |
---|
8 | import org.apache.logging.log4j.LogManager; |
---|
9 | |
---|
10 | import com.framsticks.gui.tree.AbstractNode; |
---|
11 | |
---|
12 | /** |
---|
13 | * Author: Piotr Śniegowski |
---|
14 | */ |
---|
15 | @SuppressWarnings("serial") |
---|
16 | public abstract class AbstractPanel extends JPanel { |
---|
17 | |
---|
18 | private static final Logger log = LogManager.getLogger(AbstractPanel.class); |
---|
19 | |
---|
20 | protected final Frame frame; |
---|
21 | |
---|
22 | protected final String uniqueName; |
---|
23 | protected final static AtomicInteger counter = new AtomicInteger(); |
---|
24 | |
---|
25 | /** |
---|
26 | * @param frame |
---|
27 | */ |
---|
28 | public AbstractPanel(Frame frame) { |
---|
29 | this.frame = frame; |
---|
30 | this.uniqueName = "panel_" + counter.getAndIncrement(); |
---|
31 | |
---|
32 | frame.cardPanel.add(this, uniqueName); |
---|
33 | frame.cardPanelLayout.addLayoutComponent(this, uniqueName); |
---|
34 | log.debug("created panel {}", uniqueName); |
---|
35 | } |
---|
36 | |
---|
37 | public final Frame getFrame() { |
---|
38 | return frame; |
---|
39 | } |
---|
40 | |
---|
41 | public abstract String getTitle(); |
---|
42 | |
---|
43 | public final String getUniqueName() { |
---|
44 | return uniqueName; |
---|
45 | } |
---|
46 | |
---|
47 | public abstract void fillPanelWith(AbstractNode node); |
---|
48 | |
---|
49 | @Override |
---|
50 | public String toString() { |
---|
51 | return uniqueName; |
---|
52 | } |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.