当前位置: 首页>>代码示例>>Java>>正文


Java TreeItem.getChild方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.TreeItem.getChild方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getChild方法的具体用法?Java TreeItem.getChild怎么用?Java TreeItem.getChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.ui.TreeItem的用法示例。


在下文中一共展示了TreeItem.getChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSelection

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();
    currentlySelected = item;
    TreeItem child = item.getChild(0);
    if ( child != null && child.getText().equals(DatasetWidget.LOADING) ) {
        CategorySerializable cat = (CategorySerializable) item.getUserObject();
        Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
    }
    // Open the item.  Work around double firing bug.
    // http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
    TreeItem selItem = event.getSelectedItem();
    TreeItem parent = selItem.getParentItem();
    selItem.getTree().setSelectedItem(parent, false); // null is ok
    if(parent != null)
        parent.setSelected(false);  // not compulsory
    selItem.setState(!selItem.getState(), false);

}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:20,代码来源:DatasetWidget.java

示例2: checkChildrenState

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void checkChildrenState(TreeItem treeItem, Boolean value) {
  int childCount = treeItem.getChildCount();
  if (childCount == 0) {
    return;
  }

  for (int i = 0; i < childCount; i++) {
    TreeItem childItem = treeItem.getChild(i);
    if (!(childItem.getWidget() instanceof FlowPanel)) {
      return;
    }
    FlowPanel childItemContainer = (FlowPanel) childItem.getWidget();

    if (!(childItemContainer.getWidget(0) instanceof CheckBox)) {
      return;
    }
    CheckBox childCheckBox = (CheckBox) childItemContainer.getWidget(0);

    childCheckBox.setValue(value);
    checkChildrenState(childItem, value);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:PreviewViewImpl.java

示例3: removeChildrenXKeepButtons

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public static Vector removeChildrenXKeepButtons(TreeItem parentTreeItem, String name) {    
  Vector itemsToDelete = new Vector();
  Vector buttonTreeItems = new Vector();    
  for (int i = 0; i < parentTreeItem.getChildCount(); i++) {
    TreeItem treeItem = parentTreeItem.getChild(i);      
    if (treeItem.getUserObject() != null) {        
      if (treeItem.getUserObject().equals(name)) {         
        itemsToDelete.add(treeItem);        
      }
      else if (((String) treeItem.getUserObject()).startsWith(ApplicationItem.button)) {          
        buttonTreeItems.add(treeItem);
        itemsToDelete.add(treeItem);      
      }
    }      
  }    
  Iterator itemsToDeleteIterator = itemsToDelete.iterator();
  while(itemsToDeleteIterator.hasNext()) {
    parentTreeItem.removeItem((TreeItem) itemsToDeleteIterator.next());
  }    
  return buttonTreeItems;
}
 
开发者ID:tomayac,项目名称:rest-describe-and-compile,代码行数:22,代码来源:WadlTreeRoot.java

示例4: changePathBeforeRenaming

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
 * Change recursivelly all the childs path
 *
 * @param oldPath
 *            The old path
 * @param newPath
 *            The new path
 * @param itemToChange
 *            The tree item to change the path
 */
public void changePathBeforeRenaming(String oldPath, String newPath, TreeItem itemToChange) {
	for (int i = 0; i < itemToChange.getChildCount(); i++) {
		TreeItem tmpItem = itemToChange.getChild(i);
		GWTFolder gwtFolder = ((GWTFolder) tmpItem.getUserObject());
		gwtFolder.setPath(gwtFolder.getPath().replaceAll(oldPath, newPath));
		gwtFolder.setParentPath(gwtFolder.getParentPath().replaceAll(oldPath, newPath));
		if (tmpItem.getChildCount() > 0) {
			changePathBeforeRenaming(oldPath, newPath, tmpItem);
		}
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:22,代码来源:FolderTree.java

示例5: updateInformation

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
	public void updateInformation(List<SimpleUser> information, UIObject parent) {
		if(information == null) {
			//..
		} else {
			List<SimpleUser> userlist = information;
			TreeItem item = (TreeItem) parent;
			if(item.getText().length() == 1) item.removeItems(); // remove "Loading..." (w/ search field hack)
			else
			{
				TreeItem seachField = item.getChild(0);
				item.removeItems();
				item.addItem(seachField);
			}
			
			if(userlist.isEmpty()) // if search field AND no user is found
			{
				Label noUserFoundLabel = new Label("Keinen Nutzer gefunden..");
				item.addItem(noUserFoundLabel);
			}
			for(final SimpleUser user : userlist) 
			{
				Panel p = new HorizontalPanel();
				Anchor a = new Anchor(user.getName());
				a.addClickHandler(new ClickHandler() {
					
					@Override
					public void onClick(ClickEvent event) {
						presenter.onUserClicked(user);
					}
				});
				p.add(a);
				if(user.isAdmin()) p.add(new Label(" (A)"));
//				p.addStyleName();
				item.addItem(p);
			}
		}
	}
 
开发者ID:jkonert,项目名称:socom,代码行数:39,代码来源:UserAdministrationView.java

示例6: onSelection

import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    if ( (view != null) && (event != null) ) {
        Object source = event.getSource();
        // Only proceed if the source was from the same panel or from
        // the comparePanel
        if ( (source != null) && (source instanceof HasName) ) {
            String sourceName = ((HasName) source).getName();
            String viewName = view.getName();
            if ( ((viewName != null) && viewName.equalsIgnoreCase(sourceName)) || CONSTANTS.comparePanelName().equalsIgnoreCase(sourceName) ) { //$NON-NLS-1$
                // Get variables from the tree
                TreeItem selectedItem = event.getSelectedItem();
                if ( selectedItem != null ) {
                    Object userObject = selectedItem.getUserObject();
                    if ( (userObject != null) && (userObject instanceof VariableSerializable) ) {
                        VariableSerializable selectedVariable = (VariableSerializable) userObject;
                        // Find all siblings if any
                        Vector<VariableSerializable> variables = new Vector<VariableSerializable>();
                        // Vector<TreeItem> children = new
                        // Vector<TreeItem>();
                        int selectedIndex = 0;
                        TreeItem parent = selectedItem.getParentItem();
                        if ( parent == null ) {
                            // There are no reachable siblings without a
                            // parent, so just use the selectedVariable
                            // and leave selectedIndex == 0
                            variables.add(selectedVariable);
                            // children.add(selectedItem);
                        } else {
                            for ( int i = 0; i < parent.getChildCount(); i++ ) {
                                TreeItem child = parent.getChild(i);
                                userObject = child.getUserObject();
                                if ( (userObject != null) && (userObject instanceof VariableSerializable) ) {
                                    variables.add((VariableSerializable) userObject);
                                    // children.add(child);
                                }
                            }
                            selectedIndex = variables.indexOf(selectedVariable);
                        }
                        // Add the variables to the view
                        view.setVariables(variables, selectedIndex);
                    }
                }
            }
        }
    }
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:48,代码来源:MultiVariableSelectorActivity.java


注:本文中的com.google.gwt.user.client.ui.TreeItem.getChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。