ucar.unidata.ui
Class XmlUi

java.lang.Object
  extended by ucar.unidata.ui.XmlUi
All Implemented Interfaces:
ActionListener, ItemListener, EventListener
Direct Known Subclasses:
IdvXmlUi

public class XmlUi
extends Object
implements ActionListener, ItemListener

This class can create a UI from a "skin" xml. See the file ../apps/example/docs/xmlui.html for further details.


Nested Class Summary
static interface XmlUi.ActionHandler
          Interface to pass ActionEvents to along with this XmlUI object
static class XmlUi.CardPanel
          Class CardPanel Holds a card layout state
 
Field Summary
static String ACTION_MENUPOPUP
          Action command for popping up a menu
static String ACTION_SETBORDER
          Action procedure
static String ACTION_SETTEXT
          Action procedure
static String ACTION_UI_FLIP
          Action command for flpping through a card layout
static String ACTION_UI_FOCUS
          Action command for flpping through a card layout
static String ACTION_UI_GROUP_NEXT
          Action procedure
static String ACTION_UI_GROUP_PREV
          Action procedure
static String[] ALIGN_NAMES
          alignment names
static int[] ALIGN_VALUES
          corresponding alignment values
static String[] ANCHOR_NAMES
          grid bag anchors
static int[] ANCHOR_VALUES
          corresponding grid bag anchor values
static String ATTR_ACTION
          xml attribute name
static String ATTR_ACTIONTEMPLATE
          xml attribute name
static String ATTR_ALIGN
          xml attribute name
static String ATTR_ANCHOR
          xml attribute name
static String ATTR_BGCOLOR
          xml attribute name
static String ATTR_BORDER
          xml attribute name
static String ATTR_BORDER_BOTTOM
          xml attribute name
static String ATTR_BORDER_COLOR
          xml attribute name
static String ATTR_BORDER_HINSET
          xml attribute name
static String ATTR_BORDER_INSET
          xml attribute name
static String ATTR_BORDER_LEFT
          xml attribute name
static String ATTR_BORDER_RIGHT
          xml attribute name
static String ATTR_BORDER_THICKNESS
          xml attribute name
static String ATTR_BORDER_TITLE
          xml attribute name
static String ATTR_BORDER_TOP
          xml attribute name
static String ATTR_BORDER_VINSET
          xml attribute name
static String ATTR_BSPACE
          Bottom space for insets
static String ATTR_CATEGORY
          Category attribute for treepanel
static String ATTR_CATEGORYCOMPONENT
          Used to define that the component is the category component for a tree panel
static String ATTR_CLASS
          xml attribute name
static String ATTR_COLS
          xml attribute name
static String ATTR_COLWIDTHS
          xml attribute name
static String ATTR_CONTINUOUS
          xml attribute name
static String ATTR_DEFAULT
          xml attribute name
static String ATTR_DIVIDER
          xml attribute name
static String ATTR_DOWNIMAGE
          xml attribute name
static String ATTR_EDITABLE
          Used for the combobox tag to define if the combobox is editable
static String ATTR_EVENT
          xml attribute name
static String ATTR_FGCOLOR
          xml attribute name
static String ATTR_FILL
          xml attribute name
static String ATTR_FLOAT
          xml attribute name
static String ATTR_FONTFACE
          xml attribute name
static String ATTR_FONTSIZE
          xml attribute name
static String ATTR_FONTSTYLE
          xml attribute name
static String ATTR_GROUP
          xml attribute name
static String ATTR_HEIGHT
          xml attribute name
static String ATTR_HPOSITION
          xml attribute name
static String ATTR_HSCROLL
          xml attribute name
static String ATTR_HSPACE
          xml attribute name
static String ATTR_ICON
          xml attribute name
static String ATTR_ID
          xml attribute name
static String ATTR_IDREF
          xml attribute name
static String ATTR_IMAGE
          xml attribute name
static String ATTR_IMAGEHEIGHT
          xml attribute name
static String ATTR_IMAGEWIDTH
          xml attribute name
static String ATTR_KEYPRESS
          xml attribute name
static String ATTR_LABEL
          xml attribute name
static String ATTR_LAYOUT
          xml attribute name
static String ATTR_LSPACE
          Left space for insets
static String ATTR_MARGIN
          xml attribute name
static String ATTR_MNEMONIC
          xml attribute name
static String ATTR_MOUSE_CLICK
          xml attribute name
static String ATTR_MOUSE_ENTER
          xml attribute name
static String ATTR_MOUSE_EXIT
          xml attribute name
static String ATTR_NAME
          xml attribute name
static String ATTR_ONETOUCHEXPANDABLE
          xml attribute name
static String ATTR_ORIENTATION
          xml attribute name
