|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.renderer.CellContext<T>
public class CellContext<T extends javax.swing.JComponent>
Encapsulates the display context passed into the getXXRendererComponent.
Introduced to extract common state on which renderer configuration might rely. Similar to the view part of ComponentAdapter - difference is that the properties are not "live" dependent on the component but those passed-in are used.
Additionally, provides lookup services to accessing state-dependent ui-specific default visual properties (like colors, borders, icons). Typically, they are taken from the UIManager or from the component, if supported in the component api.
NOTE: the generic parameterization is useful to have a type-safe installContext. Reason enough?
Field Summary | |
---|---|
protected int |
column
|
protected T |
component
|
protected boolean |
expanded
|
protected boolean |
focused
|
protected boolean |
leaf
|
protected static javax.swing.border.Border |
noFocusBorder
the default border for unfocused cells. |
protected int |
row
|
protected boolean |
selected
|
protected java.lang.Object |
value
|
Constructor Summary | |
---|---|
CellContext()
|
Method Summary | |
---|---|
protected java.awt.Color |
getBackground()
Returns the background color of the renderered component or null if the component is null |
protected javax.swing.border.Border |
getBorder()
Returns the default border of the renderered component depending on cell state. |
int |
getColumn()
Returns the cell's column index in view coordinates as set in the install. |
T |
getComponent()
Returns the component the cell resides on, may be null. |
protected java.awt.Color |
getFocusBackground()
Returns the default focused background color of the renderered component. |
protected javax.swing.border.Border |
getFocusBorder()
Returns the default focus border of the renderered component. |
protected java.awt.Color |
getFocusForeground()
Returns the default focused foreground color of the renderered component. |
protected java.awt.Color |
getForeground()
Returns the foreground color of the renderered component or null if the component is null |
javax.swing.Icon |
getIcon()
Returns the icon. |
int |
getRow()
Returns the cell's row index in view coordinates as set in the install. |
protected java.awt.Color |
getSelectionBackground()
Returns the default selection background color of the renderered component. |
protected java.awt.Color |
getSelectionForeground()
Returns the default selection foreground color of the renderered component. |
protected java.lang.String |
getUIKey(java.lang.String key)
Convenience method to build a component type specific lookup key for the UIManager. |
protected java.lang.String |
getUIPrefix()
Returns the component type specific prefix of keys for lookup in the UIManager. |
java.lang.Object |
getValue()
Returns the value of the cell as set in the install. |
void |
installContext(T component,
java.lang.Object value,
int row,
int column,
boolean selected,
boolean focused,
boolean expanded,
boolean leaf)
Sets state of the cell's context. |
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. |
java.lang.Object |
replaceValue(java.lang.Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static javax.swing.border.Border noFocusBorder
protected transient T extends javax.swing.JComponent component
protected transient java.lang.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
Constructor Detail |
---|
public CellContext()
Method Detail |
---|
public void installContext(T component, java.lang.Object value, int row, int column, boolean selected, boolean focused, boolean expanded, boolean leaf)
component
- the component the cell resides on, might be nullvalue
- 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 java.lang.Object replaceValue(java.lang.Object value)
public T getComponent()
public java.lang.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 javax.swing.Icon getIcon()
Here: null
.
protected java.awt.Color getForeground()
PENDING: fallback to UI properties if comp == null?
protected java.awt.Color getBackground()
PENDING: fallback to UI properties if comp == null?
protected java.awt.Color getSelectionBackground()
PENDING: return UI properties here?
protected java.awt.Color getSelectionForeground()
PENDING: return UI properties here?
protected javax.swing.border.Border getFocusBorder()
protected javax.swing.border.Border getBorder()
Here: returns the focus border if the cell is focused, the context defined no focus border otherwise.
protected java.awt.Color getFocusForeground()
protected java.awt.Color getFocusBackground()
protected java.lang.String getUIKey(java.lang.String key)
key
- the general part of the key
protected java.lang.String getUIPrefix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |