List of usage examples for com.google.gwt.user.cellview.client CellTree CellTree
public <T> CellTree(TreeViewModel viewModel, T rootValue)
From source file:accelerator.client.view.desktop.DesktopMainMenuView.java
License:Open Source License
public DesktopMainMenuView() { mainMenu = new CellTree(treeViewModel, null); mainMenu.setAnimationEnabled(true);/*from ww w .j a va 2 s . co m*/ mainMenu.ensureDebugId("mainMenu"); initWidget(uiBinder.createAndBindUi(this)); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { final MainMenuTreeViewModel.MainMenuItem selected = selectionModel.getSelectedObject(); Place where = handler.getClientFactory().getPlaceController().getWhere(); if ((selected != null) && !selected.mapsToPlace(where)) { handler.goTo(selected.getPlace()); } } }); }
From source file:com.colinalworth.xmlview.client.XmlViewerEntryPoint.java
License:Apache License
@Override public void onModuleLoad() { Document rootValue = XMLParser.parse( "<beans xmlns='http://www.springframework.org/schema/beans' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:drools='http://drools.org/schema/drools-spring' xsi:schemaLocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd'> <bean id='ds' class='org.springframework.jdbc.datasource.DriverManagerDataSource'> <!-- org.h2.jdbcx.JdbcDataSource --> <property name='driverClassName' value='org.h2.Driver' /> <property name='url' value='jdbc:h2:tcp://localhost/DroolsFlow' /> <property name='username' value='sa' /> <property name='password' value='' /> </bean> <drools:grid-node id='node1' /> <drools:kbase id='kbProcessWorkItems' node='node1'><drools:resources> <drools:resource type='PKG' source='file:///${temp.dir}/processWorkItems.pkg' /> <drools:resource type='PKG' source='file:///${temp.dir}/processSubProcess.pkg' /> <drools:resource type='PKG' source='file:///${temp.dir}/processTimer.pkg' /> <drools:resource type='PKG' source='file:///${temp.dir}/processTimer2.pkg' /> </drools:resources> </drools:kbase></beans>"); // passing in the full document, as the children of the first element are parsed, not the root itself DroolsSpring schema = GWT.create(DroolsSpring.class); MavenPom pom = GWT.create(MavenPom.class); XmlTreeViewModel viewModel = new XmlTreeViewModel(new SchemaBasedXmlValidator(schema)); tree = new CellTree(viewModel, rootValue); RootPanel.get().add(binder.createAndBindUi(this)); }
From source file:com.dingziran.effective.client.ShowcaseShell.java
License:Apache License
/** * Construct the {@link ShowcaseShell}.//from w w w . ja v a 2 s . c o m * * @param treeModel the treeModel that backs the main menu */ public ShowcaseShell(TreeViewModel treeModel) { AbstractImagePrototype proto = AbstractImagePrototype.create(Showcase.images.loading()); loadingHtml = proto.getHTML(); // Create the cell tree. mainMenu = new CellTree(treeModel, null); mainMenu.setAnimationEnabled(true); mainMenu.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); mainMenu.ensureDebugId("mainMenu"); // Initialize the ui binder. initWidget(uiBinder.createAndBindUi(this)); initializeLocaleBox(); contentSource.getElement().getStyle().setBackgroundColor("#eee"); contentSource.getElement().getStyle().setMargin(10.0, Unit.PX); contentSource.getElement().getStyle().setProperty("border", "1px solid #c3c3c3"); contentSource.getElement().getStyle().setProperty("padding", "10px 2px"); // In RTL mode, we need to set some attributes. if (LocaleInfo.getCurrentLocale().isRTL()) { localeSelectionCell.setAlign("left"); linkCell.setPropertyString("align", "left"); } // Default to no content. contentPanel.ensureDebugId("contentPanel"); setContent(null); }
From source file:com.github.gwt.sample.showcase.client.WidgetsShowCase.java
License:Apache License
/** * Construct the {@link WidgetsShowCase}. * * @param treeModel the treeModel that backs the main menu *//*from w ww . j a v a2 s .c om*/ public WidgetsShowCase(TreeViewModel treeModel) { // Create the cell tree. mainMenu = new CellTree(treeModel, null); mainMenu.setAnimationEnabled(true); mainMenu.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED); mainMenu.ensureDebugId("mainMenu"); // Initialize the ui binder. initWidget(ourUiBinder.createAndBindUi(this)); // Default to no content. contentPanel.ensureDebugId("contentPanel"); setContent(null); }
From source file:com.google.gwt.examples.cellview.CellTreeExample.java
License:Apache License
public void onModuleLoad() { // Create a model for the tree. TreeViewModel model = new CustomTreeModel(); /*// www . ja va2 s . co m * 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); }
From source file:com.google.gwt.examples.cellview.CellTreeExample2.java
License:Apache License
public void onModuleLoad() { // Create a model for the tree. TreeViewModel model = new CustomTreeModel(); /*/*from www.j a v a 2 s. co m*/ * Create the tree using the model. We use <code>null</code> as the default * value of the root node. The default value will be passed to * CustomTreeModel#getNodeInfo(); */ CellTree tree = new CellTree(model, null); tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // Open the first playlist by default. TreeNode rootNode = tree.getRootTreeNode(); TreeNode firstPlaylist = rootNode.setChildOpen(0, true); firstPlaylist.setChildOpen(0, true); // Add the tree to the root layout panel. RootLayoutPanel.get().add(tree); }
From source file:com.google.gwt.sample.expenses.client.ExpenseTree.java
License:Apache License
/** * Create the {@link CellTree}.//from w w w.ja v a2 s . com */ private void createTree() { final ExpensesTreeViewModel model = new ExpensesTreeViewModel(); // Listen for selection. We need to add this handler before the CellBrowser // adds its own handler. selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { Object selected = selectionModel.getSelectedObject(); if (selected == null) { lastEmployee = null; lastDepartment = ""; } else if (selected instanceof EmployeeProxy) { lastEmployee = (EmployeeProxy) selected; lastDepartment = lastEmployee.getDepartment(); } else if (selected instanceof String) { lastEmployee = null; if (model.isAllDepartment(selected)) { lastDepartment = ""; } else { lastDepartment = (String) selected; } } if (listener != null) { listener.onSelection(lastDepartment, lastEmployee == null ? null : lastEmployee.stableId()); } } }); // Create a CellBrowser. tree = new CellTree(model, null); tree.setAnimationEnabled(true); }
From source file:com.google.gwt.sample.showcase.client.ShowcaseShell.java
License:Apache License
/** * Construct the {@link ShowcaseShell}.//from ww w . j a v a2 s. co m * * @param treeModel the treeModel that backs the main menu */ public ShowcaseShell(TreeViewModel treeModel) { AbstractImagePrototype proto = AbstractImagePrototype.create(Showcase.images.loading()); loadingHtml = proto.getHTML(); // Create the cell tree. mainMenu = new CellTree(treeModel, null); mainMenu.setAnimationEnabled(true); mainMenu.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); mainMenu.ensureDebugId("mainMenu"); // Initialize the ui binder. initWidget(uiBinder.createAndBindUi(this)); initializeLocaleBox(); contentSource.getElement().getStyle().setBackgroundColor("#eee"); contentSource.getElement().getStyle().setMargin(10.0, Unit.PX); contentSource.getElement().getStyle().setProperty("border", "1px solid #c3c3c3"); contentSource.getElement().getStyle().setProperty("padding", "10px 2px"); // In RTL mode, we need to set some attributes. if (LocaleInfo.getCurrentLocale().isRTL()) { localeSelectionCell.setAlign("left"); linkCell.setPropertyString("align", "left"); } // Handle events from the tabs. tabExample.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showExample(); } }); tabStyle.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showSourceStyles(); } }); tabSource.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showSourceFile(); } }); tabSourceList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { showSourceFile(); } }); // Default to no content. contentPanel.ensureDebugId("contentPanel"); setContent(null); }
From source file:com.google.gwt.sample.stockwatcher.client.Cells.java
private Widget createCellTree() { TreeViewModel model = new CustomTreeModel(); CellTree tree = new CellTree(model, "Item 1"); return tree;//from ww w .j a va2 s . c o m }
From source file:com.gwt2go.dev.client.ui.LeftSide.java
License:Apache License
public LeftSide(final ClientFactory clientFactory) { TreeViewModel treeRooterModel = new CellTreeRooterModel(selectionModelPlaces); selectionModelPlaces.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override//from www .j a v a 2s . c o m public void onSelectionChange(SelectionChangeEvent event) { GotoPlacesModel selected = selectionModelPlaces.getSelectedObject(); if (selected != null) { // Window.alert("You selected to go: " // + selected.getGotoPlace()); clientFactory.getPlaceController().goTo(new RootPlace(selected.getGotoPlace())); } } }); // TODO: add selection with Enter keyboard cellTree3 = new CellTree(treeRooterModel, null); cellTree3.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // TreeNode rootNode = cellTree3.getRootTreeNode(); TreeNode firstPlaylist = rootNode.setChildOpen(0, true); firstPlaylist.setChildOpen(0, true); initWidget(uiBinder.createAndBindUi(this)); this.clientFactory = clientFactory; }