static String ATTR_OVERIMAGE
          xml attribute name
static String ATTR_PLACE
          xml attribute name
static String ATTR_PREF_HEIGHT
          xml attribute name
static String ATTR_PREF_WIDTH
          xml attribute name
static String ATTR_RESIZEWEIGHT
          xml attribute name
static String ATTR_ROWHEIGHTS
          xml attribute name
static String ATTR_ROWS
          xml attribute name
static String ATTR_RSPACE
          Right space for insets
static String ATTR_SELECTIMAGE
          xml attribute name
static String ATTR_SPACE
          xml attribute name
static String ATTR_TABBORDERBOTTOM
          xml attribute name
static String ATTR_TABBORDERLEFT
          xml attribute name
static String ATTR_TABBORDERRIGHT
          xml attribute name
static String ATTR_TABBORDERTOP
          xml attribute name
static String ATTR_TABINSETS
          xml attribute name
static String ATTR_TABNESTED
          xml attribute name
static String ATTR_TABPAD
          xml attribute name
static String ATTR_TABPLACE
          xml attribute name
static String ATTR_TABTOOLTIP
          xml attribute name
static String ATTR_TAGCLASS
          xml attribute name
static String ATTR_TEMPLATE
          xml attribute name
static String ATTR_TEXT
          xml attribute name
static String ATTR_TITLE
          xml attribute name
static String ATTR_TOOLTIP
          xml attribute name
static String ATTR_TREEWIDTH
          xml attribute name
static String ATTR_TSPACE
          Top space for insets
static String ATTR_URL
          xml attribute name
static String ATTR_USESPLITPANE
          xml attribute name
static String ATTR_VALUE
          xml attribute name
static String ATTR_VPOSITION
          xml attribute name
static String ATTR_VSCROLL
          xml attribute name
static String ATTR_VSPACE
          xml attribute name
static String ATTR_WIDTH
          xml attribute name
static String ATTR_X
          xml attribute name
static String ATTR_Y
          xml attribute name
static String BORDER_BEVEL
          border type
static String BORDER_BEVEL_LOWERED
          border type
static String BORDER_BEVEL_RAISED
          border type
static String BORDER_BUTTON
          border type
static String BORDER_EMPTY
          border type
static String BORDER_ETCHED
          border type
static String BORDER_ETCHED_LOWERED
          border type
static String BORDER_ETCHED_RAISED
          border type
static String BORDER_LINE
          border type
static String BORDER_MATTE
          border type
static String BORDER_TITLED
          border type
static String[] FILL_NAMES
          fill names
static int[] FILL_VALUES
          corresponding fill valus
static String[] FLOWLAYOUT_NAMES
          flow layout names
static int[] FLOWLAYOUT_VALUES
          corresponding flow layout values
static String[] HPOS_NAMES
          alignment names
static int[] HPOS_VALUES
          corresponding alignment values
static int[] HSCROLL_VALUES
          corresponding scroll type values
static String LAYOUT_BORDER
          layout type
static String LAYOUT_CARD
          layout type
static String LAYOUT_FLOW
          layout type
static String LAYOUT_GRAPHPAPER
          layout type
static String LAYOUT_GRID
          layout type
static String LAYOUT_GRIDBAG
          layout type
static String LAYOUT_INSET
          layout type
static String LAYOUT_WRAP
          layout type
static int NOVALUE
          Special value
static String NULLSTRING
          More clear then going (String) null.
protected  Hashtable properties
          Holds the properties
static String[] SCROLL_NAMES
          scroll type names
static String[] SPLITPANE_NAMES
          split pane orientation
static int[] SPLITPANE_VALUES
          corresponding split pane values
static String[] TABPLACE_NAMES
          tab place names
static int[] TABPLACE_VALUES
          corresponding tab place values
static String TAG_BUTTON
          xml tag
static String TAG_BUTTONTABBEDPANE
          xml tag
static String TAG_CARDPANEL
          xml tag
static String TAG_CHECKBOX
          xml tag
static String TAG_COMBOBOX
          Xml tag for creating a combobox
static String TAG_COMPONENT
          xml tag
static String TAG_COMPONENTS
          xml tag
static String TAG_FILLER
          xml tag
static String TAG_HTML
          For showing html text.
static String TAG_IMAGE
          xml tag
static String TAG_IMPORT
          xml tag
static String TAG_ITEM
          xml tag
static String TAG_LABEL
          xml tag
static String TAG_MENU
          xml tag
static String TAG_MENUBAR
          xml tag
static String TAG_MENUITEM
          xml tag
static String TAG_MENUPOPUP
          xml tag
static String TAG_PANEL
          xml tag
static String TAG_PROPERTIES
          xml tag
