本文整理汇总了Java中com.google.gwt.user.client.ui.TreeItem.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getChildCount方法的具体用法?Java TreeItem.getChildCount怎么用?Java TreeItem.getChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getChildCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFolder
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Adds folders to actual item if not exists or refreshes it values
*
* @param actualItem The actual item active
* @param newItem New item to be added, or refreshed
*/
public void addFolder(TreeItem actualItem, TreeItem newItem) {
int i = 0;
boolean found = false;
int count = actualItem.getChildCount();
GWTFolder folder;
GWTFolder newFolder = (GWTFolder) newItem.getUserObject();
String folderPath = newFolder.getPath();
for (i = 0; i < count; i++) {
folder = (GWTFolder) actualItem.getChild(i).getUserObject();
// If item is found actualizate values
if ((folder).getPath().equals(folderPath)) {
found = true;
actualItem.getChild(i).setVisible(true);
actualItem.getChild(i).setUserObject(newFolder);
evaluesFolderIcon(actualItem.getChild(i));
}
}
if (!found) {
evaluesFolderIcon(newItem);
actualItem.addItem(newItem);
}
}
示例2: insertTreeItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void insertTreeItem(TreeItem treeItem,
TreeItem nestedTreeItem,
TerminationConfigOption terminationConfigOption) {
if (treeItem.getChildCount() == 0) {
treeItem.addItem(nestedTreeItem);
} else {
for (int i = 0; i < treeItem.getChildCount(); i++) {
TerminationTreeItemContent childTreeItemContent = (TerminationTreeItemContent) treeItem.getChild(i).getUserObject();
if (terminationConfigOption.ordinal() < childTreeItemContent.getTerminationConfigOption().ordinal()) {
treeItem.insertItem(i,
nestedTreeItem);
break;
}
if (i == treeItem.getChildCount() - 1) {
treeItem.addItem(nestedTreeItem);
break;
}
}
}
}
示例3: 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);
}
}
示例4: 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;
}
示例5: addItemToParent
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void addItemToParent(UIObject parentNode)
{
if (parentNode instanceof Tree)
{
((Tree) parentNode).addItem(this);
}
else if (parentNode instanceof TreeItem)
{
TreeItem parentNodeItem = (TreeItem) parentNode;
int childCount = parentNodeItem.getChildCount();
int nodeDepth = 0;
for (TreeItem ancestor = parentNodeItem; ancestor != null; ancestor = ancestor.getParentItem())
{
nodeDepth++;
}
parentNodeItem.addItem(this);
String colors[] = { "#F5F5F2", "#DBDAD8", "#F9F8F6", "#E7E7E3" };
int colorIndex = ((nodeDepth % 2) + (childCount % 2)) % 2;
getElement().getStyle().setBackgroundColor(colors[colorIndex]);
}
}
示例6: hideAllBranch
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Hides all items on a brach
*
* @param actualItem The actual item active
*/
public void hideAllBranch(TreeItem actualItem) {
int i = 0;
int count = actualItem.getChildCount();
for (i = 0; i < count; i++) {
actualItem.getChild(i).setVisible(false);
}
}
示例7: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder inconsistences between server ( multi user deletes folder ) and tree
* nodes drawn
*
* @param item The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例8: 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);
}
}
}
示例9: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder incosistences between server ( multi user deletes folder ) and tree
* nodes drawed
*
* @param item The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例10: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder incosistences between server ( multi user deletes folder ) and tree
* nodes drawed
*
* @param item The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例11: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder incosistences between server ( multi user deletes folder
* ) and tree nodes drawed
*
* @param item
* The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例12: updateActiveRoomVisitorsInTreeItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private static void updateActiveRoomVisitorsInTreeItem( Map<Integer, Integer> activeRoomVisitors, TreeItem setOfActiveRooms ){
if( setOfActiveRooms != null ) {
for( int index = 0 ; index < setOfActiveRooms.getChildCount(); index++ ) {
( (RoomTreeItem) setOfActiveRooms.getChild( index ).getWidget() ).setRoomVisitors( activeRoomVisitors );
}
}
}
示例13: setChildItemsUI
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void setChildItemsUI(final TreeItem childTree, final boolean checked, final Node parentNode) {
List<Node> childList = parentNode.getChildren();
if (childTree.getChildCount() > 0) {
for (int index = 0; index < childTree.getChildCount(); index++) {
CheckBox checkBox = (CheckBox) childTree.getChild(index).getWidget();
if (checkBox.isEnabled()) {
checkBox.setValue(checked);
childList.get(index).getLabel().setMandatory(checked);
}
setChildItemsUI(childTree.getChild(index), checked, childList.get(index));
}
}
}
示例14: openedNodes
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void openedNodes(List<String> ret, TreeItem item, String prefix) {
if (item.getState()) ret.add((prefix == null ? "" : prefix + " ") + item.getText());
for (int i = 0; i < item.getChildCount(); i++)
openedNodes(ret, item.getChild(i), (prefix == null ? "" : prefix + " ") + item.getText());
}
示例15: openNodes
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void openNodes(Set<String> nodes, TreeItem item, String prefix) {
if (nodes.contains((prefix == null ? "" : prefix + " ") + item.getText())) item.setState(true);
for (int i = 0; i < item.getChildCount(); i++)
openNodes(nodes, item.getChild(i), (prefix == null ? "" : prefix + " ") + item.getText());
}