public abstract class Gui extends JPanel
Compiler
.
JPanel --- GridBagLayout | | TTLabel (=abbrev-string) | JLabel (= "/") | TTLabel (=name-string) | JLabel (= ":") | JPanel ("growing group") // has "MultiLineFlowLayout" | | Field_int | | Field_bool | | | | Handles | | | TTHandle | | | TTHandle | | | TTHandle | | Collection ("growing group") | | | Field_int | | | Field_string | | Handles | | | ... | | Collection | | | ... | | Handles | | | ... | | TTLabel // next line | JLabel
Messages
.messages
.
Model.descriptions
.
#editGraphically(String,JPanel,Dimension,String,boolean,String[],String[])
Modifier and Type | Class and Description |
---|---|
class |
Gui.Collection
Contains all widgets for all arguments in one(1) of many repeting groups.
|
class |
Gui.CommentField
Fields are generated by the compiler, therefore it must access this class.
|
class |
Gui.Field_bool
Widget for the input of one boolean argument.
|
class |
Gui.Field_enum<E extends Enum<E>>
Widget for the input of one enumeration argument.
|
class |
Gui.Field_enumSet<E extends Enum<E>>
Widget for an input field of a selection of enumeration values.
|
class |
Gui.Field_float
Widget for the input of one floating point number argument.
|
class |
Gui.Field_int
Widget for the input of one integer number argument.
|
class |
Gui.Field_rational
Widget for the input of one rational (=broken) number argument.
|
class |
Gui.Field_string
Widget for the input of one string argument.
|
class |
Gui.Field_uri
Widget for the input of one uri argument.
|
protected class |
Gui.HandleActionListener
Basic functionality: identify and give access to the context of a handle-click.
|
class |
Gui.Handles
Specialized by generated code, mainly because
Gui.Handles.doplus(Component) and Gui.Handles.makeModelInstance() , the
generation of a new group in the gui/the model, delivers different
types. |
class |
Gui.MultiLineFlowLayout
Needed for the contents of the option arguments JPanel.
|
static class |
Gui.StringIcon
A wrapper class which prints a string in a very tiny font, for putting it on a "JButton".
|
protected class |
Gui.TextReaction
Reacts to changes in the gui argument input.
|
protected class |
Gui.TTHandle
Derived from JButton only for getting the tool tip text
always in the (possibly dynamically changing) current language.
|
protected class |
Gui.TTLabel
Subclass needed for getting tool-tip text dynamically, indexed by
current language, and by the text of the label.
|
protected class |
Gui.ValueField
Comon superclass for all text field inputs the editing of which may FAIL ---
(=Field_int Field_float Field_rat)
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected ActionListener |
action_delete
re-usable constant for handle buttons.
|
protected ActionListener |
action_insert
re-usable constant for handle buttons.
|
protected ActionListener |
action_swap
re-usable constant for handle buttons.
|
static Color |
backgroundColor_error
Evident
|
static Color |
backgroundColor_ok
Evident
|
static Color |
backgroundColor_warning
Evident
|
protected static Insets |
buttoninsets
Distance around a single
Gui.TTHandle . |
protected Map<JButton,String> |
buttonKeys
Maps each JButton to a key into
messages for dynamic language switching. |
protected static Dimension |
buttonsize
Size for a single
Gui.TTHandle . |
protected JFrame |
editingFrame
Top-level swing container for executing
editGraphically(String,JPanel,DIRECTORIES_ONLY,String,String{],String[])}
|
protected @Opt JComponent |
errorcomponent
The component, the editing of which caused the last error, if any.
|
protected Set<JComponent> |
errorControlled
Make the arguments becoming inactive on input errors, and active
again when the error is corrected.
|
protected String |
errorkey
The un-translated error message, i.e.
|
protected boolean |
errorstate
Is set/reset by the
InputVerifier methods of all fields with syntax,
and read by the handle buttons, to make them inactive as long as a
widget input error is pending. |
protected JPanel |
growingGroup
After the generated code has created its labels, this is the
panel in which to create the argument value widgets.
|
protected static Dimension |
handlesize
Size for the group of three handles in a
Gui.Handles . |
protected static Gui.StringIcon |
idelete
Icon for the button in the a
Gui.TTHandle . |
protected static Gui.StringIcon |
iinsert
Icon for the button in the a
Gui.TTHandle . |
protected static Gui.StringIcon |
iswap
Icon for the button in the a
Gui.TTHandle . |
protected @Opt JLabel |
messagePane
message pane for showing the message if a "field with syntax" cannot be left
because the current text input cannot be parsed into a value.
|
Messages |
messages
For translating the (generic!) error messages
("please insert integer!") and button label ("ok", "cancel").
|
List<String> |
prefLangs
List of languages for all translations.
|
protected Gui.TextReaction |
react_float
Has a verify method according to the syntax of decimal floating point input.
|
protected Gui.TextReaction |
react_int
Has a verify method according to the syntax of decimal integer input.
|
protected Gui.TextReaction |
react_int_hex
Has a verify method according to the syntax of decimal integer input, including
hexadecimal.
|
protected Gui.TextReaction |
react_noSyntax
Has a verify method which lets pass any string.
|
protected Gui.TextReaction |
react_rational
Has a verify method according to the syntax of rational number input.
|
protected @Opt JLabel |
serializationField
Field where with each change in the GUI inputs a serialization will be presented.
|
protected boolean |
uriDialogActive |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Gui() |
Modifier and Type | Method and Description |
---|---|
protected void |
buttonAction(String key) |
void |
clearErrorControlled()
Make no external component to become inactive on input errors, and active
again when the error is corrected.
|
protected void |
displayActive()
Will be overridden by the generated code.
|
protected void |
displaySerialization()
Calculate and display a serialization of the current input state of the GUI
|
void |
editGraphically(@Opt String titleText,
@Opt JPanel titleGraphic,
@Opt Dimension innerArea,
String lang,
String[] buttonLabels,
String[] cancelButtons)
Interactive execution of the gui panel, very simple style.
|
protected Object[] |
field2coordinates(Component field)
Calculates the position (option name, numeric positions) of an input field
for showing it (as a synthesized muli-text) to the user.
(Currently only used for the title etc. |
protected int |
getInitialWidthOfValuesPanel()
Deliver the width (in pixels) for the right part (=value part) of every option's
representation.
|
protected abstract Model |
getModel()
Overriden by generated code.
|
protected Gui.CommentField |
make_commentfield(String key,
String text)
Called by generated code whenever a "comment" instruction is
interspered into the sequence of option definitions.
|
protected void |
make_label(@Opt String name,
@Opt String abbrev,
List<Component> allcomponents)
Called by Generated code.
|
void |
makeErrorControlled(JComponent... comps)
Make the arguments becoming inactive on input errors, and active
again when the error is corrected.
|
protected Gui.Field_bool |
makeField_bool()
Factory method called by
populate() in compiled code. |
protected <E extends Enum<E>> |
makeField_enum(Class<E> e)
Factory method called by
populate() in compiled code. |
protected <E extends Enum<E>> |
makeField_enumSet(Class<E> e)
Factory method called by
populate() in compiled code. |
protected Gui.Field_float |
makeField_float()
Factory method called by
populate() in compiled code. |
protected Gui.Field_int |
makeField_int()
Factory method called by
populate() in compiled code. |
protected Gui.Field_rational |
makeField_rat()
Factory method called by
populate() in compiled code. |
protected Gui.Field_string |
makeField_string()
Factory method called by
populate() in compiled code. |
protected Gui.Field_uri |
makeField_uri()
Factory method called by
populate() in compiled code. |
protected Gui.Field_uri |
makeField_uri(boolean _dirOnly,
boolean _fileOnly,
boolean _writableOnly)
Factory method called by
populate() in compiled code. |
static void |
model2view_repeting(JPanel container,
List models)
Called by the generated code for data transfer.
|
abstract void |
model2view(Model m)
Overriden by generated code.
|
protected abstract void |
populate()
Callback function, overriden by generated code.
|
void |
set_error_off()
Clear
errorstate and the contents of messagePane . |
protected void |
set_error_on(JComponent comp,
String mkey)
Reflect an illegal input syntax in the gui.
|
protected void |
set_error_on(String mkey)
Present to the user the translation of the error message key
mkey
as defined in translations in the pane messagePane . |
void |
setLivingListLanguagePreferences(List<String> lang_prefs)
Sets a link to a "living", i.e.
|
void |
setMessagePane(JLabel mp)
Set the field were syntax errors are shown when the input form is stuck.
|
void |
setSerializationField(@Opt JLabel serializationField)
Set the widget in wich with each change in the GUI inputs a serialization will
be presented.
|
static void |
switchOptionEnableState(Component comp,
boolean active)
Sets the component itself, and all descendants, to enabled/disabled.
|
static void |
switchOptionEnableState(List<Component> comps,
boolean active)
Sets all components in the list (and all sub-components) to enabled/disableds.
|
protected @Opt String |
translate_description(String key)
Translate a key into the application specific descriptions.
|
void |
updateLanguage()
Signals from outside that the language preferences (in particular the first
language) have changed.
|
static void |
updatePos(JPanel container,
boolean isStar)
Re-assigns the numbering of the groups, which appears in the title,
and makes certain buttons invisible in the "Handles" groups at both ends.
|
static <Sub> void |
view2model_repeting(JPanel container,
List<Sub> models)
Called by the generated code for data transfer.
|
abstract void |
view2model(Model m)
Overriden by generated code.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected boolean errorstate
InputVerifier
methods of all fields with syntax,
and read by the handle buttons, to make them inactive as long as a
widget input error is pending.protected String errorkey
@Opt protected @Opt JComponent errorcomponent
@Opt protected @Opt JLabel messagePane
protected Map<JButton,String> buttonKeys
messages
for dynamic language switching.public final Messages messages
Gui.TTLabel
, are NOT from here, but from the model.
This field is public, so further languages can be added by the caller,
and further translations for buttons, column headers, menu items,
tabbed pane riders, etc.public List<String> prefLangs
protected JPanel growingGroup
protected Set<JComponent> errorControlled
protected final Gui.TextReaction react_int
protected final Gui.TextReaction react_int_hex
protected final Gui.TextReaction react_float
protected final Gui.TextReaction react_rational
protected final Gui.TextReaction react_noSyntax
protected boolean uriDialogActive
public static final Color backgroundColor_error
public static final Color backgroundColor_warning
public static final Color backgroundColor_ok
protected static final Gui.StringIcon iinsert
Gui.TTHandle
.
Attention, its object identity is used for switching reactions.protected static final Gui.StringIcon idelete
Gui.TTHandle
.
Attention, its object identity is used for switching reactions.protected static final Gui.StringIcon iswap
Gui.TTHandle
.
Attention, its object identity is used for switching reactions.protected static final Dimension buttonsize
Gui.TTHandle
.protected static final Dimension handlesize
Gui.Handles
.protected static final Insets buttoninsets
Gui.TTHandle
.protected final ActionListener action_insert
protected final ActionListener action_delete
protected final ActionListener action_swap
@Opt protected @Opt JLabel serializationField
protected JFrame editingFrame
public void setMessagePane(JLabel mp)
protected abstract Model getModel()
Model
object.public abstract void view2model(Model m)
public abstract void model2view(Model m)
public void setLivingListLanguagePreferences(List<String> lang_prefs)
updateLanguage()
public void updateLanguage()
protected abstract void populate()
@Opt protected @Opt String translate_description(String key)
protected void make_label(@Opt @Opt String name, @Opt @Opt String abbrev, List<Component> allcomponents)
protected int getInitialWidthOfValuesPanel()
protected Gui.CommentField make_commentfield(String key, String text)
public void makeErrorControlled(JComponent... comps)
public void clearErrorControlled()
protected void set_error_on(JComponent comp, String mkey)
backgroundColor_error
(=normally red);
all focus shifts (internal to the GUI)
away from it are hindered by in-activating all sibling inputs;
a multi-lingual error text is shown in the dedicated field messagePane
.protected void set_error_on(String mkey)
mkey
as defined in translations
in the pane messagePane
.
Memorize errorstate and the key of the message text, for switching the language on the fly.public void set_error_off()
errorstate
and the contents of messagePane
.protected Gui.Field_int makeField_int()
populate()
in compiled code.protected Gui.Field_float makeField_float()
populate()
in compiled code.protected Gui.Field_rational makeField_rat()
populate()
in compiled code.protected Gui.Field_string makeField_string()
populate()
in compiled code.protected Gui.Field_bool makeField_bool()
populate()
in compiled code.protected Gui.Field_uri makeField_uri()
populate()
in compiled code.protected Gui.Field_uri makeField_uri(boolean _dirOnly, boolean _fileOnly, boolean _writableOnly)
populate()
in compiled code.
protected <E extends Enum<E>> Gui.Field_enum<E> makeField_enum(Class<E> e)
populate()
in compiled code. protected <E extends Enum<E>> Gui.Field_enumSet<E> makeField_enumSet(Class<E> e)
populate()
in compiled code.public static void updatePos(JPanel container, boolean isStar)
panel "pp" count=14 (6 7 8 9 10 11 12 num=13) XXX Handles Collection Handles Collection Handles Collection Handles #0 #1 #2 b b - F F F b b b F F F b b b F F F b - -
protected Object[] field2coordinates(Component field)
TTLabel JLabel TTLabel JPanel=growingGroup field field field Handle Collection(with pos) field field field
public static final void switchOptionEnableState(List<Component> comps, boolean active)
public static final void switchOptionEnableState(Component comp, boolean active)
protected void displayActive()
public void setSerializationField(@Opt @Opt JLabel serializationField)
protected void displaySerialization()
public static void model2view_repeting(JPanel container, List models)
Gui.Handles
.public static <Sub> void view2model_repeting(JPanel container, List<Sub> models)
Gui.Handles
.
public void editGraphically(@Opt @Opt String titleText, @Opt @Opt JPanel titleGraphic, @Opt @Opt Dimension innerArea, String lang, String[] buttonLabels, String[] cancelButtons)
buttonAction(String)
is called, with the untranslated label key.titleText
- text on top of the windowtitleGraphic
- included above the parameters' panelinnerArea
- if set, default size of parameters' panellang
- the initial languagelanguageDynamic
- whether the language is dynamically changeablebuttonTexts
- the keys of the action buttons (texts are
translations from the current muli configuration!)cancelButtons
- keys of buttons which are active during input errorsprotected void buttonAction(String key)
see also the complete user documentation .