static String TAG_PROPERTY
          xml tag
static String TAG_RADIO
          xml tag
static String TAG_SCROLLER
          xml tag
static String TAG_SEPARATOR
          xml tag
static String TAG_SKIN
          Tag and attribute names for the skin xml
static String TAG_SPLITPANE
          xml tag
static String TAG_STYLE
          Holds a style definition
static String TAG_STYLES
          The xml section that holds the styles
static String TAG_TABBEDPANE
          xml tag
static String TAG_TEXTINPUT
          xml tag
static String TAG_TOGGLEBUTTON
          xml tag
static String TAG_TOOLBAR
          xml tag
static String TAG_TREEPANEL
          xml tag
static String TAG_UI
          xml tag
static String[] TOOLBAR_NAMES
          tool bar orientation names
static int[] TOOLBAR_VALUES
          corresponding toolbar orientation values
static String[] VPOS_NAMES
          alignment names
static int[] VPOS_VALUES
          corresponding alignment values
static int[] VSCROLL_VALUES
          corresponding scroll type values
 
Constructor Summary
XmlUi()
          default ctor
XmlUi(Element root, ActionListener actionListener)
          ctor
XmlUi(Element root, Element startNode, Hashtable idToComponent, ActionListener actionListener, Hashtable initProperties)
           
XmlUi(Element root, Hashtable idToComponent, ActionListener actionListener, Hashtable initProperties)
          Create the XmlUi processor.
XmlUi(String xml, Hashtable idToComponent, ActionListener actionListener)
          ctor
 
Method Summary
 void actionPerformed(ActionEvent event)
          handle event.
 void addComponent(String id, Component comp)
          Add the given component to the idToComponent map.
 void addComponent(String id, Element component)
          Add the component
 Component createComponent(Element node, String id)
          Create the awt Component defined by the given skin node.
 void dispose()
          The destructor
static String extractOneArg(String cmd)
          utility to parse commands
static String[] extractTwoArgs(String cmd)
          utility to parse commands
 int getAlign(String align)
          Get the align value from the given string name
 String getAttr(Element node, String attr)
          Get the value of the given attribute on the node.
 boolean getAttr(Element node, String attr, boolean dflt)
          Get the attribute value
 Color getAttr(Element node, String attr, Color dflt)
          Get the attribute value
 double getAttr(Element node, String attr, double dflt)
          Get the attribute value
 ImageIcon getAttr(Element node, String attr, ImageIcon dflt)
          Get the attribute value
 int getAttr(Element node, String attr, int dflt)
          Get the attribute value
 String getAttr(Element node, String attr, String dflt)
          Get the attribute value
 Border getBorder(String type, Element node)
          Create the border
 Component getComponent(String id)
          Return the Component identified by id
 List getComponents()
          Get the list of components created
 Component getContents()
          Create, if needed, and return the gui
static Image getImage(String path)
          Create an image
 Image getImageAttr(Element node, String attr)
          Get image defined by attr name
 String getProperty(String name)
          Look up the property
 boolean hasComponent(String id)
          Does this object hold this component
static String inheritName(String attr)
           
static String inheritNameOldWay(String attr)
          Get the inherited attribute name
protected  void initializeComponents(Element root)
          initialize
 void itemStateChanged(ItemEvent event)
          handle event
static void main(String[] args)
          test
 JComponent makeButton(String tag, Element node)
          Make a button
 void setRoot(Element root)
          Set the xml root and reinitialize
 void setStartNode(Element node)
           
protected  Component xmlToUi(Element node)
          Convert the given xml node tree to a gui component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULLSTRING

public static final String NULLSTRING
More clear then going (String) null.


ACTION_UI_FLIP

public static final String ACTION_UI_FLIP
Action command for flpping through a card layout

See Also:
Constant Field Values

ACTION_UI_FOCUS

public static final String ACTION_UI_FOCUS
Action command for flpping through a card layout

See Also:
Constant Field Values

ACTION_MENUPOPUP

public static final String ACTION_MENUPOPUP
Action command for popping up a menu

See Also:
Constant Field Values

ACTION_SETTEXT

public static final String ACTION_SETTEXT
Action procedure

See Also:
Constant Field Values

ACTION_SETBORDER

public static final String ACTION_SETBORDER
Action procedure

See Also:
Constant Field Values

ACTION_UI_GROUP_NEXT

public static final String ACTION_UI_GROUP_NEXT
Action procedure

See Also:
Constant Field Values

ACTION_UI_GROUP_PREV

public static final String ACTION_UI_GROUP_PREV
Action procedure

See Also:
Constant Field Values

TAG_SKIN

public static final String TAG_SKIN
Tag and attribute names for the skin xml

