package org.geomajas.plugin.deskmanager.client.gwt.manager.common.layertree;

import org.geomajas.plugin.deskmanager.domain.dto.LayerDto;
import org.geomajas.widget.layer.configuration.client.ClientAbstractNodeInfo;
import org.geomajas.widget.layer.configuration.client.ClientBranchNodeInfo;
import org.geomajas.widget.layer.configuration.client.ClientLayerNodeInfo;

import com.smartgwt.client.widgets.tree.TreeNode;

/**
 * TODO.
 * 
 * @author Jan De Moerloose
 * 
 */
public class LayerTreeNode extends TreeNode {

	public static final String FLD_NAME = "name";

	public static final String FLD_PUBLIC = "public";

	private ClientAbstractNodeInfo node;

	private LayerDto layer;

	public LayerTreeNode(ClientBranchNodeInfo node) {
		this(node, null);
	}
	
	public LayerTreeNode(ClientAbstractNodeInfo node, LayerDto layer) {
		if (node == null) {
			throw new IllegalArgumentException("Was expecting a node!");
		}
		this.node = node;
		this.layer = layer;
		if (node instanceof ClientBranchNodeInfo) {
			setName(((ClientBranchNodeInfo) node).getLabel());
			setIsFolder(true);
		} else if (node instanceof ClientLayerNodeInfo) {
			if (layer != null) {
				if (layer.getClientLayerInfo() != null) {
					setName(layer.getClientLayerInfo().getLabel());
				} else {
					setName(layer.getLayerModel().getName());
				}
			}
			setIsFolder(false);
		}
	}

	public ClientAbstractNodeInfo getNode() {
		return node;
	}

	/**
	 * Get client layer info, might return null if node isn't a leaf.
	 * 
	 * @return the clientLayerInfo
	 */
	public LayerDto getLayer() {
		return layer;
	}
}
@@ -1,8 +1,427 @@
+/*%0A * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.%0A *%0A * Copyright 2008-2012 Geosparc nv, http://www.geosparc.com/, Belgium.%0A *%0A * The program is available in open source according to the GNU Affero%0A * General Public License. All contributions in this program are covered%0A * by the Geomajas Contributors License Agreement. For full licensing%0A * details, see LICENSE.txt in the project root.%0A */%0A
 package 

Add GeodeskSelectionHandler to geodesk configuration panels GDM-2: Layertree configuration from widgetinfo