org.jdesktop.swingx
Class LinkRenderer
java.lang.Object
javax.swing.AbstractCellEditor
org.jdesktop.swingx.LinkRenderer
- All Implemented Interfaces:
- Serializable, CellEditor, ListCellRenderer, TableCellEditor, TableCellRenderer, TreeCellRenderer, RolloverRenderer
Deprecated. as renderer (the editor part is not yet handled),
use the SwingX DefaultXXRenderer configured with a
HyperlinkProvider
instead
public class LinkRenderer
- extends AbstractCellEditor
- implements TableCellRenderer, TableCellEditor, ListCellRenderer, TreeCellRenderer, RolloverRenderer
A Renderer/Editor for "Links".
The renderer is configured with a LinkAction.
It's mostly up to the developer to guarantee that the all
values which are passed into the getXXRendererComponent(...) are
compatible with T: she can provide a runtime class to check against.
If it isn't the renderer will configure the
action with a null target.
It's recommended to not use the given Action anywhere else in code,
as it is updated on each getXXRendererComponent() call which might
lead to undesirable side-effects.
Internally uses JXHyperlink for both CellRenderer and CellEditor
It's recommended to not reuse the same instance for both functions.
PENDING: make renderer respect selected cell state.
PENDING: TreeCellRenderer has several issues
- no icons
- usual background highlighter issues
- See Also:
- Serialized Form
Constructor Summary |
LinkRenderer()
Deprecated. Instantiate a LinkRenderer with null LinkAction and null
targetClass. |
LinkRenderer(LinkAction linkAction)
Deprecated. Instantiate a LinkRenderer with the LinkAction to use with
target values. |
LinkRenderer(LinkAction linkAction,
Class targetClass)
Deprecated. Instantiate a LinkRenderer with a LinkAction to use with
target values and the type of values the action can cope with. |
Method Summary |
protected LinkAction |
createDefaultLinkAction()
Deprecated. default action - does nothing... |
protected JXHyperlink |
createHyperlink()
Deprecated. creates and returns the hyperlink component used for rendering
the value and activating the action on the target value. |
void |
doClick()
Deprecated. Same as AbstractButton.doClick(). |
protected void |
fireEditingStopped()
Deprecated. Notifies all listeners that have registered interest for
notification on this event type. |
Object |
getCellEditorValue()
Deprecated. Returns the value contained in the editor. |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Deprecated. Return a component that has been configured to display the specified
value. |
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Deprecated. Sets an initial value for the editor. |
Component |
getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Deprecated. Returns the component used for drawing the cell. |
Component |
getTreeCellRendererComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Deprecated. Sets the value of the current tree cell to value . |
boolean |
isEnabled()
Deprecated. |
boolean |
isTargetable(Object target)
Deprecated. decides if the given target is acceptable for setTarget. |
void |
setLinkAction(LinkAction linkAction)
Deprecated. Sets the LinkAction for handling the values. |
void |
setLinkAction(LinkAction linkAction,
Class targetClass)
Deprecated. Sets the LinkAction for handling the values and the
class the action can handle. |
void |
setTargetClass(Class targetClass)
Deprecated. Sets the class the action is supposed to handle. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
targetClass
protected Class<?> targetClass
- Deprecated.
LinkRenderer
public LinkRenderer()
- Deprecated.
- Instantiate a LinkRenderer with null LinkAction and null
targetClass.
LinkRenderer
public LinkRenderer(LinkAction linkAction)
- Deprecated.
- Instantiate a LinkRenderer with the LinkAction to use with
target values.
- Parameters:
linkAction
- the action that acts on values.
LinkRenderer
public LinkRenderer(LinkAction linkAction,
Class targetClass)
- Deprecated.
- Instantiate a LinkRenderer with a LinkAction to use with
target values and the type of values the action can cope with.
It's up to developers to take care of matching types.
- Parameters:
linkAction
- the action that acts on values.targetClass
- the type of values the action can handle.
setTargetClass
public void setTargetClass(Class targetClass)
- Deprecated.
- Sets the class the action is supposed to handle.
PENDING: make sense to set independently of LinkAction?
- Parameters:
targetClass
- the type of values the action can handle.
setLinkAction
public void setLinkAction(LinkAction linkAction)
- Deprecated.
- Sets the LinkAction for handling the values.
The action is assumed to be able to cope with any type, that is
this method is equivalent to setLinkAction(linkAction, null).
- Parameters:
linkAction
-
setLinkAction
public void setLinkAction(LinkAction linkAction,
Class targetClass)
- Deprecated.
- Sets the LinkAction for handling the values and the
class the action can handle.
PENDING: in the general case this is not independent of the
targetClass. Need api to set them combined?
- Parameters:
linkAction
-
isTargetable
public boolean isTargetable(Object target)
- Deprecated.
- decides if the given target is acceptable for setTarget.
target == null is acceptable for all types.
targetClass == null is the same as Object.class
- Parameters:
target
- the target to set.
- Returns:
- true if setTarget can cope with the object,
false otherwise.
createHyperlink
protected JXHyperlink createHyperlink()
- Deprecated.
- creates and returns the hyperlink component used for rendering
the value and activating the action on the target value.
- Returns:
- the hyperlink renderer component.
createDefaultLinkAction
protected LinkAction createDefaultLinkAction()
- Deprecated.
- default action - does nothing... except showing the target.
- Returns:
- a default LinkAction for showing the target.
isEnabled
public boolean isEnabled()
- Deprecated.
- Specified by:
isEnabled
in interface RolloverRenderer
- Returns:
- true if rollover effects are on and clickable.
doClick
public void doClick()
- Deprecated.
- Description copied from interface:
RolloverRenderer
- Same as AbstractButton.doClick(). It's up to client
code to prepare the renderer's component before calling
this method.
- Specified by:
doClick
in interface RolloverRenderer
getListCellRendererComponent
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
- Deprecated.
- Description copied from interface:
javax.swing.ListCellRenderer
- Return a component that has been configured to display the specified
value. That component's
paint
method is then called to
"render" the cell. If it is necessary to compute the dimensions
of a list because the list cells do not have a fixed size, this method
is called to generate a component on which getPreferredSize
can be invoked.
- Specified by:
getListCellRendererComponent
in interface ListCellRenderer
- Parameters:
list
- The JList we're painting.value
- The value returned by list.getModel().getElementAt(index).index
- The cells index.isSelected
- True if the specified cell was selected.cellHasFocus
- True if the specified cell has the focus.
- Returns:
- A component whose paint() method will render the specified value.
- See Also:
JList
,
ListSelectionModel
,
ListModel
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
- Deprecated.
- Description copied from interface:
javax.swing.table.TableCellRenderer
- Returns the component used for drawing the cell. This method is
used to configure the renderer appropriately before drawing.
- Specified by:
getTableCellRendererComponent
in interface TableCellRenderer
- Parameters:
table
- the JTable
that is asking the
renderer to draw; can be null
value
- the value of the cell to be rendered. It is
up to the specific renderer to interpret
and draw the value. For example, if
value
is the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a
valid valueisSelected
- true if the cell is to be rendered with the
selection highlighted; otherwise falsehasFocus
- if true, render cell appropriately. For
example, put a special border on the cell, if
the cell can be edited, render in the color used
to indicate editingrow
- the row index of the cell being drawn. When
drawing the header, the value of
row
is -1column
- the column index of the cell being drawn
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
- Deprecated.
- Description copied from interface:
javax.swing.table.TableCellEditor
- Sets an initial
value
for the editor. This will cause
the editor to stopEditing
and lose any partially
edited value if the editor is editing when this method is called.
Returns the component that should be added to the client's
Component
hierarchy. Once installed in the client's
hierarchy this component will then be able to draw and receive
user input.
- Specified by:
getTableCellEditorComponent
in interface TableCellEditor
- Parameters:
table
- the JTable
that is asking the
editor to edit; can be null
value
- the value of the cell to be edited; it is
up to the specific editor to interpret
and draw the value. For example, if value is
the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a valid valueisSelected
- true if the cell is to be rendered with
highlightingrow
- the row of the cell being editedcolumn
- the column of the cell being edited
- Returns:
- the component for editing
getCellEditorValue
public Object getCellEditorValue()
- Deprecated.
- Description copied from interface:
javax.swing.CellEditor
- Returns the value contained in the editor.
- Specified by:
getCellEditorValue
in interface CellEditor
- Returns:
- the value contained in the editor
fireEditingStopped
protected void fireEditingStopped()
- Deprecated.
- Description copied from class:
javax.swing.AbstractCellEditor
- Notifies all listeners that have registered interest for
notification on this event type. The event instance
is created lazily.
- Overrides:
fireEditingStopped
in class AbstractCellEditor
- See Also:
EventListenerList
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
- Deprecated.
- Description copied from interface:
javax.swing.tree.TreeCellRenderer
- Sets the value of the current tree cell to
value
.
If selected
is true, the cell will be drawn as if
selected. If expanded
is true the node is currently
expanded and if leaf
is true the node represets a
leaf and if hasFocus
is true the node currently has
focus. tree
is the JTree
the receiver is being
configured for. Returns the Component
that the renderer
uses to draw the value.
- Specified by:
getTreeCellRendererComponent
in interface TreeCellRenderer
- Returns:
- the
Component
that the renderer uses to draw the value