A new Swixml version has been released and is available for download at the
swixml Web site at http://www.swixml.org
Documentation and sample code have been updated as well.

While the difference in the version number is only marginal, this release is
significant step towards a 1.0 release.
The biggest and most requested improvement probably is that the SwingEngine
class does not have to be extended anymore.
Instead, code like the following now seems to be much more advisable:

public class Sample extends WindowAdapter implements ActionListener {
  private SwingEngine swix;

  public JMenuItem mi_exit, mi_save;
  public JPanel center_panel;
  public Action click = new AbstractAction() {
    public void actionPerformed( ActionEvent e ) {
      System.out.println( "Button got clicked" ); // show the access outer
class member ..
    }
  };

  private Actions() {
    try {
      swix = new SwingEngine( this );
      swix.render( "xml/Actions.xml" ).setVisible( true );
    }
    // ..
  }
}

Moreover, the often used "find - and - cast" can be avoided, if variable
names match the tag id.
Code like the following used to be very common in Swixml apps:

    JButton btn = (JButton) find(btn);

The latest swixml uses introspection to initialize public fields with
matching names and assignable types.
For instance, if the XML descriptor has a Label like this:

    <label id="lbl_status" constraints="BorderLayout.SOUTH"/>

and your Java class has a corresponding public field:

    public JLabel lbl_status;

Then find - and - cast is not necessary anymore, since during rendering, the
lbl_status field is automatically mapped to the JLabel with the matching id.

All public member variables are mapped to the GUI components if the fields'
name and the id match. This operation is type save. Mapping only takes place
if the member variable class is equal or a super class of the Tag class.

There are a lot of other improvements to be found in this release. However,
the most significant once have been addressed. The sample code has been
modified already and should give at least some ideas how to make use of it.

Please note that with this new release your existing code may not compile
immediately. I all cases we ran into however, the required modifications
were minimal.

Let me know what you think about the new stuff.
Wolf

--
Wolf Paulus
C a r l s b a d   C u b e s
mailto:[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE:
This message is intended only for the use of the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, please contact the sender by reply
email and destroy all copies of the original message.


Reply via email to