See Also:
Constant Field Values

TAG_STYLES

public static final String TAG_STYLES
The xml section that holds the styles

See Also:
Constant Field Values

TAG_STYLE

public static final String TAG_STYLE
Holds a style definition

See Also:
Constant Field Values

TAG_UI

public static final String TAG_UI
xml tag

See Also:
Constant Field Values

TAG_CARDPANEL

public static final String TAG_CARDPANEL
xml tag

See Also:
Constant Field Values

TAG_COMBOBOX

public static final String TAG_COMBOBOX
Xml tag for creating a combobox

See Also:
Constant Field Values

TAG_COMPONENTS

public static final String TAG_COMPONENTS
xml tag

See Also:
Constant Field Values

TAG_COMPONENT

public static final String TAG_COMPONENT
xml tag

See Also:
Constant Field Values

TAG_BUTTON

public static final String TAG_BUTTON
xml tag

See Also:
Constant Field Values

TAG_RADIO

public static final String TAG_RADIO
xml tag

See Also:
Constant Field Values

TAG_CHECKBOX

public static final String TAG_CHECKBOX
xml tag

See Also:
Constant Field Values

TAG_FILLER

public static final String TAG_FILLER
xml tag

See Also:
Constant Field Values

TAG_HTML

public static final String TAG_HTML
For showing html text. Uses url attribute or contained text

See Also:
Constant Field Values

TAG_IMAGE

public static final String TAG_IMAGE
xml tag

See Also:
Constant Field Values

TAG_IMPORT

public static final String TAG_IMPORT
xml tag

See Also:
Constant Field Values

TAG_ITEM

public static final String TAG_ITEM
xml tag

See Also:
Constant Field Values

TAG_LABEL

public static final String TAG_LABEL
xml tag

See Also:
Constant Field Values

TAG_MENU

public static final String TAG_MENU
xml tag

See Also:
Constant Field Values

TAG_MENUPOPUP

public static final String TAG_MENUPOPUP
xml tag

See Also:
Constant Field Values

TAG_MENUBAR

public static final String TAG_MENUBAR
xml tag

See Also:
Constant Field Values

TAG_MENUITEM

public static final String TAG_MENUITEM
xml tag

See Also:
Constant Field Values

TAG_PANEL

public static final String TAG_PANEL
xml tag

See Also:
Constant Field Values

TAG_PROPERTIES

public static final String TAG_PROPERTIES
xml tag

See Also:
Constant Field Values

TAG_PROPERTY

public static final String TAG_PROPERTY
xml tag

See Also:
Constant Field Values

TAG_SCROLLER

public static final String TAG_SCROLLER
xml tag

See Also:
Constant Field Values

TAG_SEPARATOR

public static final String TAG_SEPARATOR
xml tag

See Also:
Constant Field Values

TAG_SPLITPANE

public static final String TAG_SPLITPANE
xml tag

See Also:
Constant Field Values

TAG_TABBEDPANE

public static final String TAG_TABBEDPANE
xml tag

See Also:
Constant Field Values

TAG_BUTTONTABBEDPANE

public static final String TAG_BUTTONTABBEDPANE
xml tag

See Also:
Constant Field Values

TAG_TREEPANEL

public static final String TAG_TREEPANEL
xml tag

See Also:
Constant Field Values

TAG_TEXTINPUT

public static final String TAG_TEXTINPUT
xml tag

See Also:
Constant Field Values

TAG_TOGGLEBUTTON

public static final String TAG_TOGGLEBUTTON
xml tag

See Also:
Constant Field Values

TAG_TOOLBAR

public static final String TAG_TOOLBAR
xml tag

See Also:
Constant Field Values

ATTR_ACTION

public static final String ATTR_ACTION
xml attribute name

See Also:
Constant Field Values

ATTR_CATEGORY

public static final String ATTR_CATEGORY
Category attribute for treepanel

See Also:
Constant Field Values

ATTR_CATEGORYCOMPONENT

public static final String ATTR_CATEGORYCOMPONENT
Used to define that the component is the category component for a tree panel

See Also:
Constant Field Values

ATTR_ACTIONTEMPLATE

public static final String ATTR_ACTIONTEMPLATE
xml attribute name

See Also:
Constant Field Values

ATTR_ALIGN

public static final String ATTR_ALIGN
xml attribute name

See Also:
Constant Field Values

ATTR_HPOSITION

public static final String ATTR_HPOSITION
xml attribute name

See Also:
Constant Field Values

ATTR_VPOSITION

public static final String ATTR_VPOSITION
xml attribute name

See Also:
Constant Field Values

ATTR_ANCHOR

public static final String ATTR_ANCHOR
xml attribute name

See Also:
Constant Field Values

