stella.jview
Class JTypeHelper

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.xml.TypeHelper
                  extended by stella.jview.JTypeHelper
All Implemented Interfaces:
Cloneable, Displayable, TypeHelperLabels, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class JTypeHelper
extends TypeHelper
implements Displayable, TypeHelperLabels

The extension to the normal type helper. This type helper allows construction of actions according to the Select, Exception, Fits, Setup and Object entries. Additionally, message output is directed to a status field, if present.


Nested Class Summary
 class JTypeHelper.ConstraintAction
          The action that allows adjustment of a constraint.
 class JTypeHelper.DaughterAction
          The action that allows input of a daughters list.
static class JTypeHelper.Display
          Layout test.
 class JTypeHelper.ExceptionAction
          The action that allows adjustment of an exception.
 class JTypeHelper.FitsHeaderAction
          The action that allows adjustment of additional fits parameters.
 class JTypeHelper.GainAction
          The action that allows adjustment of a target gain.
private  class JTypeHelper.ItemIcon
          An icon that draw a separator.
 class JTypeHelper.ObjectAction
          The action that allows adjustment of an object.
 class JTypeHelper.ProposalAction
          The action asociated to an abstract input.
 class JTypeHelper.RequiresAction
          The action that allows input of a requirement.
 class JTypeHelper.SetupAction
          The action that allows adjustment of a setup.
 class JTypeHelper.SuccessorAction
          The action that allows input of a successor.
 class JTypeHelper.TimeslotAction
          The action that allows adjustment of a timeslot.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Action abstractaction
          The action linked to the target abstract.
private  List constraintactions
          A list of actions assigned to constraints.
private  Action daughteraction
          The action linked to the target daughters.
private static int DEFABSTRACTROW
          The number of lines in an abstract input dialog.
private static Color DEFGREENCOLOR
          The default status color.
private static String DEFLABELBUNDLE
          The name for the label resource bundle.
private static int DEFLONGLABEL
          The number of chars in a short label.
private static Color DEFREDCOLOR
          The default error color.
private static String DEFRESOURCEBUNDLES
          The resource bundles for localized labels and text.
private static int DEFSHORTBUTTON
          The number of chars in a short label.
private static int DEFSHORTLABEL
          The number of chars in a short label.
private static String DEFURLRESOURCES
          The resources to add to the classpath.
private  JPanel directtype
          The representation of the type helper.
private  JElementDisplay element
          We use a single element display for all element helpers.
private  List exceptionactions
          A list of actions assigned to exceptions.
private  List fitsheaderactions
          A list of actions assigned to fits header.
private  List gainactions
          A list of actions assigned to gains.
static String KEY_ABSTRACTROW
          The number of lines in an abstract input dialogs.
static String KEY_GREENCOLOR
          The key denoting the color of done messages.
static String KEY_LABELBUNDLE
          The resource bundle name for localized labels.
static String KEY_LONGLABEL
          The number of chars in a short label.
static String KEY_REDCOLOR
          The key denoting the color of missing requirements.
static String KEY_SHORTBUTTON
          The number of chars in a short label.
static String KEY_SHORTLABEL
          The number of chars in a short label.
private  List objectactions
          A list of actions assigned to objects.
private  Object parent
          The parent of this helper.
private  Action requiresaction
          The action linked to the target requirement.
private  List setupactions
          A list of actions assigned to setups.
private  JStatusField status
          The status field to pipe messages to.
private  Action successoraction
          The action linked to the target successor.
private  List timeslotactions
          A list of actions assigned to timeslots.
 
Fields inherited from class stella.xml.TypeHelper
KEY_ABSTRACT, KEY_ACCESS, KEY_CONSTRAINTS, KEY_DAUGHTERS, KEY_EXCEPTIONS, KEY_FITSHEADERS, KEY_GAINS, KEY_HELPERCLASS, KEY_OBJECTS, KEY_PROPOSAL, KEY_RATEHOW, KEY_RATEWHEN, KEY_REQUIRES, KEY_SEQUENCE, KEY_SETUPS, KEY_SUCCESSOR, KEY_TIMESLOTS, KEY_TYPE
 
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 stella.jview.TypeHelperLabels
KEY_ABSTRACTITEM, KEY_ABSTRACTITEMACC, KEY_ABSTRACTITEMTIP, KEY_ABSTRACTTEXT, KEY_ABSTRACTTITLE, KEY_CONSTRAINTSDESCRIBE, KEY_CONSTRAINTSLABEL, KEY_CONSTRAINTTITLE, KEY_DAUGHTERITEM, KEY_DAUGHTERITEMACC, KEY_DAUGHTERITEMTIP, KEY_DAUGHTERTEXT, KEY_EXCEPTIONSDESCRIBE, KEY_EXCEPTIONSLABEL, KEY_EXCEPTIONTITLE, KEY_FITSHEADERDESCRIBE, KEY_FITSHEADERLABEL, KEY_FITSTITLE, KEY_GAINSDESCRIBE, KEY_GAINSLABEL, KEY_GAINTITLE, KEY_NULL, KEY_OBJECTDESCRIBE, KEY_OBJECTLABEL, KEY_OBJECTTITLE, KEY_REQUIRESITEM, KEY_REQUIRESITEMACC, KEY_REQUIRESITEMTIP, KEY_REQUIRESTEXT, KEY_REQUIRESTITLE, KEY_SELECTDESCRIBE, KEY_SELECTLABEL, KEY_SETUPDESCRIBE, KEY_SETUPLABEL, KEY_SETUPTITLE, KEY_SUCCESSORITEM, KEY_SUCCESSORITEMACC, KEY_SUCCESSORITEMTIP, KEY_SUCCESSORTEXT, KEY_TIMESLOTSDESCRIBE, KEY_TIMESLOTSLABEL, KEY_TIMESLOTTITLE
 
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
JTypeHelper(Map prop)
          Constructs a new graphical representation of a type helper.
 
Method Summary
private  int addElementHelper(Collection all, List actions, int x, int y)
           
private  void addHeader(String shortdesc, String longdesc, int x, int y)
           
protected  void error(String warn)
          Issues an error message.
 Action getAbstractAction()
          Returns the abstract action.
private  JLabel getClipLabel(String label, int len)
           
 List getConstraintActions()
          Returns the list of constraints actions.
 Action getDaughterAction()
          Returns the successor action.
private  JLabel getDefinedLabel(String label)
           
private  JLabel getDefinedLabel(String label, int len)
           
 List getExceptionActions()
          Returns the list of constraints actions.
 List getFitsHeaderActions()
          Returns the list of constraints actions.
 List getGainActions()
          Returns the list of constraints actions.
 Icon getIcon()
          Might return an icon, if one was stated in the properties
private  String getLocalLabel(String key)
          Returns the localized label by scanning the specified key in the KEY_LABELBUNDLE resource bundle.
 List getObjectActions()
          Returns the list of constraints actions.
 Component getRepresentation()
          We return a jpanel here that has a grid bag layout.
 Action getRequiresAction()
          Returns the successor action.
 List getSetupActions()
          Returns the list of constraints actions.
private  JLabel getShortLabel(String label)
           
 Action getSuccessorAction()
          Returns the successor action.
 List getTimeslotActions()
          Returns the list of constraints actions.
private  JLabel getUndefinedLabel(String label)
           
private  JLabel getUndefinedLabel(String label, int len)
           
protected  void info(String warn)
          Issues an info message.
 void init()
          Additionally initialize the actions.
 void setExpertMode(boolean expert)
          Sets the expert mode.
 void setParent(Object father)
          Sets the parent component.
 void setStatusField(JStatusField pipe)
          Assigns the status field to the target helper.
private  String shortAction(String longaction)
          Checks if an action string has periods.
private  boolean updateElementHelper(Component top, ElementHelper edit, String title)
          Takes the specified element helper, pipes it into the element field and displays it.
private  void updatePanel()
           
protected  void warn(String warn)
          Issues a warning message.
 
Methods inherited from class stella.xml.TypeHelper
addAbstractFragment, addConstraint, addDaughterFragment, addExceptionFragment, addFitsHeaderFragment, addObjectFragment, addRateFragment, addRating, addSelectFragment, addSetupFragment, addSuccessorFragment, getAbstract, getAccess, getAllConstraints, getAllExceptions, getAllFitsHeaders, getAllGains, getAllObjects, getAllRatings, getAllSetups, getAllTimeslots, getConstraintByID, getDaughters, getExceptionByID, getFitsHeaderByID, getGainByID, getObjectByID, getProposal, getRateWhen, getRatingByID, getRequirement, getSequence, getSetupByID, getSuccessor, getTimeslotByID, getType, setAbstract, setAccess, setDaughters, setProposal, setRateWhen, setRequirement, setSequence, setSuccessor
 
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, 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
 

Field Detail

KEY_LABELBUNDLE

public static final String KEY_LABELBUNDLE
The resource bundle name for localized labels.

See Also:
Constant Field Values

KEY_ABSTRACTROW

public static final String KEY_ABSTRACTROW
The number of lines in an abstract input dialogs.

See Also:
Constant Field Values

KEY_LONGLABEL

public static final String KEY_LONGLABEL
The number of chars in a short label.

See Also:
Constant Field Values

KEY_SHORTLABEL

public static final String KEY_SHORTLABEL
The number of chars in a short label.

See Also:
Constant Field Values

KEY_SHORTBUTTON

public static final String KEY_SHORTBUTTON
The number of chars in a short label.

See Also:
Constant Field Values

KEY_REDCOLOR

public static final String KEY_REDCOLOR
The key denoting the color of missing requirements.

See Also:
Constant Field Values

KEY_GREENCOLOR

public static final String KEY_GREENCOLOR
The key denoting the color of done messages.

See Also:
Constant Field Values

DEFURLRESOURCES

private static final String DEFURLRESOURCES
The resources to add to the classpath.

See Also:
Constant Field Values

DEFRESOURCEBUNDLES

private static final String DEFRESOURCEBUNDLES
The resource bundles for localized labels and text.

See Also:
Constant Field Values

DEFLABELBUNDLE

private static final String DEFLABELBUNDLE
The name for the label resource bundle.

See Also:
Constant Field Values

DEFABSTRACTROW

private static final int DEFABSTRACTROW
The number of lines in an abstract input dialog.

See Also:
Constant Field Values

DEFLONGLABEL

private static final int DEFLONGLABEL
The number of chars in a short label.

See Also:
Constant Field Values

DEFSHORTLABEL

private static final int DEFSHORTLABEL
The number of chars in a short label.

See Also:
Constant Field Values

DEFSHORTBUTTON

private static final int DEFSHORTBUTTON
The number of chars in a short label.

See Also:
Constant Field Values

DEFREDCOLOR

private static final Color DEFREDCOLOR
The default error color.


DEFGREENCOLOR

private static final Color DEFGREENCOLOR
The default status color.


parent

private Object parent
The parent of this helper. Used with a JTargetHelper instance.


status

private JStatusField status
The status field to pipe messages to.


element

private JElementDisplay element
We use a single element display for all element helpers.


directtype

private JPanel directtype
The representation of the type helper.


abstractaction

private Action abstractaction
The action linked to the target abstract.


successoraction

private Action successoraction
The action linked to the target successor.


requiresaction

private Action requiresaction
The action linked to the target requirement.


daughteraction

private Action daughteraction
The action linked to the target daughters.


constraintactions

private List constraintactions
A list of actions assigned to constraints.


timeslotactions

private List timeslotactions
A list of actions assigned to timeslots.


gainactions

private List gainactions
A list of actions assigned to gains.


setupactions

private List setupactions
A list of actions assigned to setups.


exceptionactions

private List exceptionactions
A list of actions assigned to exceptions.


fitsheaderactions

private List fitsheaderactions
A list of actions assigned to fits header.


objectactions

private List objectactions
A list of actions assigned to objects.

Constructor Detail

JTypeHelper

public JTypeHelper(Map prop)
Constructs a new graphical representation of a type helper.

Method Detail

init

public void init()
Additionally initialize the actions.

Specified by:
init in interface Initializable
Overrides:
init in class TypeHelper

setStatusField

public void setStatusField(JStatusField pipe)
Assigns the status field to the target helper. Only after this method has been called, messages find their way to a status field.


setParent

public void setParent(Object father)
Sets the parent component. This is used in different ways. First, the representation of this target helper is a non-modal dialog, that can use this parent as the dialog parent. Additionally, if the parent is an action listener, an instance of JTypeHelper.ObjectAction additionally invoke the action performed method of this listener, without registering explicetly to the parent.


setExpertMode

public void setExpertMode(boolean expert)
Sets the expert mode. If true, all actions are enabled, otherwise the successor and daughter actions, the requires action as well as all exception and fits actions are disabled. Callable only after init.


getAbstractAction

public Action getAbstractAction()
Returns the abstract action.


getSuccessorAction

public Action getSuccessorAction()
Returns the successor action.


getDaughterAction

public Action getDaughterAction()
Returns the successor action.


getRequiresAction

public Action getRequiresAction()
Returns the successor action.


getConstraintActions

public List getConstraintActions()
Returns the list of constraints actions.


getTimeslotActions

public List getTimeslotActions()
Returns the list of constraints actions.


getGainActions

public List getGainActions()
Returns the list of constraints actions.


getSetupActions

public List getSetupActions()
Returns the list of constraints actions.


getExceptionActions

public List getExceptionActions()
Returns the list of constraints actions.


getFitsHeaderActions

public List getFitsHeaderActions()
Returns the list of constraints actions.


getObjectActions

public List getObjectActions()
Returns the list of constraints actions.


getIcon

public Icon getIcon()
Might return an icon, if one was stated in the properties

Specified by:
getIcon in interface Displayable

getRepresentation

public Component getRepresentation()
We return a jpanel here that has a grid bag layout.

Specified by:
getRepresentation in interface Displayable

error

protected void error(String warn)
Issues an error message. This class pipes directly to Syslog.error.

Overrides:
error in class TypeHelper

warn

protected void warn(String warn)
Issues a warning message. This class pipes directly to Syslog.warning.

Overrides:
warn in class TypeHelper

info

protected void info(String warn)
Issues an info message. This class pipes directly to Syslog.info.

Overrides:
info in class TypeHelper

getLocalLabel

private String getLocalLabel(String key)
Returns the localized label by scanning the specified key in the KEY_LABELBUNDLE resource bundle.


updatePanel

private void updatePanel()

addHeader

private void addHeader(String shortdesc,
                       String longdesc,
                       int x,
                       int y)

addElementHelper

private int addElementHelper(Collection all,
                             List actions,
                             int x,
                             int y)

getDefinedLabel

private JLabel getDefinedLabel(String label)

getDefinedLabel

private JLabel getDefinedLabel(String label,
                               int len)

getUndefinedLabel

private JLabel getUndefinedLabel(String label)

getUndefinedLabel

private JLabel getUndefinedLabel(String label,
                                 int len)

getShortLabel

private JLabel getShortLabel(String label)

getClipLabel

private JLabel getClipLabel(String label,
                            int len)

updateElementHelper

private boolean updateElementHelper(Component top,
                                    ElementHelper edit,
                                    String title)
Takes the specified element helper, pipes it into the element field and displays it. If the user presses okay and the update flag is set, the element helper is updated.


shortAction

private String shortAction(String longaction)
Checks if an action string has periods. If so, only the last portion is returned.