stella.jview
Class JElementDisplay

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by jview.AbstractDisplayable
                  extended by stella.jview.JElementDisplay
All Implemented Interfaces:
ActionListener, Cloneable, EventListener, Displayable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
JElementEdit

public class JElementDisplay
extends AbstractDisplayable
implements ActionListener

An element editor provides a GUI that allows easy editing of ElementHelper instances. Basically it displays the variables known to the element helper as a two-columned table. The first column holds the name of the variable, while the second one holds the value. Various displaying rules apply. Variables that are required (UserAdjustable.getRequired()) are displayed in KEY_MISSINGCOLOR color if they are not defined and in KEY_DEFINEDCOLOR if they have already a value assigned. Non-required variables are displayed in KEY_NOTREQUIREDCOLOR. Variables that are not settable (UserAdjustable.getSettable()) are displayed in grayed-out labels, while settable parameters display their values in editable fields.


Nested Class Summary
static class JElementDisplay.Show
          A class to test the layout.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static Color DEFDEFINEDCOLOR
          The default missing color.
private static Color DEFIDCOLOR
          The default missing color.
private static Insets DEFINSETS
          The default insets.
private static int DEFMAXLENGTH
          The default maximum label length.
private static Color DEFMISSINGCOLOR
          The default missing color.
private static Color DEFNOTREQUIREDCOLOR
          The default missing color.
private static String DEFNULL
          The default string to display for null entries.
private  JPanel deliver
          The component delivered for reference in the action listener.
private  UserAdjustable edit
          The user-adjustable this editor applies to.
static String KEY_DEFINEDCOLOR
          The key to the color of missing required variables.
static String KEY_IDCOLOR
          The key to the color of missing required variables.
static String KEY_MAXLENGTH
          The maximum label length.
static String KEY_MISSINGCOLOR
          The key to the color of missing required variables.
static String KEY_NOTREQUIREDCOLOR
          The key to the color of missing required variables.
static String KEY_NULL
          The string to display on non-defined fields.
private  Map<JComponent,JLabel> labels
          Mapping of labels to text fields as displayed.
private  JStatusField status
          The status field messages should be piped to.
 
Fields inherited from class jview.AbstractDisplayable
KEY_COMPONENTNAME, KEY_ICON, KEY_INSETS
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
JElementDisplay(Map prop)
          Constructs a new element editor.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Catches action events on the list-buttons and the value-fields.
private  void fillValues(Map<String,Object> vals, Map<JComponent,JLabel> display)
          Fills the values into the labels and text-fields (buttons)
 Component getRepresentation()
          Delivers a panel consiting of a two-column table linking variables to their values.
 void registerStatusField(JStatusField writeout)
          Assigns the status field for information messages.
 void registerUserAdjustable(UserAdjustable user)
          Assigns the UserAdjustable to the editor.
 void updateFields()
          Grabs all text entered in text fields and reports them to the underlying JUserAdjustable.
 
Methods inherited from class jview.AbstractDisplayable
getComponentName, getIcon, getIcon
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_IDCOLOR

public static final String KEY_IDCOLOR
The key to the color of missing required variables.

See Also:
Constant Field Values

KEY_MISSINGCOLOR

public static final String KEY_MISSINGCOLOR
The key to the color of missing required variables.

See Also:
Constant Field Values

KEY_DEFINEDCOLOR

public static final String KEY_DEFINEDCOLOR
The key to the color of missing required variables.

See Also:
Constant Field Values

KEY_NOTREQUIREDCOLOR

public static final String KEY_NOTREQUIREDCOLOR
The key to the color of missing required variables.

See Also:
Constant Field Values

KEY_NULL

public static final String KEY_NULL
The string to display on non-defined fields.

See Also:
Constant Field Values

KEY_MAXLENGTH

public static final String KEY_MAXLENGTH
The maximum label length.

See Also:
Constant Field Values

DEFIDCOLOR

private static final Color DEFIDCOLOR
The default missing color.


DEFMISSINGCOLOR

private static final Color DEFMISSINGCOLOR
The default missing color.


DEFDEFINEDCOLOR

private static final Color DEFDEFINEDCOLOR
The default missing color.


DEFNOTREQUIREDCOLOR

private static final Color DEFNOTREQUIREDCOLOR
The default missing color.


DEFINSETS

private static final Insets DEFINSETS
The default insets.


DEFMAXLENGTH

private static final int DEFMAXLENGTH
The default maximum label length.

See Also:
Constant Field Values

DEFNULL

private static final String DEFNULL
The default string to display for null entries.

See Also:
Constant Field Values

edit

private UserAdjustable edit
The user-adjustable this editor applies to.


labels

private Map<JComponent,JLabel> labels
Mapping of labels to text fields as displayed.


deliver

private JPanel deliver
The component delivered for reference in the action listener.


status

private JStatusField status
The status field messages should be piped to.

Constructor Detail

JElementDisplay

public JElementDisplay(Map prop)
Constructs a new element editor. Prior to using it, also prior to displaying it the UserAdjustable must be assigned to it.

Method Detail

registerUserAdjustable

public void registerUserAdjustable(UserAdjustable user)
Assigns the UserAdjustable to the editor. Additionally initializes the labels look-up table.


registerStatusField

public void registerStatusField(JStatusField writeout)
Assigns the status field for information messages.


getRepresentation

public Component getRepresentation()
Delivers a panel consiting of a two-column table linking variables to their values. Depending on required, set and unset parameters, the coloring differs.

Specified by:
getRepresentation in interface Displayable

actionPerformed

public void actionPerformed(ActionEvent ae)
Catches action events on the list-buttons and the value-fields.

Specified by:
actionPerformed in interface ActionListener

updateFields

public void updateFields()
Grabs all text entered in text fields and reports them to the underlying JUserAdjustable.


fillValues

private void fillValues(Map<String,Object> vals,
                        Map<JComponent,JLabel> display)
Fills the values into the labels and text-fields (buttons)