ATTR_BGCOLOR

public static final String ATTR_BGCOLOR
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER

public static final String ATTR_BORDER
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_TITLE

public static final String ATTR_BORDER_TITLE
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_COLOR

public static final String ATTR_BORDER_COLOR
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_THICKNESS

public static final String ATTR_BORDER_THICKNESS
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_INSET

public static final String ATTR_BORDER_INSET
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_HINSET

public static final String ATTR_BORDER_HINSET
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_VINSET

public static final String ATTR_BORDER_VINSET
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_TOP

public static final String ATTR_BORDER_TOP
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_LEFT

public static final String ATTR_BORDER_LEFT
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_BOTTOM

public static final String ATTR_BORDER_BOTTOM
xml attribute name

See Also:
Constant Field Values

ATTR_BORDER_RIGHT

public static final String ATTR_BORDER_RIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_CLASS

public static final String ATTR_CLASS
xml attribute name

See Also:
Constant Field Values

ATTR_TAGCLASS

public static final String ATTR_TAGCLASS
xml attribute name

See Also:
Constant Field Values

ATTR_COLS

public static final String ATTR_COLS
xml attribute name

See Also:
Constant Field Values

ATTR_COLWIDTHS

public static final String ATTR_COLWIDTHS
xml attribute name

See Also:
Constant Field Values

ATTR_CONTINUOUS

public static final String ATTR_CONTINUOUS
xml attribute name

See Also:
Constant Field Values

ATTR_ONETOUCHEXPANDABLE

public static final String ATTR_ONETOUCHEXPANDABLE
xml attribute name

See Also:
Constant Field Values

ATTR_DEFAULT

public static final String ATTR_DEFAULT
xml attribute name

See Also:
Constant Field Values

ATTR_DIVIDER

public static final String ATTR_DIVIDER
xml attribute name

See Also:
Constant Field Values

ATTR_DOWNIMAGE

public static final String ATTR_DOWNIMAGE
xml attribute name

See Also:
Constant Field Values

ATTR_EDITABLE

public static final String ATTR_EDITABLE
Used for the combobox tag to define if the combobox is editable

See Also:
Constant Field Values

ATTR_EVENT

public static final String ATTR_EVENT
xml attribute name

See Also:
Constant Field Values

ATTR_FLOAT

public static final String ATTR_FLOAT
xml attribute name

See Also:
Constant Field Values

ATTR_FGCOLOR

public static final String ATTR_FGCOLOR
xml attribute name

See Also:
Constant Field Values

ATTR_FILL

public static final String ATTR_FILL
xml attribute name

See Also:
Constant Field Values

ATTR_FONTSIZE

public static final String ATTR_FONTSIZE
xml attribute name

See Also:
Constant Field Values

ATTR_FONTFACE

public static final String ATTR_FONTFACE
xml attribute name

See Also:
Constant Field Values

ATTR_FONTSTYLE

public static final String ATTR_FONTSTYLE
xml attribute name

See Also:
Constant Field Values

ATTR_GROUP

public static final String ATTR_GROUP
xml attribute name

See Also:
Constant Field Values

ATTR_HEIGHT

public static final String ATTR_HEIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_HSCROLL

public static final String ATTR_HSCROLL
xml attribute name

See Also:
Constant Field Values

ATTR_IMAGEWIDTH

public static final String ATTR_IMAGEWIDTH
xml attribute name

See Also:
Constant Field Values

ATTR_IMAGEHEIGHT

public static final String ATTR_IMAGEHEIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_KEYPRESS

public static final String ATTR_KEYPRESS
xml attribute name

See Also:
Constant Field Values

ATTR_MOUSE_ENTER

public static final String ATTR_MOUSE_ENTER
xml attribute name

See Also:
Constant Field Values

ATTR_MOUSE_EXIT

public static final String ATTR_MOUSE_EXIT
xml attribute name

See Also:
Constant Field Values

ATTR_MOUSE_CLICK

public static final String ATTR_MOUSE_CLICK
xml attribute name

See Also:
Constant Field Values

ATTR_NAME

public static final String ATTR_NAME
xml attribute name

See Also:
Constant Field Values

ATTR_PREF_HEIGHT

public static final String ATTR_PREF_HEIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_TSPACE

public static final String ATTR_TSPACE
Top space for insets

See Also:
Constant Field Values

ATTR_BSPACE

public static final String ATTR_BSPACE
Bottom space for insets

See Also:
Constant Field Values

ATTR_LSPACE

public static final String ATTR_LSPACE
Left space for insets

See Also:
Constant Field Values

ATTR_RSPACE

public static final String ATTR_RSPACE
Right space for insets

See Also:
Constant Field Values

ATTR_HSPACE

public static final String ATTR_HSPACE
xml attribute name

See Also:
Constant Field Values

ATTR_ID

public static final String ATTR_ID
xml attribute name

See Also:
Constant Field Values

ATTR_IDREF

public static final String ATTR_IDREF
xml attribute name

See Also:
Constant Field Values

ATTR_IMAGE

public static final String ATTR_IMAGE
xml attribute name

See Also:
Constant Field Values

ATTR_LABEL

public static final String ATTR_LABEL
xml attribute name

See Also:
Constant Field Values

ATTR_LAYOUT

public static final String ATTR_LAYOUT
xml attribute name

See Also:
Constant Field Values

ATTR_MARGIN

public static final String ATTR_MARGIN
xml attribute name

See Also:
Constant Field Values

ATTR_MNEMONIC

public static final String ATTR_MNEMONIC
xml attribute name

See Also:
Constant Field Values

ATTR_ORIENTATION

public static final String ATTR_ORIENTATION
xml attribute name

See Also:
Constant Field Values

ATTR_OVERIMAGE

public static final String ATTR_OVERIMAGE
xml attribute name

See Also:
Constant Field Values

ATTR_PLACE

public static final String ATTR_PLACE
xml attribute name

See Also:
Constant Field Values

ATTR_PREF_WIDTH

public static final String ATTR_PREF_WIDTH
xml attribute name

See Also:
Constant Field Values

ATTR_RESIZEWEIGHT

public static final String ATTR_RESIZEWEIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_ROWHEIGHTS

public static final String ATTR_ROWHEIGHTS
xml attribute name

See Also:
Constant Field Values

ATTR_ROWS

public static final String ATTR_ROWS
xml attribute name

See Also:
Constant Field Values

ATTR_SELECTIMAGE

public static final String ATTR_SELECTIMAGE
xml attribute name

See Also:
Constant Field Values

ATTR_SPACE

public static final String ATTR_SPACE
xml attribute name

See Also:
Constant Field Values

ATTR_TABNESTED

public static final String ATTR_TABNESTED
xml attribute name

See Also:
Constant Field Values

ATTR_TABPLACE

public static final String ATTR_TABPLACE
xml attribute name

See Also:
Constant Field Values

ATTR_TABPAD

public static final String ATTR_TABPAD
xml attribute name

See Also:
Constant Field Values

ATTR_TABINSETS

public static final String ATTR_TABINSETS
xml attribute name

See Also:
Constant Field Values

ATTR_TABBORDERLEFT

public static final String ATTR_TABBORDERLEFT
xml attribute name

See Also:
Constant Field Values

ATTR_TABBORDERBOTTOM

public static final String ATTR_TABBORDERBOTTOM
xml attribute name

See Also:
Constant Field Values

ATTR_TABBORDERRIGHT

public static final String ATTR_TABBORDERRIGHT
xml attribute name

See Also:
Constant Field Values

ATTR_TABBORDERTOP

public static final String ATTR_TABBORDERTOP
xml attribute name

See Also:
Constant Field Values

ATTR_ICON

public static final String ATTR_ICON
xml attribute name

See Also:
Constant Field Values

ATTR_TEMPLATE

public static final String ATTR_TEMPLATE
xml attribute name

See Also:
Constant Field Values

ATTR_TEXT

public static final String ATTR_TEXT
xml attribute name

See Also:
Constant Field Values

ATTR_TITLE

public static final String ATTR_TITLE
xml attribute name

See Also:
Constant Field Values

ATTR_TOOLTIP

public static final String ATTR_TOOLTIP
xml attribute name

See Also:
Constant Field Values

ATTR_TABTOOLTIP

public static final String ATTR_TABTOOLTIP
xml attribute name

See Also:
Constant Field Values

ATTR_URL

public static final String ATTR_URL
xml attribute name

See Also:
Constant Field Values

ATTR_VALUE

public static final String ATTR_VALUE
xml attribute name

See Also:
Constant Field Values

ATTR_VSCROLL

public static final String ATTR_VSCROLL
xml attribute name

See Also:
Constant Field Values

ATTR_VSPACE

public static final String ATTR_VSPACE
xml attribute name

See Also:
Constant Field Values

ATTR_WIDTH

public static final String ATTR_WIDTH
xml attribute name

See Also:
Constant Field Values

ATTR_TREEWIDTH

public static final String ATTR_TREEWIDTH
xml attribute name

See Also:
Constant Field Values

ATTR_USESPLITPANE

public static final String ATTR_USESPLITPANE
xml attribute name

See Also:
Constant Field Values

ATTR_X

public static final String ATTR_X
xml attribute name

See Also:
Constant Field Values

ATTR_Y

public static final String ATTR_Y
xml attribute name

