Class CellContext
java.lang.Object
org.jdesktop.swingx.renderer.CellContext
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CalendarCellContext, ListCellContext, TableCellContext, TreeCellContext
Encapsulates a snapshop of cell content and default display context
for usage by a
ComponentProvider.
One part is the super-set of properties that's traditionally passed into the core renderers' (Table-, List-, Tree-) getXXCellRendererComponent. Raw properties which define the context are
- selected
- focused
- expanded
- leaf
- foreground and background color
- border
- icon (relevant for trees only)
- editable
- PENDING: still incomplete? how about Font?
- PENDING: protected methods? Probably need to open up - derived properties should be accessible in client code.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected JComponentPENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx.protected booleanprotected booleanprotected booleanprotected booleanprotected static Borderthe default border for unfocused cells.protected intprivate static final Border?? the default border for unfocused cells.protected booleanprotected ObjectPENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ColorReturns the background color of the renderered component or null if the component is nullprotected BorderReturns the default border of the renderered component depending on cell state.intReturns the cell's column index in view coordinates as set in the install.Returns the component the cell resides on, may be null.protected Colorprotected Colorprotected ColorReturns the default focused background color of the renderered component.protected BorderReturns the default focus border of the renderered component.protected ColorReturns the default focused foreground color of the renderered component.protected FontgetFont()Returns the Font of the target component or null if no component installed.protected ColorReturns the foreground color of the renderered component or null if the component is nullgetIcon()Returns the icon.private static BorderReturns the shared border for unfocused cells.intgetRow()Returns the cell's row index in view coordinates as set in the install.protected ColorReturns the default selection background color of the renderered component.protected ColorReturns the default selection foreground color of the renderered component.protected StringConvenience method to build a component type specific lookup key for the UIManager.protected StringReturns the component type specific prefix of keys for lookup in the UIManager.getValue()Returns the value of the cell as set in the install.protected voidinstallState(Object value, int row, int column, boolean selected, boolean focused, boolean expanded, boolean leaf) Sets the state of the cell's context.protected booleanisDropOn()Returns a boolean indicating if the cell is a drop location with any of the dropOn modes.booleanReturns the cell's editability.booleanReturns the expanded state as set in the install.booleanReturns the focused state as set in the install.booleanisLeaf()Returns the leaf state as set in the install.booleanReturns the selected state as set in the install.replaceValue(Object value) Replaces the value of this cell context with the given parameter and returns the replaced value.
-
Field Details
-
noFocusBorder
the default border for unfocused cells. -
SAFE_NO_FOCUS_BORDER
?? the default border for unfocused cells. ?? -
component
PENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx. -
value
PENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx. -
row
protected transient int row -
column
protected transient int column -
selected
protected transient boolean selected -
focused
protected transient boolean focused -
expanded
protected transient boolean expanded -
leaf
protected transient boolean leaf -
dropOn
protected transient boolean dropOn
-
-
Constructor Details
-
CellContext
public CellContext()
-
-
Method Details
-
getNoFocusBorder
Returns the shared border for unfocused cells.PENDING: ?? copied from default renderers - why is it done like this?
- Returns:
- the border for unfocused cells.
-
installState
protected void installState(Object value, int row, int column, boolean selected, boolean focused, boolean expanded, boolean leaf) Sets the state of the cell's context. Convenience method for subclasses.- Parameters:
value- the content value of the cellrow- the cell's row index in view coordinatescolumn- the cell's column index in view coordinatesselected- the cell's selected statefocused- the cell's focused stateexpanded- the cell's expanded stateleaf- the cell's leaf state
-
replaceValue
-
getComponent
Returns the component the cell resides on, may be null. Subclasses are expected to override and return the component type they are handling.- Returns:
- the component the cell resides on, may be null.
-
getValue
Returns the value of the cell as set in the install.- Returns:
- the content value of the cell.
-
getRow
public int getRow()Returns the cell's row index in view coordinates as set in the install.- Returns:
- the cell's row index.
-
getColumn
public int getColumn()Returns the cell's column index in view coordinates as set in the install.- Returns:
- the cell's column index.
-
isSelected
public boolean isSelected()Returns the selected state as set in the install.- Returns:
- the cell's selected state.
-
isFocused
public boolean isFocused()Returns the focused state as set in the install.- Returns:
- the cell's focused state.
-
isExpanded
public boolean isExpanded()Returns the expanded state as set in the install.- Returns:
- the cell's expanded state.
-
isLeaf
public boolean isLeaf()Returns the leaf state as set in the install.- Returns:
- the cell's leaf state.
-
isEditable
public boolean isEditable()Returns the cell's editability. Subclasses should override to return a reasonable cell-related state.Here: false.
- Returns:
- the cell's editable property.
-
getIcon
Returns the icon. Subclasses should override to return a reasonable cell-related state.Here:
null.- Returns:
- the cell's icon.
-
isDropOn
protected boolean isDropOn()Returns a boolean indicating if the cell is a drop location with any of the dropOn modes. It's up to subclasses to implement.Here: false.
- Returns:
- true if the current cell is a drop location with any of the dropOn modes, false otherwise
-
getForeground
Returns the foreground color of the renderered component or null if the component is nullPENDING: fallback to UI properties if comp == null?
- Returns:
- the foreground color of the rendered component.
-
getBackground
Returns the background color of the renderered component or null if the component is nullPENDING: fallback to UI properties if comp == null?
- Returns:
- the background color of the rendered component.
-
getSelectionBackground
Returns the default selection background color of the renderered component. Typically, the color is LF specific. It's up to subclasses to look it up. Here: returns null.PENDING: return UI properties here?
- Returns:
- the selection background color of the rendered component.
-
getSelectionForeground
Returns the default selection foreground color of the renderered component. Typically, the color is LF specific. It's up to subclasses to look it up. Here: returns null.PENDING: return UI properties here?
- Returns:
- the selection foreground color of the rendered component.
-
getFocusBorder
Returns the default focus border of the renderered component. Typically, the border is LF specific.- Returns:
- the focus border of the rendered component.
-
getBorder
Returns the default border of the renderered component depending on cell state. Typically, the border is LF specific.Here: returns the focus border if the cell is focused, the context defined no focus border otherwise.
- Returns:
- the default border of the rendered component.
-
getFocusForeground
Returns the default focused foreground color of the renderered component. Typically, the color is LF specific.- Returns:
- the focused foreground color of the rendered component.
-
getFocusBackground
Returns the default focused background color of the renderered component. Typically, the color is LF specific.- Returns:
- the focused background color of the rendered component.
-
getDropCellForeground
-
getDropCellBackground
-
getUIKey
-
getUIPrefix
Returns the component type specific prefix of keys for lookup in the UIManager. Subclasses must override, here: returns the empty String.- Returns:
- the component type specific prefix.
-
getFont
Returns the Font of the target component or null if no component installed.- Returns:
-
getCellRendererName
-