My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
exprEval  
Swixml2 dynamic expression evaluation
Updated Apr 3, 2012 by bartolom...@gmail.com

Introduction

During render (see renderContent) is possible to set any attribute of swing component. The original swixml projects allowed to set constant value to attributes and provided initClass feature to allow the developer to provide a dynamic value through constructor.

Not like swixml the swixml2 introduces the dynamic expression evaluation that allow us to set, whatever attribute, using a property (i.e. getter method) belonging to rendered object.

Example

For example if we want to set size of a Dialog using a dynamic expression evaluation in Xml we have to write:

<?xml version="1.0" encoding="windows-1252"?>

<dialog Size="${customSize}" resizable="false" title="Login Dialog"  defaultCloseOperation="JFrame.HIDE_ON_CLOSE">

…..


</dialog>

while in the Java code :

public class MyDialog extends JDialog {

public Dimension getCustomSize() { return new Dimension(100,100); }

}

and automatically, during render process, to set the size property will be called the getter method (i.e. the property)

As you see, it is enough to use ${<property name>} to active the very useful dynamic expression evaluation.

Comment by Sombr...@gmail.com, May 25, 2012

hi, can is use such feature against bindwith attribute?

Comment by project member bartolom...@gmail.com, May 26, 2012

No, you can't.

In reality the bindWith already implies a property evaluation

Hope this helps

Powered by Google Project Hosting