|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.antelmann.util.gui.JPropertyEntryComponent
public class JPropertyEntryComponent
implements a general component for editing PropertyEntry objects.
Since validateForm(Component) is already implemented, it should be very easy
to create an inheriting class implementing FormValidator by simply providing
FormValidator.commitFormAction(Component).
JMethodTableModelComponent,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected PropertyEntry |
entry
|
protected Hashtable<String,JComponent> |
keyFields
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
boolean initComponent,
FormHelper formHelper,
String... propertyKeys)
|
|
JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
boolean initComponent,
String... propertyKeys)
|
|
JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
String... propertyKeys)
|
|
JPropertyEntryComponent(PropertyEntry entry,
String... propertyKeys)
|
|
JPropertyEntryComponent(RowItem ri)
|
|
| Method Summary | |
|---|---|
void |
applyFormToEntry()
sets all properties from this form based on the values provided by getValue(JComponent) |
protected void |
applyValueToForm(Object value,
JComponent keyField)
applies the given value to the given component. |
protected JComponent |
createComponentFor(Class<?> c)
This implementation supports String (via JTextField), Number (via JFormattedTextField), Boolean (via JCheckBox), Color (via JColorChooser) and Date (via JTimeChooser); others are simply handled via JTextField (including a null parameter). |
protected JComponent |
createComponentFor(String key)
returns the editor component for the given property key; if the key is not to be edited, null is to be returned. |
protected JComponent |
createLabelFor(String key)
allows to customize the way the labels for each key are created |
protected Class<?> |
getClassFor(String key)
this implementation returns the property value of the given key from the embedded entry; null is returned if the value from this entry instance is null. |
PropertyEntry |
getRelevantValue()
returns the relevant value for this instance at the time of calling |
protected Object |
getValue(JComponent keyField)
allows to specialize the way how the value for the given key is retrieved from the given component. |
protected void |
initComponent(int padding,
int maxRows,
String[] propertyKeys)
called by the constructor already only if initComponent parameter was set to true |
protected void |
initListener(JComponent keyField)
this method is called by createComponentFor(String) to fire a property change event
upon field alterations with the key Form.EDIT_PROPERTY_KEY on this instance. |
boolean |
isEditable()
|
void |
setEditable(boolean flag)
|
void |
setEnabled(boolean flag)
|
void |
setEntry(PropertyEntry entry)
|
void |
validateForm(Component formComponent)
this convenience method makes it simpler to implement a FormValidator based on this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected PropertyEntry entry
protected final Hashtable<String,JComponent> keyFields
| Constructor Detail |
|---|
public JPropertyEntryComponent(RowItem ri)
public JPropertyEntryComponent(PropertyEntry entry,
String... propertyKeys)
throws IllegalArgumentException
IllegalArgumentException
public JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
String... propertyKeys)
throws IllegalArgumentException
IllegalArgumentException
public JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
boolean initComponent,
String... propertyKeys)
throws IllegalArgumentException
IllegalArgumentException
public JPropertyEntryComponent(PropertyEntry entry,
int padding,
int maxRows,
boolean initComponent,
FormHelper formHelper,
String... propertyKeys)
throws IllegalArgumentException
IllegalArgumentException| Method Detail |
|---|
protected void initComponent(int padding,
int maxRows,
String[] propertyKeys)
public PropertyEntry getRelevantValue()
throws IOException
ValueRetriever
getRelevantValue in interface ValueRetriever<PropertyEntry>IOException - if any resource to fulfill the request is not accessibleprotected JComponent createComponentFor(String key)
getClassFor(String);
also, this implementation calls initListener(JComponent) on the returned component.
If certain keys are to be handled more specifically (like using a JSpinner, JComboBox, etc.),
this method should be overwritten accordingly.
initListener(JComponent)protected void initListener(JComponent keyField)
createComponentFor(String) to fire a property change event
upon field alterations with the key Form.EDIT_PROPERTY_KEY on this instance.
This implementation supports the same components as getValue(JComponent).
public void setEnabled(boolean flag)
setEnabled in class JComponentpublic boolean isEditable()
isEditable in interface EditableComponentpublic void setEditable(boolean flag)
setEditable in interface EditableComponent
protected void applyValueToForm(Object value,
JComponent keyField)
throws IllegalArgumentException,
ClassCastException
getValue(JComponent)
IllegalArgumentException
ClassCastException
protected Object getValue(JComponent keyField)
throws IllegalArgumentException
IllegalArgumentException - if the given keyField is not supportedJCheckBox,
JComboBox,
JSpinner,
JFormattedTextField,
JTextComponent,
JSlider,
JColorChooser
public void applyFormToEntry()
throws IllegalArgumentException
getValue(JComponent)
IllegalArgumentExceptionprotected Class<?> getClassFor(String key)
@Warning(value="called by the constructor if initComponent was set to true") protected JComponent createComponentFor(Class<?> c)
createComponentFor(String).
@Warning(value="called by the constructor if initComponent was set to true") protected JComponent createLabelFor(String key)
public void setEntry(PropertyEntry entry)
public void validateForm(Component formComponent)
throws FormValidationWarning,
IllegalArgumentException
FormValidator based on this class.
This implementation applies all field values to the embedded entry and throws an appropriate
FormValidationWarning if that fails.
FormValidationWarning
IllegalArgumentException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||