See Also:
Constant Field Values

BORDER_BUTTON

public static final String BORDER_BUTTON
border type

See Also:
Constant Field Values

BORDER_TITLED

public static final String BORDER_TITLED
border type

See Also:
Constant Field Values

BORDER_BEVEL

public static final String BORDER_BEVEL
border type

See Also:
Constant Field Values

BORDER_BEVEL_LOWERED

public static final String BORDER_BEVEL_LOWERED
border type

See Also:
Constant Field Values

BORDER_BEVEL_RAISED

public static final String BORDER_BEVEL_RAISED
border type

See Also:
Constant Field Values

BORDER_EMPTY

public static final String BORDER_EMPTY
border type

See Also:
Constant Field Values

BORDER_LINE

public static final String BORDER_LINE
border type

See Also:
Constant Field Values

BORDER_ETCHED

public static final String BORDER_ETCHED
border type

See Also:
Constant Field Values

BORDER_ETCHED_RAISED

public static final String BORDER_ETCHED_RAISED
border type

See Also:
Constant Field Values

BORDER_ETCHED_LOWERED

public static final String BORDER_ETCHED_LOWERED
border type

See Also:
Constant Field Values

BORDER_MATTE

public static final String BORDER_MATTE
border type

See Also:
Constant Field Values

LAYOUT_BORDER

public static final String LAYOUT_BORDER
layout type

See Also:
Constant Field Values

LAYOUT_CARD

public static final String LAYOUT_CARD
layout type

See Also:
Constant Field Values

LAYOUT_FLOW

public static final String LAYOUT_FLOW
layout type

See Also:
Constant Field Values

LAYOUT_GRAPHPAPER

public static final String LAYOUT_GRAPHPAPER
layout type

See Also:
Constant Field Values

LAYOUT_GRID

public static final String LAYOUT_GRID
layout type

See Also:
Constant Field Values

LAYOUT_GRIDBAG

public static final String LAYOUT_GRIDBAG
layout type

See Also:
Constant Field Values

LAYOUT_INSET

public static final String LAYOUT_INSET
layout type

See Also:
Constant Field Values

LAYOUT_WRAP

public static final String LAYOUT_WRAP
layout type

See Also:
Constant Field Values

FLOWLAYOUT_NAMES

public static final String[] FLOWLAYOUT_NAMES
flow layout names


FLOWLAYOUT_VALUES

public static final int[] FLOWLAYOUT_VALUES
corresponding flow layout values


FILL_NAMES

public static final String[] FILL_NAMES
fill names


FILL_VALUES

public static final int[] FILL_VALUES
corresponding fill valus


TABPLACE_NAMES

public static final String[] TABPLACE_NAMES
tab place names


TABPLACE_VALUES

public static final int[] TABPLACE_VALUES
corresponding tab place values


TOOLBAR_NAMES

public static final String[] TOOLBAR_NAMES
tool bar orientation names


TOOLBAR_VALUES

public static final int[] TOOLBAR_VALUES
corresponding toolbar orientation values


SPLITPANE_NAMES

public static final String[] SPLITPANE_NAMES
split pane orientation


SPLITPANE_VALUES

public static final int[] SPLITPANE_VALUES
corresponding split pane values


ANCHOR_NAMES

public static final String[] ANCHOR_NAMES
grid bag anchors


ANCHOR_VALUES

public static final int[] ANCHOR_VALUES
corresponding grid bag anchor values


HPOS_NAMES

public static final String[] HPOS_NAMES
alignment names


HPOS_VALUES

public static final int[] HPOS_VALUES
corresponding alignment values


VPOS_NAMES

public static final String[] VPOS_NAMES
alignment names


VPOS_VALUES

public static final int[] VPOS_VALUES
corresponding alignment values


ALIGN_NAMES

public static final String[] ALIGN_NAMES
alignment names


ALIGN_VALUES

public static final int[] ALIGN_VALUES
corresponding alignment values


SCROLL_NAMES

public static final String[] SCROLL_NAMES
scroll type names


VSCROLL_VALUES

public static final int[] VSCROLL_VALUES
corresponding scroll type values


HSCROLL_VALUES

public static final int[] HSCROLL_VALUES
corresponding scroll type values


properties

protected Hashtable properties
Holds the properties


NOVALUE

public static final int NOVALUE
Special value

See Also:
Constant Field Values
Constructor Detail

XmlUi

public XmlUi()
default ctor


XmlUi

public XmlUi(String xml,
             Hashtable idToComponent,
             ActionListener actionListener)
ctor

Parameters:
xml - The raw xml
idToComponent - pre-defined id to component mapping. Allows you to have your own components that are referenced by the xml
actionListener - Listener to pass events to

