/*
* Smart GWT (GWT for SmartClient)
* Copyright 2008 and beyond, Isomorphic Software, Inc.
*
* Smart GWT is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation. Smart GWT is also
* available under typical commercial license terms - see
* smartclient.com/license.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package com.smartgwt.sample.showcase.client;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortArrow;
import com.smartgwt.client.types.TreeModelType;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.sample.showcase.client.data.ExplorerTreeNode;
import com.smartgwt.sample.showcase.client.data.ShowcaseData;
public class SideNavTree extends TreeGrid {
private String idSuffix = "";
private ExplorerTreeNode[] showcaseData = ShowcaseData.getData(idSuffix);
public SideNavTree() {
setWidth100();
setHeight100();
setSelectionType(SelectionStyle.SINGLE);
setCustomIconProperty("icon");
setAnimateFolderTime(100);
setAnimateFolders(true);
setAnimateFolderSpeed(1000);
setNodeIcon("silk/application_view_list.png");
setShowSortArrow(SortArrow.CORNER);
setShowAllRecords(true);
setLoadDataOnDemand(false);
setCanSort(false);
TreeGridField field = new TreeGridField();
field.setCanFilter(true);
field.setName("nodeTitle");
field.setTitle("<b>Samples</b>");
setFields(field);
Tree tree = new Tree();
tree.setModelType(TreeModelType.PARENT);
tree.setNameProperty("nodeTitle");
tree.setOpenProperty("isOpen");
tree.setIdField("nodeID");
tree.setParentIdField("parentNodeID");
tree.setRootValue("root" + idSuffix);
tree.setData(showcaseData);
setData(tree);
}
public ExplorerTreeNode[] getShowcaseData() {
return showcaseData;
}
}