title logo

Bean Markup

The syntax used to codify Java Beans in XML is derived from IBM's "Bean Markup Language". Documentation and utilities relative to BML are downloadable from IBM AlphaWorks site. From the syntax described in the user's guide, several constructs specific to the current implementation, has been added:

  • listener is used to bind an event originated from a Java Beans to the XBMapper.
    Syntax:
      <listener name="event-set-name"
                         [target="alternate-bean"]
                         [filter="filter"]/>
    

    Semantics: Makes the Ketuk processor a listener of "event-set-name" from the target bean. If the target attribute is present, then the operation is performed on the bean with that name instead of the default (i.e., containing) bean. By default, the XBMapper implements 4 kind of events : action, propertyChange, container and caret.
    Examples:
      <listener name="caret"/>
      <!-- listen a caret event on the current bean -->
    
      <listener name="action" target="text"/>
      <!-- listen an action event on the bean named "text" -->
    
  • fire-event is used to generate an event of the class BeanEditEvent
    Syntax:
      <fire-event type="event-type"
                           [source="event-source"]
                           [name="property-name"]
                           [childName="name-of-added-child"]
                           [child="reference-of-removed-child"]/>
    

    Semantics: Fires an event of the class BeanEditEvent to be handled by the XBMapper. If the source attribute is present, then the originator of the event is set with that bean instead of the default (i.e., containing) bean. Four kind of events can be created:
    1. if the type attribute is equal to end, then an event requesting the end of the editing process is created,
    2. if the type attribute is equal to change-property, then an event specifying the change in a property is created. The name of the modified property is specified in the name attribute,
    3. if the type attribute is equal to add-child, then an event requesting the addition of a new child is created. The name of the child is specified in the childName attribute,
    4. if the type attribute is equal to remove-child, then an event requesting the deletion of an existing child is created. The reference to the child is specified in the child attribute,

    Examples:
      <fire-event type="change-property" name="text"/>
      <!-- sends an event which indicates that a property named "text"
             has been changed in the current bean                        -->
    
      <fire-event type="add-child" name="author" source="book"/>
      <!-- sends an event which indicates that a new element called
             "author" has to be added into the element corresponding
             to the bean referenced by "book"                            -->
    
  • array is used to group objects into an array.
    Syntax:
      <array>
        ... a list of objects of the same class ...
      </array>
    

    Semantics: Creates an array of objects. All child elements are used to initialize a new array.
    Examples:
      <bean class="java.awt.Polygon"/>
        <args>
          <array>
            <cast class="int" value="0"/>
            <cast class="int" value="100"/>
            <cast class="int" value="100"/>
          </array>
          <array>
            <cast class="int" value="0"/>
            <cast class="int" value="0"/>
            <cast class="int" value="100"/>
          </array>
          <cast class="int" value="3"/>
        </args>
      </bean>
    
blank horizontal line
Made with CSS Valid XHTML 1.0! Valid CSS! Copyright © 2000 INRIA, Dyade, Bull
Created by Claude Pasquier