|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.renderer.ComponentProvider<javax.swing.AbstractButton>
org.jdesktop.swingx.renderer.CheckBoxProvider
public class CheckBoxProvider
A component provider which uses a JCheckBox.
This implementation respects a BooleanValue and a StringValue to configure the button's selected and text property. By default, the selected is mapped to a Boolean-type value and the text is empty.
To allow mapping to different types, client code can supply a custom StringValue which also implements BooleanValue. F.i. to render a cell value of type TableColumnExt with the column's visibility mapped to the selected and the column's title to the text:
BooleanValue bv = new BooleanValue(){
public boolean getBoolean(Object value) {
if (value instanceof TableColumnExt)
return ((TableColumnExt) value).isVisible();
return false;
}
};
StringValue sv = new StringValue() {
public String getString(Object value) {
if (value instanceof TableColumnExt)
return ((TableColumnExt) value).getTitle();
return "";
}
};
list.setCellRenderer(new DefaultListRenderer(
new CheckBoxProvider(new MappedValue(sv, null, bv), JLabel.LEADING)));
BooleanValue,
StringValue,
MappedValue,
Serialized Form| Constructor Summary | |
|---|---|
CheckBoxProvider()
Instantiates a CheckBoxProvider with default properties. |
|
CheckBoxProvider(StringValue stringValue)
Instantiates a CheckBoxProvider with the given StringValue and default alignment. |
|
CheckBoxProvider(StringValue stringValue,
int alignment)
Instantiates a CheckBoxProvider with the given StringValue and alignment. |
|
| Method Summary | |
|---|---|
boolean |
isBorderPainted()
Returns the border painted flag. |
void |
setBorderPainted(boolean borderPainted)
Sets the border painted flag. |
| Methods inherited from class org.jdesktop.swingx.renderer.ComponentProvider |
|---|
getHorizontalAlignment, getRendererComponent, getString, getStringValue, setHorizontalAlignment, setStringValue |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CheckBoxProvider()
public CheckBoxProvider(StringValue stringValue)
stringValue - the StringValue to use for formatting.
public CheckBoxProvider(StringValue stringValue,
int alignment)
stringValue - the StringValue to use for formatting.alignment - the horizontalAlignment.| Method Detail |
|---|
public boolean isBorderPainted()
setBorderPainted(boolean)public void setBorderPainted(boolean borderPainted)
The default value is true.
borderPainted - the borderPainted property to configure
the underlying checkbox with.isBorderPainted()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||