Serializable
ListCellContext
, TableCellContext
, TreeCellContext
public class CellContext extends Object implements Serializable
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
Modifier and Type | Field | Description |
---|---|---|
protected int |
column |
|
protected JComponent |
component |
PENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx.
|
protected boolean |
dropOn |
|
protected boolean |
expanded |
|
protected boolean |
focused |
|
protected boolean |
leaf |
|
protected static Border |
noFocusBorder |
the default border for unfocused cells.
|
protected int |
row |
|
protected boolean |
selected |
|
protected Object |
value |
PENDING JW: maybe make this a WeakReference? Would be a more robust fix for Issue #1040-swingx.
|
Constructor | Description |
---|---|
CellContext() |
Modifier and Type | Method | Description |
---|---|---|
protected Color |
getBackground() |
Returns the background color of the renderered component or null if the
component is null
|
protected Border |
getBorder() |
Returns the default border of the renderered component depending on cell
state.
|
String |
getCellRendererName() |
|
int |
getColumn() |
Returns the cell's column index in view coordinates as set in the
install.
|
JComponent |
getComponent() |
Returns the component the cell resides on, may be null.
|
protected Color |
getDropCellBackground() |
|
protected Color |
getDropCellForeground() |
|
protected Color |
getFocusBackground() |
Returns the default focused background color of the renderered component.
|
protected Border |
getFocusBorder() |
Returns the default focus border of the renderered component.
|
protected Color |
getFocusForeground() |
Returns the default focused foreground color of the renderered component.
|
protected Font |
getFont() |
Returns the Font of the target component or null if no component installed.
|
protected Color |
getForeground() |
Returns the foreground color of the renderered component or null if the
component is null
|
Icon |
getIcon() |
Returns the icon.
|
int |
getRow() |
Returns the cell's row index in view coordinates as set in the install.
|
protected Color |
getSelectionBackground() |
Returns the default selection background color of the renderered
component.
|
protected Color |
getSelectionForeground() |
Returns the default selection foreground color of the renderered
component.
|
protected String |
getUIKey(String key) |
Convenience method to build a component type specific lookup key for the
UIManager.
|
protected String |
getUIPrefix() |
Returns the component type specific prefix of keys for lookup in the
UIManager.
|
Object |
getValue() |
Returns the value of the cell as set in the install.
|
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.
|
protected boolean |
isDropOn() |
Returns a boolean indicating if the cell is a drop location with any of the dropOn
modes.
|
boolean |
isEditable() |
Returns the cell's editability.
|
boolean |
isExpanded() |
Returns the expanded state as set in the install.
|
boolean |
isFocused() |
Returns the focused state as set in the install.
|
boolean |
isLeaf() |
Returns the leaf state as set in the install.
|
boolean |
isSelected() |
Returns the selected state as set in the install.
|
Object |
replaceValue(Object value) |
Replaces the value of this cell context with the given parameter and returns
the replaced value.
|
protected static Border noFocusBorder
protected transient JComponent component
protected transient Object value
protected transient int row
protected transient int column
protected transient boolean selected
protected transient boolean focused
protected transient boolean expanded
protected transient boolean leaf
protected transient boolean dropOn
protected void installState(Object value, int row, int column, boolean selected, boolean focused, boolean expanded, boolean leaf)
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 statepublic Object replaceValue(Object value)
value
- the new value of the cell contextpublic JComponent getComponent()
public Object getValue()
public int getRow()
public int getColumn()
public boolean isSelected()
public boolean isFocused()
public boolean isExpanded()
public boolean isLeaf()
public boolean isEditable()
Here: false.
public Icon getIcon()
Here: null
.
protected boolean isDropOn()
Here: false.
protected Color getForeground()
PENDING: fallback to UI properties if comp == null?
protected Color getBackground()
PENDING: fallback to UI properties if comp == null?
protected Color getSelectionBackground()
PENDING: return UI properties here?
protected Color getSelectionForeground()
PENDING: return UI properties here?
protected Border getFocusBorder()
protected Border getBorder()
Here: returns the focus border if the cell is focused, the context defined no focus border otherwise.
protected Color getFocusForeground()
protected Color getFocusBackground()
protected Color getDropCellForeground()
protected Color getDropCellBackground()
protected String getUIKey(String key)
key
- the general part of the keyprotected String getUIPrefix()
protected Font getFont()
public String getCellRendererName()
Copyright © 2018. All rights reserved.