diff --git a/openide.explorer/apichanges.xml b/openide.explorer/apichanges.xml
--- a/openide.explorer/apichanges.xml
+++ b/openide.explorer/apichanges.xml
@@ -50,6 +50,23 @@
Explorer API
+
+
+ Hide node icons in OutlineView and TreeView.
+
+
+
+
+
+ It is possible not to show icons in OutlineView and in TreeView and it's descendants.
+ Methods OutlineView.setShowNodeIcons(boolean)/isShowNodeIcons()
+ and NodeRenderer.setShowIcons(boolean)/isShowIcons()
+ are added for this purpose.
+
+
+
+
+
Turn auto-complete in combo box editor off.
diff --git a/openide.explorer/manifest.mf b/openide.explorer/manifest.mf
--- a/openide.explorer/manifest.mf
+++ b/openide.explorer/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.openide.explorer
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
AutoUpdate-Essential-Module: true
-OpenIDE-Module-Specification-Version: 6.58
+OpenIDE-Module-Specification-Version: 6.59
diff --git a/openide.explorer/src/org/openide/explorer/view/NodeRenderDataProvider.java b/openide.explorer/src/org/openide/explorer/view/NodeRenderDataProvider.java
--- a/openide.explorer/src/org/openide/explorer/view/NodeRenderDataProvider.java
+++ b/openide.explorer/src/org/openide/explorer/view/NodeRenderDataProvider.java
@@ -43,8 +43,11 @@
*/
package org.openide.explorer.view;
+import java.awt.Component;
+import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Collections;
+import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.tree.AbstractLayoutCache;
import javax.swing.tree.TreeNode;
@@ -60,6 +63,8 @@
class NodeRenderDataProvider implements CheckRenderDataProvider {
private Outline table;
+ private boolean showIcons = true;
+ private Icon emptyIcon;
/** Creates a new instance of NodeRenderDataProvider */
public NodeRenderDataProvider(Outline table) {
@@ -84,8 +89,22 @@
public java.awt.Color getForeground(Object o) {
return null;
}
+
+ public void setShowIcons(boolean showIcons) {
+ this.showIcons = showIcons;
+ if (!showIcons && emptyIcon == null) {
+ emptyIcon = new EmptyIcon();
+ }
+ }
+
+ public boolean isShowIcons() {
+ return showIcons;
+ }
public javax.swing.Icon getIcon(Object o) {
+ if (!showIcons) {
+ return emptyIcon;
+ }
Node n = Visualizer.findNode(o);
if (n == null) {
throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName());
@@ -161,5 +180,23 @@
c.setSelected(selected);
}
}
+
+ private static final class EmptyIcon implements Icon {
+
+ @Override
+ public void paintIcon(Component c, Graphics g, int x, int y) {
+ }
+
+ @Override
+ public int getIconWidth() {
+ return 0;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return 0;
+ }
+
+ }
}
diff --git a/openide.explorer/src/org/openide/explorer/view/NodeRenderer.java b/openide.explorer/src/org/openide/explorer/view/NodeRenderer.java
--- a/openide.explorer/src/org/openide/explorer/view/NodeRenderer.java
+++ b/openide.explorer/src/org/openide/explorer/view/NodeRenderer.java
@@ -76,6 +76,9 @@
/** Flag indicating if to use big icons. */
private boolean bigIcons = false;
+ /** Flag indicating whether to show icons. */
+ private boolean showIcons = true;
+ private int labelGap;
private HtmlRenderer.Renderer renderer = HtmlRenderer.createRenderer();
/** Creates default renderer. */
@@ -112,6 +115,17 @@
return instance;
}
+
+ public final void setShowIcons(boolean showIcons) {
+ this.showIcons = showIcons;
+ if (!showIcons) {
+ labelGap = new JLabel().getIconTextGap();
+ }
+ }
+
+ public final boolean isShowIcons() {
+ return showIcons;
+ }
/** Finds the component that is capable of drawing the cell in a tree.
* @param value value can be either Node
@@ -212,6 +226,12 @@
private int configureFrom(
HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis
) {
+ if (!isShowIcons()) {
+ ren.setIcon(null);
+ ren.setIndent(labelGap);
+ return 24;
+ }
+
Icon icon = vis.getIcon(useOpenedIcon, bigIcons);
if (icon.getIconWidth() > 0) {
diff --git a/openide.explorer/src/org/openide/explorer/view/OutlineView.java b/openide.explorer/src/org/openide/explorer/view/OutlineView.java
--- a/openide.explorer/src/org/openide/explorer/view/OutlineView.java
+++ b/openide.explorer/src/org/openide/explorer/view/OutlineView.java
@@ -229,6 +229,8 @@
private Component searchPanel;
private final Object searchConstraints = new Object();
private KeyListener qsKeyListener;
+
+ private NodeRenderDataProvider nodeRenderer;
/** Creates a new instance of TableView */
public OutlineView() {
@@ -260,7 +262,8 @@
};
outline.addKeyListener(qsKeyListener);
rowModel.setOutline(outline);
- outline.setRenderDataProvider(new NodeRenderDataProvider(outline));
+ nodeRenderer = new NodeRenderDataProvider(outline);
+ outline.setRenderDataProvider(nodeRenderer);
SheetCell tableCell = new SheetCell.OutlineSheetCell(outline);
outline.setDefaultRenderer(Node.Property.class, tableCell);
outline.setDefaultEditor(Node.Property.class, tableCell);
@@ -1367,6 +1370,24 @@
}
return res;
}
+
+ /**
+ * Turn node icon rendering on/off. Node icons are shown by default.
+ * @param showNodeIcons whether to show node icons or not.
+ * @since 6.59
+ */
+ public final void setShowNodeIcons(boolean showNodeIcons) {
+ nodeRenderer.setShowIcons(showNodeIcons);
+ }
+
+ /**
+ * Test whether the node icons are shown.
+ * @return true
when node icons are shown, false
otherwise.
+ * @since 6.59
+ */
+ public final boolean isShowNodeIcons() {
+ return nodeRenderer.isShowIcons();
+ }
/**
* Listener attached to the explorer manager and also to the