|
exprEval
Swixml2 dynamic expression evaluation
IntroductionDuring 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. ExampleFor 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. | |
hi, can is use such feature against bindwith attribute?
No, you can't.
In reality the bindWith already implies a property evaluation
Hope this helps