|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.Gui1.DialogBox
public class DialogBox
This class is responsible to built up the short dialog boxes in the desktop. According to the Model-View-Controller pattern, it is a View used by BeamerManager, CommonPropertyEditor and its subclasses, BadseObjectHandler, and numerous Action classes. The main methods are:
- showListDialog() to display a list where the user clicks on its choices
- showSimpleSelectionDialog() does the same job with check boxes
- showSingleEditor() to display a field where the user enters one text then returns
- showExplorerSelection Dialog() is a powerfull method to select objects in the explorer
- showBackedJComponents() to display complex panels managed by the caller
- showBackedJLists() to display a set of lists for an user choice
- showImmutableStringMap() to display a String map without action on it
- several methods to display a message
Nested Class Summary | |
---|---|
(package private) static class |
DialogBox.KeyListSelectionListener
nested static class for showImmutableStringMap() |
Field Summary | |
---|---|
protected static javax.swing.JDesktopPane |
desk__
|
protected static boolean |
hasHandlerDialog__
|
private static int |
INITIAL_CAPACITY
|
private static DialogBox |
instance__
|
protected static javax.swing.JList |
keyList__
handled by showImmutableStringMap() and the static nested class KeyListSelectionListener. |
protected static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
m_values__
|
protected static boolean |
onlyOneSelectionAllowed__
|
protected static int |
selectedObjectsCount__
|
protected static java.util.Map |
selectedObjectsSetMap__
updated by showExplorerSelectionDialog() and used by valueChanged() map of Class (as key, instance of BaseObject) and JList (as value). |
protected static javax.swing.DefaultListModel |
valuesModel__
|
protected static boolean |
waitClickInExplorer__
|
Constructor Summary | |
---|---|
DialogBox()
only one private constructor |
Method Summary | |
---|---|
static DialogBox |
getInstance()
Only method to get an instance. |
static boolean |
onGoingObjectSelectionOrUserDialog()
. |
static void |
setHasHandlerDialog(boolean _b)
Called by BaseObjectHandler and CollectionPropertyEditor.actionPerformed() to indicate the start and the end of an user dialog. |
static void |
showAlarmMessage(java.lang.String _msg)
Displays an OK alarm message following the Access Road standard. |
static void |
showBackedJComponents(CreationDialogListener _controller,
java.lang.String _request,
javax.swing.JPanel _panel)
Displays a JInternalFrame with several JComponents to be edited by the user, where the components and the frame are closed AFTER the reading of the properties in the components by the controller. |
static void |
showBackedJLists(CreationDialogListener _controller,
java.lang.String _request,
javax.swing.JList[] _l_lists,
java.lang.String[] _l_titles,
boolean _verticalDisplay,
javax.swing.JTextField _field,
boolean _textBeforeLists)
Displays several String/BaseObject lists and a text field for selecting one item or more in each. |
static boolean[] |
showClosingAndSavingDialog(ImmutableName _name)
Display a confirm dialog for closing and saving operations on a base object. |
static boolean |
showConfirmDialog(java.lang.String _question,
java.lang.String _comment)
Displays a question to the user in a modal window. |
static void |
showErrorMessage(java.lang.String _msg)
Displays an OK error message following the Access Road standard. |
void |
showExplorerSelectionDialog(SelectionDialogListener _caller,
java.lang.String _message,
java.util.Set _objectsTypes,
java.util.Map _selectedObjectsSetMap,
boolean _oneSelection)
Displays a powerful dialog for selecting from the Explorer some instances of n specified BaseObject classes (n from 1 to 4, inclusively) in a gBase package. |
static void |
showImmutableStringMap(java.lang.String _title,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> _m_values)
Show a map of Strings to read, without action on it. |
static javax.swing.JDialog |
showListDialog(java.lang.String _title,
javax.swing.JList _list)
Displays an OK_CANCEL dialog box with a list and BoxLayout.Y_AXIS, following the Access Road standard. |
static javax.swing.JDialog |
showOkCancelDialog(java.lang.String _title,
javax.swing.JPanel _panel)
Displays an OK_CANCEL dialog box with BoxLayout.Y_AXIS, following the Access Road standard, in a modal window. |
static void |
showOkMessage(java.lang.String _msg)
Displays an OK information message following the Access Road standard. |
static int |
showOneSelectionOneDialog(java.lang.String _displayName,
java.lang.Object[] _l_values)
Displays one list for selecting one item. |
static javax.swing.JPanel |
showSelectionsInOneDialog(java.lang.String _displayName,
java.lang.Object[] _l_values)
Displays one list for selecting several items. |
static java.util.List<java.lang.String> |
showSimpleSelectionsInOneDialog(java.lang.String _displayName,
java.lang.Object[] _l_values)
Displays one list for selecting several items. |
static java.lang.String |
showSingleEditor(java.lang.String _request)
Displays a request text to the user for entering a short answer. |
static javax.swing.JDialog |
showYesNoCancelDialog(java.lang.String _title,
javax.swing.JPanel _panel)
Displays an YES_NO_CANCEL dialog box with BoxLayout.Y_AXIS, following the Access Road standard. |
void |
valueChanged(javax.swing.event.TreeSelectionEvent _evt)
For implementing the user selection of items in the Explorer, implement a continous TreeSelectionListener which is used only when the showExplorerSelectionDialog() method is called. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int INITIAL_CAPACITY
private static DialogBox instance__
protected static javax.swing.JDesktopPane desk__
protected static boolean waitClickInExplorer__
protected static boolean hasHandlerDialog__
protected static final java.util.Map selectedObjectsSetMap__
protected static int selectedObjectsCount__
protected static boolean onlyOneSelectionAllowed__
protected static javax.swing.JList keyList__
protected static javax.swing.DefaultListModel valuesModel__
protected static java.util.Map<java.lang.String,java.util.List<java.lang.String>> m_values__
Constructor Detail |
---|
public DialogBox()
Method Detail |
---|
public static DialogBox getInstance()
public static void showOkMessage(java.lang.String _msg)
_msg
- message to displaypublic static java.lang.String showSingleEditor(java.lang.String _request)
_request
- explains the data to enter. Displayed to the user without adding.
Returns null if _request is null or superior to 300.
public static void showErrorMessage(java.lang.String _msg)
_msg
- String messagepublic static void showAlarmMessage(java.lang.String _msg)
_msg
- String messagepublic static javax.swing.JDialog showOkCancelDialog(java.lang.String _title, javax.swing.JPanel _panel)
_title
- displayed to the user without adding_panel
- JPanel to be displayed
public static javax.swing.JDialog showYesNoCancelDialog(java.lang.String _title, javax.swing.JPanel _panel)
_title
- of the dialog box_panel
- JPanel to be displayed
public static javax.swing.JDialog showListDialog(java.lang.String _title, javax.swing.JList _list)
_title
- String for the dialog box_list
- JList to be displayed
public void showExplorerSelectionDialog(SelectionDialogListener _caller, java.lang.String _message, java.util.Set _objectsTypes, java.util.Map _selectedObjectsSetMap, boolean _oneSelection) throws SmallError
The objects of each type are displayed in a dedicated list in the dialog panel. The number of possible user-selected objects is limited to 15. The number of selected object in each BaseObject classes may be limited to one. For selection from a list already known, use showListDialog().
This method sends always a return value through the call to _caller.handleSelectionDialog(Map). Each JList is associated to a DefaultListModel. If _selectedObjectsSetMap is null or empty, this method displays initial empty jlists. If the user clicks on the 'OK' button when one JList is empty, or if it clicks on a value with a forbidden type, or if it is the second selection when only one is expected, an error message is displayed. If the user clicks on the 'Cancel' button, the method calls the caller with a 'null' argument. Called by ActionNewView, SimplePropertyEditor, CollectionPropertyEditor, BaseObjectHandler, ActionNewACS. Use valueChanged().
_caller
- which calls this method. Its handleSelectionDialog() method
is called by this method when the user valids the selection inputs._message
- is the title after completed by ' selection'.
Its length has to be inferior to 15. May be null._objectsTypes
- is the set of the n required classes
implementing the BaseObject interface in a gBase package
(n between 1 and 4, inclusively)._selectedObjectsSetMap
- is the map where:
- the key is an _objectsTypes item
- the value is a JList of objects that are instances of the key.
May be null or empty._oneSelection
- is true if only one selected object is
allowed for all BaseObject classes
SmallError
- if a parameter is not a BaseObject instance,
or if types are not matched, or if there are more than 4 _objectTypes.public static boolean showConfirmDialog(java.lang.String _question, java.lang.String _comment)
_question
- displayed, with a lenght limited to 200. If null or empty,
return false._comment
- to the question, , with a lenght limited to 200. May be null.
public static javax.swing.JPanel showSelectionsInOneDialog(java.lang.String _displayName, java.lang.Object[] _l_values)
_displayName
- of the element to select. May be null._l_values
- is the String or BaseObject list of
the non-null values to display. Not null, and size has to be from 1 to 22.
public static java.util.List<java.lang.String> showSimpleSelectionsInOneDialog(java.lang.String _displayName, java.lang.Object[] _l_values)
_displayName
- of the element to select. May be null._l_values
- is the String, ImmutableName or BaseObject list of
the allowed non-null values to display.
public static void showBackedJComponents(CreationDialogListener _controller, java.lang.String _request, javax.swing.JPanel _panel)
Called by BaseObjectHandler.getBaseObjectEditor() for entering the arguments of a new object or a copy, by showBackedJLists() and by showOneSelectionOneDialog() for RightMapPropertyEditor.addKeyElement(). The displayed OK and Cancel buttons have the names ' OK ' and ' Cancel ' in the parent panel of the argument _panel. BaseObjectHandler.actionPerformed() may terminate the dialog through a direct call to one of these buttons.
_controller
- handles the operations when the user ends this dialog.
May be an indirect caller like when this.showOneSelectionOneDialog()
is the direct caller. Must be non-null._request
- is the question to the user. Must be non-null._panel
- is a non-null group of JComponents which includes listener links
for updating the values displayed in the panels, following the first user
choices. The listener is generally _controller.public static int showOneSelectionOneDialog(java.lang.String _displayName, java.lang.Object[] _l_values) throws SmallError
_displayName
- of the element to select. May be null._l_values
- is the String, ImmutableName or BaseObject array of
the non-null values to display.
SmallError
- if the arguments are not correct, or if the number is
below 2 or above 30.public static void showBackedJLists(CreationDialogListener _controller, java.lang.String _request, javax.swing.JList[] _l_lists, java.lang.String[] _l_titles, boolean _verticalDisplay, javax.swing.JTextField _field, boolean _textBeforeLists) throws SmallError
For selecting one or several items in the same list, see showSimpleSelectionDialog() and showSelectionsInOneDialog(). The lists size is from 1 (inclusive) to 16 (inclusive). One JTextField may be displayed before or after the JLists. All the items must have the same type: String or BaseObject. If it is BaseObject, getName().toString() is used to display the item. Called by RightMapPropertyEditor, ActionMapPropertyEditor, StringTwoKeysMapProppertyEditor.AddKeyElement() and ActionNewACSyst. Calls showBackedJComponents().
_controller
- handles the operations when the user ends this dialog.
Never null._request
- text to display at the bottom of the frame. The size
is limited to 50. Never null nor empty._l_lists
- array of String or BaseObject lists for the non-null values to display.
Never null nor empty, and the maximal lenght is 4._l_titles
- titles for each list and test. Never null.
The titles order is the _l_lists order.
Must have the same lenght than _l_lists, in the same order
if _field is null. If not, the lenght is the _l_lists size plus one,
and the field title is always put at the end of _l_titles._verticalDisplay
- true for presenting the lists vertically; false for
an horizontal presentation_field
- a text field. If null, no JTextField is added. May be empty._textBeforeLists
- if _field is not null, true for having it before the JLists
in the presentation; if false, _field is put at the end.
SmallError
- if the arguments are not correct.public static boolean[] showClosingAndSavingDialog(ImmutableName _name)
_name
- of the base object
public static void showImmutableStringMap(java.lang.String _title, java.util.Map<java.lang.String,java.util.List<java.lang.String>> _m_values)
_title
- title of the map_m_values
- map of Strings to display to the userpublic void valueChanged(javax.swing.event.TreeSelectionEvent _evt)
The user selection is put in selectedObjectsSetMap__, in the JList where the key is an interface implemented by the selection class. This method is called by the JTree listener in Explorer, when the user clicks on a node or a leaf. The number of user selections is limited to 20. When the selection class implements several interfaces which are selectedObjectsSetMap__ keys, the selection is put in every associated JList. This method is independant to the beamer listener that listens to the user selection in Explorer (see ActionOpenBeamer.valueChanged() for instance). Calls TreeManager.getTrueUserObjectInTreeExplorer().
valueChanged
in interface javax.swing.event.TreeSelectionListener
_evt
- from Explorer JTreepublic static void setHasHandlerDialog(boolean _b)
_b
- is the new value to setpublic static boolean onGoingObjectSelectionOrUserDialog()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |