|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
se.ericsson.eto.norarc.javaframe.MessageGUI
Creates a user interface to input messages to a JavaFrame application. This class is a ready-made GUI, but have to be extended. The new extended class (e.g. PtnGUI) should have the following content:
generateMessage
method must be given content by the user in order to interpret
input parameters from this GUI. The necessary message composition must be coded before
sending off the message to the selected mediator.int
type parameters and float
parameters.
These are parToInt
and parToFloat
.
After this class has been created, two methods must be used to make the mediators
and messages selectable in the GUI.
To associate an alias name to a Mediator, use defMediator
.
The method defMessage
will display the message name in the GUI.
The GUI is realized by calling show
.
NOTE! The two methods defMediator
and defMessage
must not be called
after show
because defMediator
and defMessage
are not thread-safe.
However, you can use the addLog
method to output log
information to the bottom window of this GUI,
e.g. in the forward method of JavaFrame's output edge mediator(s) or in the generateMessage
method
of this class.
Here is a code example:
// generate the message GUI object
env = new PtnGUI("Input to Pattern Composite Example");
// inform GUI about the input message types,using class literal
env.defMessage(PtnMessage.class);
// or use fully qualified class name
env.defMessage("se.ericsson.eto.norarc.ptn.PtnMessage");
// inform GUI about the input mediator
env.defMediator("ToSystem", inputMediator);
// display GUI
env.show();
Nested Class Summary | |
(package private) class |
MessageGUI.SendButtonListener
|
Nested classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
(package private) javax.swing.text.MutableAttributeSet |
attr
|
(package private) javax.swing.text.DefaultStyledDocument |
doc
|
(package private) se.ericsson.eto.norarc.javaframe.MessageGUI.LogInterface |
lif
|
(package private) javax.swing.JScrollPane |
outputMsgScrollPane
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Window |
|
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MessageGUI(java.lang.String headerText)
Instantiates the UI object, but nothing is diplayed before show() is called. |
Method Summary | |
void |
addLog(java.lang.String msg)
Writes log messages to the log window. |
void |
defMediator(java.lang.String name,
Mediator mediator)
Adds an alias to the mediator list, i.e. an association between the specified String (ie mediator name) and the reference to
a Mediator .
|
void |
defMessage(java.lang.Class msg)
Adds a message name to the list of messages. |
void |
defMessage(java.lang.String msg)
Adds a message name to the list of messages. |
abstract void |
generateMessage(java.lang.String msg,
java.util.Vector params,
Mediator med)
This method is called when the user press the send button. |
java.lang.String |
getSelectedMediator()
Returns the alias of the selected mediator. |
java.lang.String |
getSelectedMessage()
Returns the selected message name. |
protected void |
onExitButton()
Can be customized for those who need to do some special actions when the Exit button is pressed. |
float |
parToFloat(java.lang.Object par)
Convert a parameter object to a float . |
int |
parToInt(java.lang.Object par)
Convert a parameter object to an int . |
protected void |
processWindowEvent(java.awt.event.WindowEvent e)
Can be customized for those who need to do some special actions caused by WindowEvent . |
void |
show()
Display the GUI, invoked once after all defMessage calls and all defMediator calls. |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
javax.swing.text.DefaultStyledDocument doc
javax.swing.text.MutableAttributeSet attr
javax.swing.JScrollPane outputMsgScrollPane
se.ericsson.eto.norarc.javaframe.MessageGUI.LogInterface lif
Constructor Detail |
public MessageGUI(java.lang.String headerText)
show()
is called.
headerText
- a String
used as a title of the JFrame
.Method Detail |
public void show()
defMessage
calls and all defMediator
calls.
protected void processWindowEvent(java.awt.event.WindowEvent e)
WindowEvent
.
protected void onExitButton()
public void defMediator(java.lang.String name, Mediator mediator)
String
(ie mediator name) and the reference to
a Mediator
.
The mediator name is shown in the upper left JList
.
New names of the mediators will be added to the end of the JList
.
The first name will be by default the selected one at invokation of this class.
name
- the String
that is shown in the list of mediators.mediator
- the reference to Mediator
associated with name
.public void defMessage(java.lang.Class msg)
JList
.
New names of the mediators will be added to the end of the JList
.
The first name will be by default the selected one at invokation of this class.
msg
- class literal of the Message
.
The class must be accessible via the imported packages.
Example:
defMessage(RequestServiceMsg.class);
public void defMessage(java.lang.String msg)
JList
.
New names of the mediators will be added to the end of the JList
.
The first name will be by default the selected one at invokation of this class.
msg
- full package name of Message
given as a String
.
Example:
defMessage("se.ericsson.eto.norarc.RequestServiceMsg");
public void addLog(java.lang.String msg)
Addlog
is threadsafe.
public float parToFloat(java.lang.Object par)
float
.
par
- a Object
as passed as an element of Vector
to the generateMessage
method.
public int parToInt(java.lang.Object par)
int
.
par
- a Object
as passed as an element
of Vector
in the generateMessage
method.
public java.lang.String getSelectedMediator()
generateMessage
to log information.
String
for Mediator
.public java.lang.String getSelectedMessage()
generateMessage
to log information.
String
for Message
.public abstract void generateMessage(java.lang.String msg, java.util.Vector params, Mediator med)
Message
to the selected Mediator
.
The parameters in the GUI's JTextField
is interpreted as
comma-separated and the parameters are put into the elements of Vector params
.
msg
- the selected String
that is shown in the list of messages.params
- a Vector
of parameters.med
- the selected Mediator
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |