Lines 114-129
Link Here
|
114 |
NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.contextView.name")); // NOI18N |
114 |
NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.contextView.name")); // NOI18N |
115 |
contextView.setAllowedDragActions(DnDConstants.ACTION_NONE); |
115 |
contextView.setAllowedDragActions(DnDConstants.ACTION_NONE); |
116 |
contextView.setAllowedDropActions(DnDConstants.ACTION_NONE); |
116 |
contextView.setAllowedDropActions(DnDConstants.ACTION_NONE); |
|
|
117 |
contextView.setShowNodeIcons(false); |
117 |
contextView.addPropertyColumn( |
118 |
contextView.addPropertyColumn( |
118 |
KnockoutNode.ValueProperty.NAME, |
119 |
KnockoutNode.ValueProperty.NAME, |
119 |
NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.contextView.value")); // NOI18N |
120 |
NbBundle.getMessage(KnockoutPanel.class, "KnockoutPanel.contextView.value")); // NOI18N |
120 |
|
121 |
|
121 |
Outline outline = contextView.getOutline(); |
122 |
Outline outline = contextView.getOutline(); |
122 |
outline.setRootVisible(false); |
123 |
outline.setRootVisible(false); |
123 |
TableCellRenderer renderer = outline.getDefaultRenderer(Object.class); |
|
|
124 |
if (renderer != null) { |
125 |
outline.setDefaultRenderer(Object.class, new NoIconRenderer(renderer)); |
126 |
} |
127 |
} |
124 |
} |
128 |
|
125 |
|
129 |
/** |
126 |
/** |
Lines 287-358
Link Here
|
287 |
|
284 |
|
288 |
} |
285 |
} |
289 |
|
286 |
|
290 |
/** |
|
|
291 |
* Renderer that delegates to the given renderer but doesn't paint icons. |
292 |
*/ |
293 |
final static class NoIconRenderer implements TableCellRenderer { |
294 |
/** The original table cell renderer. */ |
295 |
private final TableCellRenderer originalRenderer; |
296 |
/** Icon used instead of the original icons. */ |
297 |
private final Icon emptyIcon; |
298 |
|
299 |
/** |
300 |
* Creates a new {@code NoIconRenderer} for the specified renderer. |
301 |
* |
302 |
* @param originalRenderer renderer whose icon should be removed. |
303 |
*/ |
304 |
public NoIconRenderer(TableCellRenderer originalRenderer) { |
305 |
this.originalRenderer = originalRenderer; |
306 |
// Icons with zero width/height are ignored |
307 |
this.emptyIcon = new EmptyIcon(1, 1); |
308 |
} |
309 |
|
310 |
@Override |
311 |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
312 |
Component component = originalRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); |
313 |
if (component instanceof JLabel) { |
314 |
JLabel label = (JLabel)component; |
315 |
if (label.getIcon() != null) { |
316 |
label.setIcon(emptyIcon); |
317 |
} |
318 |
} |
319 |
return component; |
320 |
} |
321 |
|
322 |
} |
323 |
|
324 |
/** |
325 |
* Empty (transparent) icon. |
326 |
*/ |
327 |
final static class EmptyIcon implements Icon { |
328 |
private final int width; |
329 |
private final int height; |
330 |
|
331 |
/** |
332 |
* Creates a new {@code EmptyIcon}. |
333 |
* |
334 |
* @param width width of the icon. |
335 |
* @param height height of the icon. |
336 |
*/ |
337 |
EmptyIcon(int width, int height) { |
338 |
this.width = width; |
339 |
this.height = height; |
340 |
} |
341 |
|
342 |
@Override |
343 |
public void paintIcon(Component c, Graphics g, int x, int y) { |
344 |
} |
345 |
|
346 |
@Override |
347 |
public int getIconWidth() { |
348 |
return width; |
349 |
} |
350 |
|
351 |
@Override |
352 |
public int getIconHeight() { |
353 |
return height; |
354 |
} |
355 |
|
356 |
} |
357 |
|
358 |
} |
287 |
} |