001// License: GPL. For details, see Readme.txt file.
002package org.openstreetmap.gui.jmapviewer.checkBoxTree;
003
004import org.openstreetmap.gui.jmapviewer.AbstractLayer;
005import org.openstreetmap.gui.jmapviewer.LayerGroup;
006
007/**
008 * Node Data for checkBox Tree
009 * 
010 * @author galo
011 */
012public class CheckBoxNodeData {
013    private AbstractLayer layer;
014
015    public CheckBoxNodeData(final AbstractLayer layer) {
016        this.layer = layer;
017    }
018    public CheckBoxNodeData(final String txt) {
019        this(new LayerGroup(txt));
020    }
021    public CheckBoxNodeData(final String txt, final Boolean selected) {
022        this(new LayerGroup(txt));
023        layer.setVisible(selected);
024    }
025    public Boolean isSelected() {
026            return layer.isVisible();
027    }
028    public void setSelected(final Boolean newValue) {
029        layer.setVisible(newValue);
030    }
031    public String getText() {
032            return layer.getName();
033    }
034    public AbstractLayer getAbstractLayer() {
035        return layer;
036}
037    public void setAbstractLayer(final AbstractLayer layer) {
038            this.layer = layer;
039    }
040    @Override
041    public String toString() {
042            return getClass().getSimpleName() + "[" + getText() + "/" + isSelected() + "]";
043    }
044}