de.cbse.jeasy
Class JEMessage

java.lang.Object
  extended by de.cbse.jeasy.JEObject
      extended by de.cbse.jeasy.JEComponent
          extended by de.cbse.jeasy.JEParentComponent
              extended by de.cbse.jeasy.JEMessage
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.InputMethodListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.CaretListener, javax.swing.event.ChangeListener, javax.swing.event.DocumentListener, javax.swing.event.ListSelectionListener, javax.swing.event.MenuKeyListener, javax.swing.event.PopupMenuListener, javax.swing.event.TableModelListener, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeModelListener, javax.swing.event.TreeSelectionListener

public class JEMessage
extends JEParentComponent

A JEMessage serializes and deserializes a jeasy component and all its children using a XML format.
The component or more components are defined as elements of a message. When calling the getMessage method, the values of all components will be stored inside a XML tag.
This may be as recommended the jeasy id, the label of the component or a XML tag defined for the child. Example:
getMessage(...) will give a XML structur like:

 <MS_PA_ComponentsForm>
        <RB_Radio1>true</RB_Radio1>
        <RB_Radio2>false</RB_Radio2>
        <RB_Radio3>false</RB_Radio3>
        <DF_Datafield></DF_Datafield>
        <DF_Dataarea></DF_Dataarea>
        <SN_Spinner></SN_Spinner>
        <CH_Checkbox>false</CH_Checkbox>
        <LI_List>list1</LI_List>
        <LI_List>list2</LI_List>
        <LI_List>list3</LI_List>
        <CL_Combolist>one</CL_Combolist>
        <CL_Combolist>two</CL_Combolist>
        <CL_Combolist>three</CL_Combolist>
        <CL_Combolist>four</CL_Combolist>
        <CB_ComboboxMatch>Egypt</CB_ComboboxMatch>
        <CB_Combobox>Germany</CB_Combobox>
        <DF_Currency></DF_Currency>
        <EP_EditorPane>Hello world!</EP_EditorPane>
 </MS_PA_ComponentsForm>
See a demonstration in the program JEasyExample tab "Components".

Properties :

Author:
Harry Pfohl

Field Summary
static java.lang.String DEFINED
          Specifies the label as XML tag for serializing
(package private)  boolean firstempty
           
static java.lang.String ID
          Specifies the label as XML tag for serializing
static int INSIDE
          Specifies that message bracket should not be set.
static java.lang.String LABEL
          Specifies the label as XML tag for serializing
(package private)  java.lang.StringBuffer message
           
(package private)  java.lang.String NL
           
static int ONLY_FILLED
          Specifies that empty elements should not be get.
(package private)  java.lang.String separator
           
(package private)  java.lang.String storeId
           
(package private)  boolean XMLid
           
(package private)  boolean XMLlabel
           
(package private)  boolean XMLspecified
           
 
Fields inherited from class de.cbse.jeasy.JEComponent
animated, backup, buttonBehind, caretPosition, component, endMarkPosition, enterPressed, isPressed, jeButtonBehind, label, labelBehind, labelText, parentId, scrollPane, tree, treeNode, window
 
Fields inherited from class de.cbse.jeasy.JEObject
aaa, ACTIVITYBAR, ANIMATION, BORDER, BUSINESSOBJECT_NAME, BUTTON, BUTTONGROUP, CHECKBOX, CHECKBOXMENUITEM, COLOR, COMBOBOX, ComboBoxButtonWidth, COMBOLIST, CONSTRAINTS, CONTEXT_HELP_FOCUS_GAINED, CONTEXT_HELP_FOCUS_LOST, CONTEXT_HELP_MOUSE_ENTERED, CONTEXT_HELP_MOUSE_EXITED, DATAFIELD, DATATYPE, DESKTOPPANE, DIALOG, EDITORPANE, FONT, FORMAT, FRAME, GANTTGRID, GLOBAL, GRADIENTPAINT, HELP, ICON, ID_JESTART, INPUT_ERROR_DATE, INPUT_ERROR_LENGTH, INPUT_ERROR_MANDATORY, INPUT_ERROR_PARSE, INPUT_ERROR_RANGE, INPUT_ERROR_REGULAREXPRESSION, INPUT_ERROR_TIME, INPUT_ERRORS, INSETS, INTERNALFRAME, intType, LIST, LOCALE, MENU, MENUBAR, MENUITEM, MESSAGE, METHODINVOCATION, NO_CONSTANT, NO_INPUT_ERROR, OPTIONPANE, PANEL, POPUP, PROGRESSBAR, PROPERTIE_NAME, propertyHashMap, RADIOBUTTON, RADIOBUTTONMENUITEM, refresh, SPINNER, SPLITPANE, START, STORE, STRING, TABBEDPANE, TABLE, TASKPANE, TEXTUREPAINT, THEME, TIPS, TOOLBAR, TREE, TREENODE, type, WINDOW
 
