/** * Check if mListIndex is selected, if mListIndex is NO_SELECTION, check if there is no selection. * @return the state, true if the user provided index is contained in the list selection */ protected boolean getInternalState() { if ((mTreePath == null) && mTreeSelectionModel.isSelectionEmpty()) { return true; } else { return mTreeSelectionModel.isPathSelected(mTreePath); } }
@Override public Point getPopupLocation(final MouseEvent event) { if (event != null) { // Select item on right click TreePath tp = treeAlert.getPathForLocation(event.getX(), event.getY()); if (tp != null) { // Only select a new item if the current item is not // already selected - this is to allow multiple items // to be selected if (!treeAlert.getSelectionModel().isPathSelected(tp)) { treeAlert.getSelectionModel().setSelectionPath(tp); } } } return super.getPopupLocation(event); } };
Map.Entry<TreePathId, Object> entry = it.next(); if (tree.getSelectionModel() .isPathSelected(entry.getKey().path)) continue;
/** * @inheritDoc */ @Override protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { // modify the paintContext's state to match the state for the row // this is a hack in that it requires knowledge of the subsequent // method calls. The point is, the context used in drawCentered // should reflect the state of the row, not of the tree. boolean isSelected = tree.getSelectionModel().isPathSelected(path); int state = paintContext.getComponentState(); if (isSelected) { paintContext.setComponentState(state | SynthConstants.SELECTED); } super.paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); paintContext.setComponentState(state); }
@Override public void valueChanged(TreeSelectionEvent event) { if (!adjusting) { TreePath path = event.getPath(); Layer layer = getLayer(path); if (layer.getParent() != null) { boolean pathSelected = ((TreeSelectionModel) event.getSource()).isPathSelected(path); layer.setVisible(pathSelected); } } } }
Map.Entry<TreePathId, Object> entry = it.next(); if (tree.getSelectionModel() .isPathSelected(entry.getKey().path)) continue;
@Override public void valueChanged(TreeSelectionEvent event) { if (!adjusting) { TreePath path = event.getPath(); Layer layer = getLayer(path); if (layer.getParent() != null) { boolean pathSelected = ((TreeSelectionModel) event.getSource()).isPathSelected(path); layer.setVisible(pathSelected); } } } }
IValueConnector childConnector = parentCollectionConnector .getChildConnector(i); if (sm.isPathSelected(parentTreePath .pathByAddingChild(childConnector))) { rvTmp[n++] = i;
IValueConnector childConnector = parentCollectionConnector .getChildConnector(i); if (sm.isPathSelected(parentTreePath .pathByAddingChild(childConnector))) { rvTmp[n++] = i;
IValueConnector childConnector = parentCollectionConnector .getChildConnector(i); if (sm.isPathSelected(parentTreePath .pathByAddingChild(childConnector))) { rvTmp[n++] = i;
IValueConnector childConnector = parentCollectionConnector .getChildConnector(i); if (sm.isPathSelected(parentTreePath .pathByAddingChild(childConnector))) { rvTmp[n++] = i;
/** Configures a tree cell renderer and sets up sizing and the * backing image from it */ public boolean configure (Object nd, JScrollPane tv, JTree tree, TreePath path, int row) { setLastRendereredObject(nd); setLastRenderedScrollPane (tv); Component renderer = null; bg = tree.getBackground(); boolean sel = tree.isSelectionEmpty() ? false : tree.getSelectionModel().isPathSelected(path); boolean exp = tree.isExpanded(path); boolean leaf = !exp && tree.getModel().isLeaf(nd); boolean lead = path.equals(tree.getSelectionModel().getLeadSelectionPath()); renderer = tree.getCellRenderer().getTreeCellRendererComponent(tree, nd, sel, exp, leaf, row, lead); if (renderer != null) { setComponent (renderer); } return true; }
/** Configures a tree cell renderer and sets up sizing and the * backing image from it */ public boolean configure (Object nd, JScrollPane tv, JTree tree, TreePath path, int row) { boolean sameVn = setLastRendereredObject(nd); boolean sameComp = setLastRenderedScrollPane (tv); Component renderer = null; bg = tree.getBackground(); boolean sel = tree.isSelectionEmpty() ? false : tree.getSelectionModel().isPathSelected(path); boolean exp = tree.isExpanded(path); boolean leaf = !exp && tree.getModel().isLeaf(nd); boolean lead = path.equals(tree.getSelectionModel().getLeadSelectionPath()); renderer = tree.getCellRenderer().getTreeCellRendererComponent(tree, nd, sel, exp, leaf, row, lead); if (renderer != null) { setComponent (renderer); } return true; }
return selectionModel.isPathSelected(path);