|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gridsystems.config.tools.console.AbstractConsoleView
public abstract class AbstractConsoleView
Base implementation for console views.
Field Summary | |
---|---|
protected java.util.ResourceBundle |
bundle
Resource bundle to use for message I18N. |
protected int |
width
Width of the console view. |
Constructor Summary | |
---|---|
AbstractConsoleView(Configurator config)
Creates a new instance with default with and the specified Configuration instance. |
|
AbstractConsoleView(Configurator config,
int width)
Creates a new instance. |
Method Summary | |
---|---|
void |
addKeyMapping(ConsoleViewAction action)
Registers action with its own key mapping. |
void |
addKeyMapping(GroupField group)
Registers the keymappings of all actions in the specified group field. |
void |
addKeyMapping(java.lang.String key,
ConsoleViewAction action)
Registers a string with a ConsoleViewAction instance. |
protected java.lang.Object[] |
buildForm()
Creates the contents of the "view box". |
void |
clearErrors()
The listener should remove all stored data about errors. |
protected BoolField |
createBoolField(java.lang.String linePattern)
Creates a BoolField that will share the same bundle as this instance. |
protected ConstantField |
createConstantField(java.lang.String linePattern,
java.lang.String value)
Creates a password field that will share the same bundle as this instance. |
protected PasswordField |
createPasswordField(java.lang.String linePattern)
Creates a password field that will share the same bundle as this instance. |
protected SelectionField |
createSelectionField(java.lang.String linePattern,
java.lang.String valuePattern,
java.lang.String[] values)
Creates a SelectionField that will share the same bundle as this instance. |
protected ValueField |
createValueField(java.lang.String linePattern,
java.lang.String valuePattern)
Creates a ValueField that will share the same bundle as this instance. |
void |
execute()
Performs the view execution. |
Configurator |
getConfigurator()
Gets the configurator this view is associated to. |
protected abstract void |
getContents(java.util.List<java.lang.Object> list)
Gets an array with the items conforming the contents of the "view box". |
java.lang.String |
getString(java.lang.String key)
Gets a localized string, using the found string as a pattern to be used by a MessageFormat instance. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object[] params)
Gets a localized string, using the found string as a pattern to be used by a MessageFormat instance. |
boolean |
hasErrors()
Gets if the view contains any error. |
protected void |
paintForm(java.lang.Object[] form)
Displays the "view box". |
void |
removeKeyMapping(ConsoleViewAction action)
Removes the key mapping for the specified action. |
void |
removeKeyMapping(GroupField group)
Removes all key mappings in the specified group field. |
void |
setApplyDiscardMappings(Configurator config)
Registers the default apply and discard actions linked to the specified configuration instance. |
void |
showError(java.lang.String[] message)
Shows an error message in the bottom line of the view. |
void |
updateError(java.lang.String id,
java.lang.String msg,
boolean add)
Performs an action on an error. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.gridsystems.config.ConfiguratorView |
---|
getSubtitle, getTitle, getValues, setValues |
Field Detail |
---|
protected java.util.ResourceBundle bundle
protected int width
Constructor Detail |
---|
public AbstractConsoleView(Configurator config)
config
- The configuration instancepublic AbstractConsoleView(Configurator config, int width)
config
- The configuration to usewidth
- The view widthMethod Detail |
---|
public void setApplyDiscardMappings(Configurator config)
config
- The configuration instance which actions will affect topublic Configurator getConfigurator()
getConfigurator
in interface ConfiguratorView
public void execute()
ConsoleConfiguratorView
execute
in interface ConsoleConfiguratorView
ConsoleConfiguratorView.execute()
protected void paintForm(java.lang.Object[] form)
form
- The contents of the boxprotected java.lang.Object[] buildForm()
getContents(java.util.List)
public void addKeyMapping(java.lang.String key, ConsoleViewAction action)
key
- The associated command stringaction
- The action to execute when key is typedpublic void addKeyMapping(ConsoleViewAction action)
action
- The action to executepublic void addKeyMapping(GroupField group)
group
- The group field.public void removeKeyMapping(ConsoleViewAction action)
action
- the action to removepublic void removeKeyMapping(GroupField group)
group
- The group fieldprotected abstract void getContents(java.util.List<java.lang.Object> list)
list
- A list where to put the contents of the boxprotected ValueField createValueField(java.lang.String linePattern, java.lang.String valuePattern)
linePattern
- The line pattern of the new fieldvaluePattern
- The value pattern of the new field
protected SelectionField createSelectionField(java.lang.String linePattern, java.lang.String valuePattern, java.lang.String[] values)
linePattern
- a String with the line pattern of the new field.valuePattern
- a String with the value pattern of the new field.values
- a String[] with the list of valid values of the new field.
protected BoolField createBoolField(java.lang.String linePattern)
linePattern
- The field line pattern
protected PasswordField createPasswordField(java.lang.String linePattern)
linePattern
- The field line pattern
protected ConstantField createConstantField(java.lang.String linePattern, java.lang.String value)
linePattern
- The field line patternvalue
- the value
public java.lang.String getString(java.lang.String key, java.lang.Object[] params)
key
- The key for the localized patternparams
- The parameters for pattern substitution
java.lang.NullPointerException
- if the bundle is not setpublic java.lang.String getString(java.lang.String key)
key
- The key for the localized pattern
java.lang.NullPointerException
- if the bundle is not setpublic void showError(java.lang.String[] message)
The message is removed on the next view refresh
message
- The error message linespublic void updateError(java.lang.String id, java.lang.String msg, boolean add)
updateError
in interface ErrorListener
id
- The error identifiermsg
- The error messageadd
- A flag that indicates if the error must be added(true) or
removepublic void clearErrors()
clearErrors
in interface ErrorListener
public boolean hasErrors()
hasErrors
in interface ConfiguratorView
true
if there is any error in the view
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |