Line | |
---|
1 | // License: GPL. For details, see Readme.txt file.
|
---|
2 | package org.openstreetmap.gui.jmapviewer.checkBoxTree;
|
---|
3 |
|
---|
4 | import org.openstreetmap.gui.jmapviewer.AbstractLayer;
|
---|
5 | import org.openstreetmap.gui.jmapviewer.LayerGroup;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Node Data for checkBox Tree
|
---|
9 | *
|
---|
10 | * @author galo
|
---|
11 | */
|
---|
12 | public class CheckBoxNodeData {
|
---|
13 | private AbstractLayer layer;
|
---|
14 |
|
---|
15 | public CheckBoxNodeData(final AbstractLayer layer) {
|
---|
16 | this.layer = layer;
|
---|
17 | }
|
---|
18 | public CheckBoxNodeData(final String txt) {
|
---|
19 | this(new LayerGroup(txt));
|
---|
20 | }
|
---|
21 | public CheckBoxNodeData(final String txt, final Boolean selected) {
|
---|
22 | this(new LayerGroup(txt));
|
---|
23 | layer.setVisible(selected);
|
---|
24 | }
|
---|
25 | public Boolean isSelected() {
|
---|
26 | return layer.isVisible();
|
---|
27 | }
|
---|
28 | public void setSelected(final Boolean newValue) {
|
---|
29 | layer.setVisible(newValue);
|
---|
30 | }
|
---|
31 | public String getText() {
|
---|
32 | return layer.getName();
|
---|
33 | }
|
---|
34 | public AbstractLayer getAbstractLayer() {
|
---|
35 | return layer;
|
---|
36 | }
|
---|
37 | public void setAbstractLayer(final AbstractLayer layer) {
|
---|
38 | this.layer = layer;
|
---|
39 | }
|
---|
40 | @Override
|
---|
41 | public String toString() {
|
---|
42 | return getClass().getSimpleName() + "[" + getText() + "/" + isSelected() + "]";
|
---|
43 | }
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.