CellTree
ShowCaseã¨javadocãåèã«CellTreeã®ä½¿ãæ¹ã調ã¹ãã
xmlã®å®ç¾©
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:c="urn:import:com.google.gwt.user.cellview.client"> (ä¸ç¥) <c:CellTree ui:field="cellTree" />
ã³ã¼ãã®å®ç¾©
ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿ã¯ã¨ã©ã¼ã«ãªãã®ã§ã
provided = trueã«ãã¦ã³ã¼ãã§ã¤ã³ã¹ã¿ã³ã¹ãprovideããã
@UiField(provided = true) CellTree cellTree;
javadocã«ãµã³ãã«ããã
CellTree (Google Web Toolkit Javadoc)
trial sampleã¨complex sampleãè¼ã£ã¦ããã
public class CellTreeExample implements EntryPoint { /** * The model that defines the nodes in the tree. */ private static class CustomTreeModel implements TreeViewModel { /** * Get the {@link NodeInfo} that provides the children of the specified * value. */ public <T> NodeInfo<?> getNodeInfo(T value) { /* * Create some data in a data provider. Use the parent value as a prefix * for the next level. */ ListDataProvider<String> dataProvider = new ListDataProvider<String>(); for (int i = 0; i < 2; i++) { dataProvider.getList().add(value + "." + String.valueOf(i)); } // Return a node info that pairs the data with a cell. return new DefaultNodeInfo<String>(dataProvider, new TextCell()); } /** * Check if the specified value represents a leaf node. Leaf nodes cannot be * opened. */ public boolean isLeaf(Object value) { // The maximum length of a value is ten characters. return value.toString().length() > 10; } } public void onModuleLoad() { // Create a model for the tree. TreeViewModel model = new CustomTreeModel(); /* * Create the tree using the model. We specify the default value of the * hidden root node as "Item 1". */ CellTree tree = new CellTree(model, "Item 1"); // Add the tree to the root layout panel. RootLayoutPanel.get().add(tree); } }
é¸æãããè¡ãåå¾
selectionModelã使ãããããSingleSelectionModelãMultiSelectionModelããããShowCaseã¯MultiSelectionModelã
å¼æ°ãªãã®ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿ã§çæããselectionModelã使ã£ãããé¸æããã¾ãåä½ããªãã£ããProvidesKeyã渡ãã³ã³ã¹ãã©ã¯ã¿ã ã¨ãã¾ãåä½ããã