Constructor Summary
JEMessage(JELocaleProperties hm)
          Reads the properties from a HashMap
JEMessage(JENode jen)
          Constructor based on a XML file parsed to a TreeNode.
 
Method Summary
 java.lang.String examineMessage()
           
 java.lang.String getMessage()
          Gets the XML-Message of all entries
 java.lang.String getMessage(int config)
          It saves the entries of the input components to an XML string.
 java.lang.String getMessageRow(int config, int row)
          It saves the entries of the components to an XML string.
 java.lang.String getMessageString()
           
 java.lang.String getSeparator()
           
 void putMessage(java.lang.String message)
          It will fill the JEasy components out of an XML message.
 void putMessageElement(JEObject jo, JENode root)
           
 void setSeparator(java.lang.String separator)
          The separator to set after each tag.
 void setXMLTag(java.lang.String tag)
          Defines the name of the tag for the components serialized by the message.
 
Methods inherited from class de.cbse.jeasy.JEParentComponent
addElement, backupEntry, clear, cloneAll, getChilds, getLayoutManager, init, invokeAll, invokeAll, invokeAll, invokeAll, invokeAll, removeAll, removeId, restoreEntry, setEnabledAll, setEnabledAll, setupComponent, setVisibleAll, setVisibleAll, wasEntryChanged
 
Methods inherited from class de.cbse.jeasy.JEComponent
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, addListeners, caretPositionChanged, caretUpdate, changedUpdate, componentHidden, componentMoved, componentResized, componentShown, examine, examine, focusGained, focusLost, getAddableComponent, getAnimation, getBackupEntry, getButtonBehind, getClosedIcon, getColumns, getComponent, getDataType, getIcon, getJEButtonBehind, getJLabel, getJScrollpane, getLabel, getLabelBehind, getLabelText, getLeafIcon, getMandatory, getName, getOpenIcon, getParentId, getToolTipText, getTreeNode, getValue, getValueBeforeFocus, getValueNotNull, getValues, getWindow, inputMethodTextChanged, insertUpdate, isAnimated, isEditable, isExiting, isListening, isShowing, isVerified, isVisible, itemStateChanged, jCallBackInputVerifier, keyPressed, keyReleased, keyTyped, menuKeyPressed, menuKeyReleased, menuKeyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, propertyChange, refresh, remove, removeActionListeners, removeUpdate, repaint, restoreValueBeforeFocus, setAnimated, setBackground, setBackground, setEnabled, setEnabled, setExiting, setFocus, setForeground, setForeground, setIcon, setListening, setMandatory, setParentId, setProperties, setText, setToolTipText, setTreeNode, setValue, setValueBeforeFocus, setValues, setVerified, setVisible, setVisible, stateChanged, tableChanged, textUpdate, timerTask, transferFocus, transferFocusBackward, treeCollapsed, treeExpanded, treeNodesChanged, treeNodesInserted, treeNodesRemoved, treeStructureChanged, valueChanged, valueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened
 
