stella.jview
Class JTargetHelper

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

public class JTargetHelper
extends TargetHelper
implements Displayable, TargetHelperLabels

Identical to the parental class, except that messages are not piped to standard/error out, but rather processed in a JStatusField. To allow for this action, the status field must be registered to the target maker with setStatusField(jview.JStatusField).


Nested Class Summary
static class JTargetHelper.Display
          Layout test.
 class JTargetHelper.DurationAction
          The action that allows input of a target duration.
 class JTargetHelper.FileAction
          The action that allows input of a file name.
 class JTargetHelper.TargetNameAction
          The action that allows adjustment of the target name.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static int DEFBOTTOMBORDER
          The default top border thickness.
private static Color DEFGREENCOLOR
          The default status color.
private static String DEFLABELBUNDLE
          The name for the label resource bundle.
private static int DEFLEFTBORDER
          The default top border thickness.
private static Color DEFREDCOLOR
          The default error color.
private static String DEFRESOURCEBUNDLES
          The resource bundles for localized labels and text.
private static int DEFRIGHTBORDER
          The default top border thickness.
private static int DEFTOPBORDER
          The default top border thickness.
private static String DEFURLRESOURCES
          The resources to add to the classpath.
private  JDialog directtarget
          The representation of this helper.
private  Action durationaction
          The action linked to the target duration.
private  Action fileaction
          The action linked to the target file.
static String KEY_BOTTOMBORDER
          The key to the size of the top border.
static String KEY_GREENCOLOR
          The key denoting the color of requirements already present.
static String KEY_LABELBUNDLE
          The resource bundle name for localized labels.
static String KEY_LEFTBORDER
          The key to the size of the top border.
static String KEY_REDCOLOR
          The key denoting the color of missing requirements.
static String KEY_RIGHTBORDER
          The key to the size of the top border.
static String KEY_TOPBORDER
          The key to the size of the top border.
private  Action nameaction
          The action linked to the target name.
private  Object parent
          Parent of this helper.
private  JStatusField status
          The status field to pipe messages to.
 
Fields inherited from class stella.xml.TargetHelper
KEY_DURATION, KEY_FILE, KEY_TARGETNAME, KEY_TELESCOPE
 
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.TargetHelperLabels
KEY_DURATIONITEM, KEY_DURATIONITEMACC, KEY_DURATIONITEMTIP, KEY_DURATIONTEXT, KEY_FILENAMEITEM, KEY_FILENAMEITEMACC, KEY_FILENAMEITEMTIP, KEY_FILENAMETEXT, KEY_NOTARGETNAME, KEY_NOTELESCOPE, KEY_NOTYPE, KEY_NOUSER, KEY_TARGETHELPTITLE, KEY_TARGETNAMEHEADER, KEY_TARGETNAMEITEM, KEY_TARGETNAMEITEMACC, KEY_TARGETNAMEITEMTIP, KEY_TARGETNAMETEXT, KEY_TELESCOPEHEADER, KEY_TYPEHEADER, KEY_UNPARSABLETEXT, KEY_UNPARSABLETITLE, KEY_USERHEADER
 
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
JTargetHelper(Map prop)
          Creates a new target helper with the specified properties.
 
Method Summary
protected  void error(String warn)
          Issues an error message.
private  JLabel getDefinedLabel(String label)
           
 Action getDurationAction()
          Returns the successor action.
 Action getFileAction()
          Returns the successor action.
 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.
 Action getNameAction()
          Returns the successor action.
 Object getParent()
          Returns the parent.
 Component getRepresentation()
          Creates a non-modal dialog that displays target properties that are requiered along with their current values, if set.
 JStatusField getStatusField()
          Returns the status field.
private  JLabel getUndefinedLabel(String label)
           
protected  void info(String warn)
          Issues an info message.
 void init()
          Initializes the element display with my properties.
 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.
protected  void updateDialog()
          Updates the directdialog.
protected  void warn(String warn)
          Issues a warning message.
 
Methods inherited from class stella.xml.TargetHelper
addDurationFragment, addFileFragment, addTargetNameFragment, createElementHelper, createObjectHelper, createTelescopeHelper, createTypeHelper, getDuration, getFile, getKnownTelescopes, getTargetName, getTelescopeHelper, makeTarget, selectTelescope, setDuration, setFile, setTargetName
 
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_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 requirements already present.

See Also:
Constant Field Values

KEY_TOPBORDER

public static final String KEY_TOPBORDER
The key to the size of the top border.

See Also:
Constant Field Values

KEY_LEFTBORDER

public static final String KEY_LEFTBORDER
The key to the size of the top border.

See Also:
Constant Field Values

KEY_BOTTOMBORDER

public static final String KEY_BOTTOMBORDER
The key to the size of the top border.

See Also:
Constant Field Values

KEY_RIGHTBORDER

public static final String KEY_RIGHTBORDER
The key to the size of the top border.

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

DEFREDCOLOR

private static final Color DEFREDCOLOR
The default error color.


DEFGREENCOLOR

private static final Color DEFGREENCOLOR
The default status color.


DEFTOPBORDER

private static final int DEFTOPBORDER
The default top border thickness.

See Also:
Constant Field Values

DEFLEFTBORDER

private static final int DEFLEFTBORDER
The default top border thickness.

See Also:
Constant Field Values

DEFBOTTOMBORDER

private static final int DEFBOTTOMBORDER
The default top border thickness.

See Also:
Constant Field Values

DEFRIGHTBORDER

private static final int DEFRIGHTBORDER
The default top border thickness.

See Also:
Constant Field Values

parent

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


status

private JStatusField status
The status field to pipe messages to.


directtarget

private JDialog directtarget
The representation of this helper.


nameaction

private Action nameaction
The action linked to the target name.


fileaction

private Action fileaction
The action linked to the target file.


durationaction

private Action durationaction
The action linked to the target duration.

Constructor Detail

JTargetHelper

public JTargetHelper(Map prop)
Creates a new target helper with the specified properties.

Method Detail

init

public void init()
Initializes the element display with my properties. Also constructs the fixed actions, i.e. actions present only once and not depending on target type. The others are constructed/removed later, when the target type is choosen.

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

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 instances of JTargetHelper.TargetNameAction additionally invokes the action performed method of this listener, without registering explicetly to the parent.


getParent

public Object getParent()
Returns the parent.


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.


getStatusField

public JStatusField getStatusField()
Returns the status field. Useful for a jtelescope-helper.


setExpertMode

public void setExpertMode(boolean expert)
Sets the expert mode. If true, all actions are enabled, otherwise the duration and file-name action are disabled. Only callable after init.


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()
Creates a non-modal dialog that displays target properties that are requiered along with their current values, if set. Required values that have no current value asociated to it show up in KEY_REDCOLOR, while others are displayed in KEY_GREENCOLOR.

Specified by:
getRepresentation in interface Displayable

getNameAction

public Action getNameAction()
Returns the successor action.


getFileAction

public Action getFileAction()
Returns the successor action.


getDurationAction

public Action getDurationAction()
Returns the successor action.


error

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

Overrides:
error in class TargetHelper

warn

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

Overrides:
warn in class TargetHelper

info

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

Overrides:
info in class TargetHelper

updateDialog

protected void updateDialog()
Updates the directdialog. According to the information currently stored in the target helper, we construct buttons & labels. If we have actions, we add them to the buttons constructed. Note that the dialog may not be null.


getLocalLabel

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


getDefinedLabel

private JLabel getDefinedLabel(String label)

getUndefinedLabel

private JLabel getUndefinedLabel(String label)