XmlUi

public XmlUi(Element root,
             ActionListener actionListener)
ctor

Parameters:
root - xml
actionListener - Listener to pass events to

XmlUi

public XmlUi(Element root,
             Hashtable idToComponent,
             ActionListener actionListener,
             Hashtable initProperties)
Create the XmlUi processor. Root should point to a "skin" node. idToComponent is a Hashtable with application specific collection of id->java.awt.Component pairs. (May be null). actionListener - > route actions to it. (May be null).

Parameters:
root - xml root
idToComponent - pre-defined id to component mapping. Allows you to have your own components that are referenced by the xml
actionListener - Listener to pass events to
initProperties - initial properties

XmlUi

public XmlUi(Element root,
             Element startNode,
             Hashtable idToComponent,
             ActionListener actionListener,
             Hashtable initProperties)
Method Detail

setStartNode

public void setStartNode(Element node)

dispose

public void dispose()
The destructor


initializeComponents

protected void initializeComponents(Element root)
initialize

Parameters:
root - xml root

hasComponent

public boolean hasComponent(String id)
Does this object hold this component

Parameters:
id - component id
Returns:
do we currently have this component

addComponent

public void addComponent(String id,
                         Element component)
Add the component

Parameters:
id - id
component - component

addComponent

public void addComponent(String id,
                         Component comp)
Add the given component to the idToComponent map. If the component already exists throw an IllegalStateException

Parameters:
id -
comp -

getComponent

public Component getComponent(String id)
Return the Component identified by id

Parameters:
id - component id
Returns:
The component

getComponents

public List getComponents()
Get the list of components created

Returns:
components

getAlign

public int getAlign(String align)
Get the align value from the given string name

Parameters:
align - name
Returns:
align value

getAttr

public String getAttr(Element node,
                      String attr)
Get the value of the given attribute on the node. This will first see if the node has the attribute. If not this will look into the styles. If still no value we will look up the xml tree to see if there is any attributes on nodes with the inherit prefix: i:attr_name If we find a value we will then convert any macros (defined with %...%)

Parameters:
node - node
attr - attribute name
Returns:
value or null if none found

inheritNameOldWay

public static String inheritNameOldWay(String attr)
Get the inherited attribute name

Parameters:
attr - attr name
Returns:
i:attr

inheritName

public static String inheritName(String attr)

getAttr

public int getAttr(Element node,
                   String attr,
                   int dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getAttr

public double getAttr(Element node,
                      String attr,
                      double dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getAttr

public boolean getAttr(Element node,
                       String attr,
                       boolean dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getAttr

public String getAttr(Element node,
                      String attr,
                      String dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getAttr

public Color getAttr(Element node,
                     String attr,
                     Color dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getAttr

public ImageIcon getAttr(Element node,
                         String attr,
                         ImageIcon dflt)
Get the attribute value

Parameters:
node - node
attr - attr
dflt - default
Returns:
value or dflt

getBorder

public Border getBorder(String type,
                        Element node)
Create the border

Parameters:
type - border type
node - xml node that holds any other attributes needed
Returns:
The border

setRoot

public void setRoot(Element root)
Set the xml root and reinitialize

Parameters:
root - xml root

getContents

public Component getContents()
Create, if needed, and return the gui

Returns:
gui

getProperty

public String getProperty(String name)
Look up the property

Parameters:
name - property name
Returns:
property value

xmlToUi

protected Component xmlToUi(Element node)
Convert the given xml node tree to a gui component

Parameters:
node - node
Returns:
gui

getImage

public static Image getImage(String path)
Create an image

Parameters:
path - image path
Returns:
image

getImageAttr

public Image getImageAttr(Element node,
                          String attr)
Get image defined by attr name

Parameters:
node - node
attr - attr
Returns:
image

createComponent

public Component createComponent(Element node,
                                 String id)
Create the awt Component defined by the given skin node.

Parameters:
node - node
id - id
Returns:
The component

makeButton

public JComponent makeButton(String tag,
                             Element node)
Make a button

Parameters:
tag - tag name
node - node
Returns:
button

itemStateChanged

public void itemStateChanged(ItemEvent event)
handle event

Specified by:
itemStateChanged in interface ItemListener
Parameters:
event - event

actionPerformed

public void actionPerformed(ActionEvent event)
handle event. This calls actionPerformedInner in a non-swing thread

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - event

extractOneArg

public static String extractOneArg(String cmd)
utility to parse commands

Parameters:
cmd - command
Returns:
The arg

extractTwoArgs

public static String[] extractTwoArgs(String cmd)
utility to parse commands

Parameters:
cmd - command
Returns:
The args

main

public static void main(String[] args)
test

Parameters:
args - args