Methods inherited from class de.cbse.jeasy.JEObject
clearPreview, clone, getApplLocale, getBorderConstantProperty, getBorderProperty, getCharGProperty, getCharProperty, getColorProperty, getConstraintsProperty, getFontProperty, getGProperty, getGradientPaintProperty, getId, getImageConstantProperty, getImageIconProperty, getInsetsProperty, getJEGlobal, getJETexturePaintProperty, getLayoutProperty, getLocaleProperties, getObjectsHashMap, getObjectsNonPreviewHashMap, getPreviewHashMap, getPreviewObject, getProjectDirectory, getPropertieHashMap, getProperty, getProperty, getPropertyAsArray, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsInteger, getPropertyAsObject, getPropertyAsObject, getPropertyAsVector, getPropertyAsVector, getReferenceButtonBehind, getReferenceId, getRegisterText, getResourceUrl, getRootPane, getRootPaneId, getSwingConstantProperty, getTabbedPaneConstantProperty, getTexturePaintProperty, getType, getUniqueNumber, hasSuperclass, invoke, invoke, invoke, invoke, isApplet, isEnterprise, isGlobalAnimation, isGlobalListening, isInited, isPreview, isPreviewMember, isProfessional, isRefresh, isSetuped, isStandard, registerJEObject, removeProperties, removeProperty, removeProperty, setApplet, setApplLocale, setGlobalAnimation, setGlobalListening, setInited, setJeGlobal, setLocaleProperties, setPreview, setPreviewHashMap, setPreviewMember, setPreviewObject, setProjectDirectory, setPropertieHashMap, setProperties, setProperties, setProperty, setProperty, setRefresh, setRootPane, setRootPaneId, setSetuped, setType, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL

public static final java.lang.String LABEL
Specifies the label as XML tag for serializing

See Also:
Constant Field Values

ID

public static final java.lang.String ID
Specifies the label as XML tag for serializing

See Also:
Constant Field Values

DEFINED

public static final java.lang.String DEFINED
Specifies the label as XML tag for serializing

See Also:
Constant Field Values

INSIDE

public static final int INSIDE
Specifies that message bracket should not be set.

See Also:
Constant Field Values

ONLY_FILLED

public static final int ONLY_FILLED
Specifies that empty elements should not be get.

See Also:
Constant Field Values

NL

java.lang.String NL

message

java.lang.StringBuffer message

separator

java.lang.String separator

storeId

java.lang.String storeId

XMLid

boolean XMLid

XMLlabel

boolean XMLlabel

XMLspecified

boolean XMLspecified

firstempty

boolean firstempty
Constructor Detail

JEMessage

public JEMessage(JELocaleProperties hm)
Reads the properties from a HashMap

Parameters:
hm - HashMap

JEMessage

public JEMessage(JENode jen)
Constructor based on a XML file parsed to a TreeNode.

Parameters:
jen -
See Also:
JESaxParser
Method Detail

setXMLTag

public void setXMLTag(java.lang.String tag)
Defines the name of the tag for the components serialized by the message. Use the constants JEMessage.ID, JEMessage.LABEL or JEMessage.DEFINED

Parameters:
tag -

getSeparator

public java.lang.String getSeparator()
Returns:
Returns the separator.

setSeparator

public void setSeparator(java.lang.String separator)
The separator to set after each tag. Use "\n" to get a line split.

Parameters:
separator -

getMessage

public java.lang.String getMessage()
Gets the XML-Message of all entries

Returns:

getMessageString

public java.lang.String getMessageString()

examineMessage

public java.lang.String examineMessage()

getMessageRow

public java.lang.String getMessageRow(int config,
                                      int row)
It saves the entries of the components to an XML string. If the message includes a table all rows are stored inside a tag except you define a row.

The message begins with <messageid>separator and ends with </messageid>. You can prevent this by setting config with JEMessage.INSIDE.

Setting config with JEMessage.ONLY_FILLED will saves only those components with entrys not null.

Parameters:
config - the Properties key.
row - the row of the table if only one row should be read
Returns:
the message string or null if it did not have one.

getMessage

public java.lang.String getMessage(int config)
It saves the entries of the input components to an XML string.

The message begins with <messageid>separator and ends with </messageid>. You can prevent this by setting config with JEMessage.INSIDE.

Setting config with JEMessage.ONLY_FILLED will saves only those components with entrys not null.

Parameters:
config - the Properties key.
Returns:
the message string or null if it did not have one.

putMessage

public void putMessage(java.lang.String message)
It will fill the JEasy components out of an XML message. The message must have a root tag. Example: PotterHarry...

Parameters:
message - the message in attribute grammar

putMessageElement

public void putMessageElement(JEObject jo,
                              JENode root)
                       throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException