public class IlvPaletteTreeViewer extends Object implements IlvPaletteViewer
JTree that displays the associated palette
as a nested hierarchy of nodes (categories, class
IlvPaletteCategory) and leaves (symbols, class
IlvPaletteSymbol). It supports drag and drop of symbols and
categories. By default this viewer is not editable, meaning that
drag-and-drop has no effect; to change this state use
setEditabel(true). It also does not support multiselection by
default. The main component returned by this viewer is a instance of
JTree| Constructor and Description |
|---|
IlvPaletteTreeViewer()
Creates a palette viewer containing a
JTree. |
| Modifier and Type | Method and Description |
|---|---|
void |
addDropListener(PaletteDropListener l)
Adds a listener that listens to drag and drop events.
|
void |
addPaletteViewerListener(PaletteViewerListener l)
Adds a listener to track category or symbol selection in the viewer
|
protected String |
convertValueToText(IlvPaletteBaseObject obj,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Returns the string representation of the value.
|
protected void |
fireCategoryDeselected(IlvPalette p,
IlvPaletteCategory c)
Fires a
PaletteViewerEvent to the registered listeners,
indicating that a category has been deselected. |
protected void |
fireCategorySelected(IlvPalette p,
IlvPaletteCategory c)
Fires a
PaletteViewerEvent to the registered listeners,
indicating that a category has been selected. |
protected void |
fireObjectCopied(IlvPalette sourcePalette,
IlvPalette targetPalette,
Collection objects)
Fire an event when copying objects into a palette using drag and drop
|
protected void |
fireObjectMoved(IlvPalette sourcePalette,
IlvPalette targetPalette,
Collection objects)
Fire an event when moving objects into a palette using drag and drop
|
protected void |
fireSymbolDeselected(IlvPalette p,
IlvPaletteSymbol s)
Fire a
PaletteViewerEvent to the registered listeners,
indicating that a symbol has been deselected. |
protected void |
fireSymbolSelected(IlvPalette p,
IlvPaletteSymbol s)
Fire a
PaletteViewerEvent to the registered listeners,
indicating that a symbol has been selected. |
JComponent |
getComponent()
Returns the Swing component used to display the content of the palette.
|
IlvPalette |
getPalette()
Returns the palette represented in this viewer
|
IlvPaletteObject[] |
getSelectedPaletteObjects()
Returns the selected palette objects selected in the tree
|
boolean |
isEditable()
Indicates if the viewer allows edition of palette
|
void |
removeDropListener(PaletteDropListener l)
Removed a listener that listens to drag and drop events.
|
void |
removePaletteViewerListener(PaletteViewerListener l)
Removes a listener used to track category or symbol selection in the viewer
|
void |
select(IlvPaletteObject object)
Selects an object in the viewer.
|
void |
setEditable(boolean editable)
Indicates if the viewer will allow interactive edition of palette
(for example by drag and drop operation).
|
void |
setMultiSelectionEnabled(boolean multiselection)
Enabled or disabled multiselection in this palette viewer.
|
void |
setPalette(IlvPalette palette)
Sets the palette represented in this viewer.
|
public IlvPaletteTreeViewer()
JTree.public void setPalette(IlvPalette palette)
setPalette in interface IlvPaletteViewerpalette - The palette to display.public IlvPalette getPalette()
getPalette in interface IlvPaletteViewerpublic JComponent getComponent()
getComponent in interface IlvPaletteViewerpublic void addPaletteViewerListener(PaletteViewerListener l)
addPaletteViewerListener in interface IlvPaletteViewerl - The listener to addpublic void removePaletteViewerListener(PaletteViewerListener l)
removePaletteViewerListener in interface IlvPaletteViewerl - The listener to removeprotected void fireCategorySelected(IlvPalette p, IlvPaletteCategory c)
PaletteViewerEvent to the registered listeners,
indicating that a category has been selected.protected void fireCategoryDeselected(IlvPalette p, IlvPaletteCategory c)
PaletteViewerEvent to the registered listeners,
indicating that a category has been deselected.protected void fireSymbolSelected(IlvPalette p, IlvPaletteSymbol s)
PaletteViewerEvent to the registered listeners,
indicating that a symbol has been selected.protected void fireSymbolDeselected(IlvPalette p, IlvPaletteSymbol s)
PaletteViewerEvent to the registered listeners,
indicating that a symbol has been deselected.public void setEditable(boolean editable)
setEditable in interface IlvPaletteViewereditable - true if the viewer must be editable, otherwise falsepublic boolean isEditable()
isEditable in interface IlvPaletteViewertrue is the viewer is editable, otherwise falsepublic void select(IlvPaletteObject object)
select in interface IlvPaletteViewerobject - The palette object to selectpublic IlvPaletteObject[] getSelectedPaletteObjects()
public void addDropListener(PaletteDropListener l)
l - The listener to addpublic void removeDropListener(PaletteDropListener l)
l - The listener to removeprotected void fireObjectMoved(IlvPalette sourcePalette, IlvPalette targetPalette, Collection objects)
sourcePalette - the palette where the moved objects come fromtargetPalette - the palette where objects have been movedobjects - the objects that have been movedPaletteListener,
PaletteEventprotected void fireObjectCopied(IlvPalette sourcePalette, IlvPalette targetPalette, Collection objects)
sourcePalette - the palette where the moved objects come fromtargetPalette - the palette where objects have been copiedobjects - the objects that have been copiedPaletteListener,
PaletteEventpublic void setMultiSelectionEnabled(boolean multiselection)
multiselection - true to enable multiselection otherwise false.protected String convertValueToText(IlvPaletteBaseObject obj, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.