BeeSoft®
Since 1992
 

Content

 Welcome
 Products
       Abeona
       Gaia
             News
             Documentation
                   Introduction
                   Swing support
                         Components
                         Building from XML
                               Step by step
                               XML elements
                               Data binding
                               Internationalization
                         Client / server
                   Server application
                   Validation
                   XML
                   Logging
                   Utilities
                   Launcher
             License
             Download
       Hephaistos
       JavaGantt
 Services
       Promote your software
 Contact Us
 Links
      
  GaiaI®
© 2012 BeeSoft ®
 

XML elements and attributes

As you can see in the example above, XML structure copies the Swing component hierarchy. Each element has tag which is mapped to the corresponding Swing component (more exactly, to its builder). Attributes describes the properties of the Swing component, they names are preserved. And XML inner elements correspond to the child components in Swing component hierarchy.

Gaia currently supports these tags:

  • action - processed by eu.beesoft.gaia.swing.builder.ActionBuilder, creates an instance of eu.beesoft.gaia.swing.client.SwingClientAction
  • button - processed by eu.beesoft.gaia.swing.builder.ButtonBuilder, creates an instance of JButton
  • cell - processed by eu.beesoft.gaia.swing.builder.CellConstraintsBuilder, creates an instance of eu.beesoft.gaia.swing.form.CellConstraints
  • checkBox - processed by eu.beesoft.gaia.swing.builder.CheckBoxBuilder, creates an instance of JCheckBox
  • checkBoxMenuItem - processed by eu.beesoft.gaia.swing.builder.CheckBoxMenuItemBuilder, creates an instance of JCheckBoxMenuItem
  • column - processed by eu.beesoft.gaia.swing.builder.TableColumnBuilder, creates an instance of TableColumn
  • comboBox - processed by eu.beesoft.gaia.swing.builder.ComboBoxBuilder, creates an instance of JComboBoxWithSeparator
  • dateField - processed by eu.beesoft.gaia.swing.builder.DateFieldBuilder, creates an instance of eu.beesoft.gaia.swing.builder.JDateField
  • dialog - processed by eu.beesoft.gaia.swing.builder.DialogBuilder, creates an instance of JDialog
  • filler - processed by eu.beesoft.gaia.swing.builder.FillerBuilder, creates an empty JLabel to fill space
  • form - processed by eu.beesoft.gaia.swing.builder.FormBuilder, creates an instance of eu.beesoft.gaia.swing.form.Form
  • frame - processed by eu.beesoft.gaia.swing.builder.FrameBuilder, creates an instance of JFrame
  • gbc - processed by eu.beesoft.gaia.swing.builder.GridBagConstraintsBuilder, creates an instance of GridBagConstraints
  • label - processed by eu.beesoft.gaia.swing.builder.LabelBuilder, creates an instance of JLabel
  • link - processed by eu.beesoft.gaia.swing.builder.LinkBuilder, creates an instance of eu.beesoft.gaia.swing.JLink
  • list - processed by eu.beesoft.gaia.swing.builder.ListBuilder, creates an instance of JList
  • listModel - processed by eu.beesoft.gaia.swing.builder.ListModelBuilder, creates an instance of DefaultListModel or DefaultComboBoxModel
  • menu - processed by eu.beesoft.gaia.swing.builder.MenuBuilder, creates an instance of JMenu
  • menuBar - processed by eu.beesoft.gaia.swing.builder.MenuBarBuilder, creates an instance of JMenuBar
  • menuItem - processed by eu.beesoft.gaia.swing.builder.MenuItemBuilder, creates an instance of JMenuItem
  • panel - processed by eu.beesoft.gaia.swing.builder.PanelBuilder, creates an instance of JPanel
  • passwordField - processed by eu.beesoft.gaia.swing.builder.PasswordFieldBuilder, creates an instance of JPasswordField
  • radioButtonMenuItem - processed by eu.beesoft.gaia.swing.builder.RadioButtonMenuItemBuilder, creates an instance of JRadioButtonMenuItem
  • scrollPane - processed by eu.beesoft.gaia.swing.builder.ScrollPaneBuilder, creates an instance of JScrollPane
  • section - processed by eu.beesoft.gaia.swing.builder.SectionBuilder, creates an instance of JSection
  • separator - processed by eu.beesoft.gaia.swing.builder.SeparatorBuilder, creates an instance of JSeparator
  • splitPane - processed by eu.beesoft.gaia.swing.builder.SplitPaneBuilder, creates an instance of JSplitPane
  • tabbedPane - processed by eu.beesoft.gaia.swing.builder.TabbedPaneBuilder, creates an instance of eu.beesoft.gaia.swing.JCloseableTabbedPane
  • table - processed by eu.beesoft.gaia.swing.builder.TableBuilder, creates an instance of eu.beesoft.gaia.swing.JZebraTable}
  • tableColumn - processed by eu.beesoft.gaia.swing.builder.TableColumnBuilder, creates an instance of TableColumn
  • textArea - processed by eu.beesoft.gaia.swing.builder.TextAreaBuilder, creates an instance of JTextArea
  • textField - processed by eu.beesoft.gaia.swing.builder.TextFieldBuilder, creates an instance of JTextField
  • toolBar - processed by eu.beesoft.gaia.swing.builder.ToolBarBuilder, creates an instance of JToolBar
  • tree - processed by eu.beesoft.gaia.swing.builder.TreeBuilder, creates an instance of eu.beesoft.gaia.swing.JZebraTree
  • treeTable - processed by eu.beesoft.gaia.swing.builder.TreeTableBuilder, creates an instance of eu.beesoft.gaia.swing.JTreeTable

Each XML element has attributes that describe Swing component properties. For java.awt.Component (and all its descendants) are supported these attributes:

  • background - enabled values are constant names from java.awt.Color(for example: BLACK), or r, g, b (for example: 128,255,15), or one RGB number in hexa format (for example: 504B1C)
  • border - see description to {@link #initBorder(String)} method
  • enabled - enabled values are true or false
  • font - enabled values conform to java.awtFont.decode() format
  • foreground - enabled values are like for background
  • layoutConstraint - enabled value is an integer or a name of the constant from the layout manager class of the parent container
  • name - any string
  • opaque - enabled values are true or false
  • size - enabled values have format {width, height} (for example: 80, 51)
  • toolTipText - any string
  • visible - enabled values are true or false

In each element type you can use also attributes corresponding to the parent Swing component. So for label element you can use all attributes above and also attributes related specially to JLabel:

  • horizontalAlignment - enabled values are constants from javax.swing.SwingConstants
  • icon - enabled value is name of the icon file or resource in classpath
  • iconTextGap - enabled values are integers
  • text - any string
  • verticalAlignment - enabled values are constants from javax.swing.SwingConstants

You can find a detailed description of all supported attributes for each supported tag / component in JavaDoc API for corresponding component builder (package eu.beesoft.gaia.

 

Special attributes

There are some special attributes processed in each element:

  • id - unique identifier of the builder (or its object) in XML, it is used to reference the builder
  • class - class of created object (instances of the same builder class can create different objects, but they should be derived one from other)
  • as - a value of this attribute should be an identifier of the other builder (element); the created builder loads properties from referenced builder and then loads its own properties from XML

You need id attribute to reference corresponding component from other component. You can use any string as id.

Attribute class enables to create instance of other class than is supported by corresponding builder. Of course, given class should be a subclass of the class supported by the builder.

The attribute as is supported to minimize effort that is needed to create XML file. If you have element A, which has 5 of 6 attributes identical with element B, it is easy to write element A with attribute as="B" and with 6th attribute only.