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 IlvPaletteViewer
palette
- The palette to display.public IlvPalette getPalette()
getPalette
in interface IlvPaletteViewer
public JComponent getComponent()
getComponent
in interface IlvPaletteViewer
public void addPaletteViewerListener(PaletteViewerListener l)
addPaletteViewerListener
in interface IlvPaletteViewer
l
- The listener to addpublic void removePaletteViewerListener(PaletteViewerListener l)
removePaletteViewerListener
in interface IlvPaletteViewer
l
- 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 IlvPaletteViewer
editable
- true
if the viewer must be editable, otherwise false
public boolean isEditable()
isEditable
in interface IlvPaletteViewer
true
is the viewer is editable, otherwise false
public void select(IlvPaletteObject object)
select
in interface IlvPaletteViewer
object
- 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
,
PaletteEvent
protected 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
,
PaletteEvent
public 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 Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.