/** Returns cached short description. * @return short description of represented node */ public String getShortDescription() { String desc = shortDescription; if (desc == UNKNOWN) { shortDescription = desc = node.getShortDescription(); } String toolTip = ImageUtilities.getImageToolTip(ImageUtilities.icon2Image(icon != null ? icon : getIcon(false, false))); if (toolTip.length() > 0) { StringBuilder str = new StringBuilder(128); str.append("<html>").append(desc).append("<br>").append(toolTip).append("</html>"); desc = str.toString(); } return desc; }
/** Main method of the editor. * @return component of editor */ @Override public Component getTreeCellEditorComponent( JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row ) { Node ren = Visualizer.findNode(value); if ((ren != null) && (ren.canRename())) { delegate.setValue(ren.getName()); } else { delegate.setValue(""); // NOI18N } editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
/** Utility method which performs configuration which is common to all of the renderer * implementations - sets the icon and focus properties on the renderer * from the VisualizerNode. * */ private int configureFrom (HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis) { Icon icon = vis.getIcon(useOpenedIcon, bigIcons); if (icon.getIconWidth() > 0) { //Max annotated icon width is 24, so to have all the text and all //the icons come out aligned, set the icon text gap to the difference //plus a two pixel margin ren.setIconTextGap (24 - icon.getIconWidth()); } else { //If the icon width is 0, fill the space and add in //the extra two pixels so the node names are aligned (btw, this //does seem to waste a frightful amount of horizontal space in //a tree that can use all it can get) ren.setIndent (26); } ren.setIcon (icon); if (target instanceof TreeTable.TreeTableCellRenderer) { TreeTable tt = ((TreeTable.TreeTableCellRenderer) target).getTreeTable(); ren.setParentFocused (tt.hasFocus() || tt.isEditing()); } return icon.getIconWidth() == 0 ? 24 : icon.getIconWidth(); }
/** Main method of the editor. * @return component of editor */ public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { Node ren = Visualizer.findNode (value); if ((ren != null) && (ren.canRename ())) delegate.setValue(ren.getName()); else delegate.setValue(""); // NOI18N editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
/** Main method of the editor. * @return component of editor */ public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { Node ren = Visualizer.findNode (value); if ((ren != null) && (ren.canRename ())) delegate.setValue(ren.getName()); else delegate.setValue(""); // NOI18N editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
/** Utility method which performs configuration which is common to all of the renderer * implementations - sets the icon and focus properties on the renderer * from the VisualizerNode. * */ private int configureFrom (HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis) { Icon icon = vis.getIcon(useOpenedIcon, bigIcons); if (icon.getIconWidth() > 0) { //Max annotated icon width is 24, so to have all the text and all //the icons come out aligned, set the icon text gap to the difference //plus a two pixel margin ren.setIconTextGap (24 - icon.getIconWidth()); } else { //If the icon width is 0, fill the space and add in //the extra two pixels so the node names are aligned (btw, this //does seem to waste a frightful amount of horizontal space in //a tree that can use all it can get) ren.setIndent (26); } ren.setIcon (icon); if (target instanceof TreeTable.TreeTableCellRenderer) { TreeTable tt = ((TreeTable.TreeTableCellRenderer) target).getTreeTable(); ren.setParentFocused (tt.hasFocus() || tt.isEditing()); } return icon.getIconWidth() == 0 ? 24 : icon.getIconWidth(); }
HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis ) { Icon icon = vis.getIcon(useOpenedIcon, bigIcons);