com.google.gwt.user.client.ui.Tree.setSelectedItem()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.google.gwt.user.client.ui.Tree.setSelectedItem()方法的一些代码示例,展示了Tree.setSelectedItem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.setSelectedItem()方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Tree
类名称:Tree
方法名:setSelectedItem

Tree.setSelectedItem介绍

[英]Selects a specified item.
[中]选择指定的项目。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Selects a specified item.
 *
 * @param item the item to be selected, or <code>null</code> to deselect all
 *          items
 */
public void setSelectedItem(TreeItem item) {
 setSelectedItem(item, true);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

void maybeUpdateSelection(TreeItem itemThatChangedState, boolean isItemOpening) {
 /**
  * If we just closed the item, let's check to see if this item is the parent
  * of the currently selected item. If so, we should make this item the
  * currently selected selected item.
  */
 if (!isItemOpening) {
  TreeItem tempItem = curSelection;
  while (tempItem != null) {
   if (tempItem == itemThatChangedState) {
    setSelectedItem(itemThatChangedState);
    return;
   }
   tempItem = tempItem.getParentItem();
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void maybeCollapseTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (curSelection.getState()) {
  curSelection.setState(false);
 } else {
  TreeItem parent = curSelection.getParentItem();
  if (parent != null) {
   setSelectedItem(parent);
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void maybeExpandTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (!curSelection.getState()) {
  curSelection.setState(true);
 } else if (curSelection.getChildCount() > 0) {
  setSelectedItem(curSelection.getChild(0));
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

void setTree(Tree newTree) {
 // Early out.
 if (tree == newTree) {
  return;
 }
 // Remove this item from existing tree.
 if (tree != null) {
  if (tree.getSelectedItem() == this) {
   tree.setSelectedItem(null);
  }
  if (widget != null) {
   tree.orphan(widget);
  }
 }
 tree = newTree;
 for (int i = 0, n = getChildCount(); i < n; ++i) {
  children.get(i).setTree(newTree);
 }
 updateState(false, true);
 if (newTree != null) {
  if (widget != null) {
   // Add my widget to the new tree.
   newTree.adopt(widget, this);
  }
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Selects a specified item.
 *
 * @param item the item to be selected, or <code>null</code> to deselect all
 *          items
 */
public void setSelectedItem(TreeItem item) {
 setSelectedItem(item, true);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Selects a specified item.
 *
 * @param item the item to be selected, or <code>null</code> to deselect all
 *          items
 */
public void setSelectedItem(TreeItem item) {
 setSelectedItem(item, true);
}

代码示例来源:origin: net.wetheinter/gwt-user

void maybeUpdateSelection(TreeItem itemThatChangedState, boolean isItemOpening) {
 /**
  * If we just closed the item, let's check to see if this item is the parent
  * of the currently selected item. If so, we should make this item the
  * currently selected selected item.
  */
 if (!isItemOpening) {
  TreeItem tempItem = curSelection;
  while (tempItem != null) {
   if (tempItem == itemThatChangedState) {
    setSelectedItem(itemThatChangedState);
    return;
   }
   tempItem = tempItem.getParentItem();
  }
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

void maybeUpdateSelection(TreeItem itemThatChangedState, boolean isItemOpening) {
 /**
  * If we just closed the item, let's check to see if this item is the parent
  * of the currently selected item. If so, we should make this item the
  * currently selected selected item.
  */
 if (!isItemOpening) {
  TreeItem tempItem = curSelection;
  while (tempItem != null) {
   if (tempItem == itemThatChangedState) {
    setSelectedItem(itemThatChangedState);
    return;
   }
   tempItem = tempItem.getParentItem();
  }
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

private void maybeCollapseTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (curSelection.getState()) {
  curSelection.setState(false);
 } else {
  TreeItem parent = curSelection.getParentItem();
  if (parent != null) {
   setSelectedItem(parent);
  }
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

private void maybeCollapseTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (curSelection.getState()) {
  curSelection.setState(false);
 } else {
  TreeItem parent = curSelection.getParentItem();
  if (parent != null) {
   setSelectedItem(parent);
  }
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

private void maybeExpandTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (!curSelection.getState()) {
  curSelection.setState(true);
 } else if (curSelection.getChildCount() > 0) {
  setSelectedItem(curSelection.getChild(0));
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

private void maybeExpandTreeItem() {
 TreeItem topClosedParent = getTopClosedParent(curSelection);
 if (topClosedParent != null) {
  // Select the first visible parent if curSelection is hidden
  setSelectedItem(topClosedParent);
 } else if (!curSelection.getState()) {
  curSelection.setState(true);
 } else if (curSelection.getChildCount() > 0) {
  setSelectedItem(curSelection.getChild(0));
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
 setSelectedItem(item, true);

代码示例来源:origin: net.wetheinter/gwt-user

void setTree(Tree newTree) {
 // Early out.
 if (tree == newTree) {
  return;
 }
 // Remove this item from existing tree.
 if (tree != null) {
  if (tree.getSelectedItem() == this) {
   tree.setSelectedItem(null);
  }
  if (widget != null) {
   tree.orphan(widget);
  }
 }
 tree = newTree;
 for (int i = 0, n = getChildCount(); i < n; ++i) {
  children.get(i).setTree(newTree);
 }
 updateState(false, true);
 if (newTree != null) {
  if (widget != null) {
   // Add my widget to the new tree.
   newTree.adopt(widget, this);
  }
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

void setTree(Tree newTree) {
 // Early out.
 if (tree == newTree) {
  return;
 }
 // Remove this item from existing tree.
 if (tree != null) {
  if (tree.getSelectedItem() == this) {
   tree.setSelectedItem(null);
  }
  if (widget != null) {
   tree.orphan(widget);
  }
 }
 tree = newTree;
 for (int i = 0, n = getChildCount(); i < n; ++i) {
  children.get(i).setTree(newTree);
 }
 updateState(false, true);
 if (newTree != null) {
  if (widget != null) {
   // Add my widget to the new tree.
   newTree.adopt(widget, this);
  }
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
 setSelectedItem(item, true);

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
 setSelectedItem(item, true);

相关文章