From tchemit@users.labs.libre-entreprise.org Sun Dec 28 16:44:41 2008
From: tchemit@users.labs.libre-entreprise.org
To: buix-commits@list.nuiton.org
Subject: [Buix-commits] r1097 - in lutinjaxx/trunk/jaxx-core: .
	src/main/java/jaxx/compiler src/main/java/jaxx/css	src/main/java/jaxx/tags
Date: Sun, 28 Dec 2008 16:44:40 +0100
Message-ID: <20081228154440.D69F5461BEF@labs.libre-entreprise.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============8526406087834712813=="

--===============8526406087834712813==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Author: tchemit
Date: 2008-12-28 15:44:40 +0000 (Sun, 28 Dec 2008)
New Revision: 1097

Added:
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/StylesheetHelper.java
Modified:
   lutinjaxx/trunk/jaxx-core/changelog.txt
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/JAXXCompiler.java
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Rule.java
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Selector.java
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Stylesheet.java
   lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/DefaultObjectHandler.java
Log:
use StylesheetHelper

Modified: lutinjaxx/trunk/jaxx-core/changelog.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/changelog.txt	2008-12-28 15:44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/changelog.txt	2008-12-28 15:44:40 UTC (rev 1097)
@@ -1,4 +1,10 @@
-0.8 ??? 2009????
+1.0 ???? 200812??
+
+0.8 ??? 200812??
+ * 20081228 [chemit] - generify ClassDescriptor
+                     - introduce StylesheetHelper helper class to detach Sty=
lesheet, Rule and Selector classes from
+                       JAXXCompiler and make possible to extract compiler en=
gine from runtime
+                     =20
  * 20081227 [chemit] - add PCS on ValidatorErrorTable to be used by table va=
lidation
  * 20081218 [chemit] - improve generation of methods
  * 20081214 [chemit] - can now in validation, put error with args (all args =
must be separated by a ##)

Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/JAXXCompiler.=
java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/JAXXCompiler.java	2=
008-12-28 15:44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/JAXXCompiler.java	2=
008-12-28 15:44:40 UTC (rev 1097)
@@ -9,6 +9,7 @@
 import jaxx.UnsupportedTagException;
 import jaxx.css.Rule;
 import jaxx.css.Stylesheet;
+import jaxx.css.StylesheetHelper;
 import jaxx.parser.ParseException;
 import jaxx.reflect.ClassDescriptor;
 import jaxx.reflect.ClassDescriptorLoader;
@@ -597,7 +598,7 @@
     }
=20
     public void addInlineStyle(CompiledObject object, String propertyName, b=
oolean dataBinding) {
-        inlineStyles.add(Rule.inlineAttribute(object, propertyName, dataBind=
ing));
+        inlineStyles.add(StylesheetHelper.inlineAttribute(object, propertyNa=
me, dataBinding));
     }
=20
     /*----------------------------------------------------------------------=
-----------*/

Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Rule.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Rule.java	2008-12-28 15:=
44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Rule.java	2008-12-28 15:=
44:40 UTC (rev 1097)
@@ -4,15 +4,9 @@
  */
 package jaxx.css;
=20
-import jaxx.CompilerException;
-import jaxx.compiler.CompiledObject;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Map;
=20
-public class Rule implements Serializable, Comparable {
+public class Rule implements java.io.Serializable, Comparable<Rule> {
     public static final String INLINE_ATTRIBUTE =3D "<inline attribute>";
     public static final String DATA_BINDING =3D "<data binding>";
=20
@@ -23,57 +17,38 @@
=20
     public Rule(Selector[] selectors, Map<String, String> properties) {
         this.selectors =3D selectors;
-        Arrays.sort(selectors);
+        java.util.Arrays.sort(selectors);
         this.properties =3D properties;
     }
=20
=20
     public Rule(Selector[] selectors, String[] keys, String[] values) {
         this.selectors =3D selectors;
-        Arrays.sort(selectors);
-        this.properties =3D new HashMap<String, String>();
-        if (keys.length !=3D values.length)
+        java.util.Arrays.sort(selectors);
+        this.properties =3D new java.util.HashMap<String, String>();
+        if (keys.length !=3D values.length) {
             throw new IllegalArgumentException("keys and values must have th=
e same number of entries");
-        for (int i =3D 0; i < keys.length; i++)
+        }
+        for (int i =3D 0; i < keys.length; i++) {
             properties.put(keys[i], values[i]);
+        }
     }
=20
-
-    public static Rule inlineAttribute(CompiledObject object, String propert=
yName, boolean dataBinding) {
-        Map<String, String> properties =3D new HashMap<String, String>();
-        properties.put(propertyName, dataBinding ? DATA_BINDING : INLINE_ATT=
RIBUTE);
-        return new Rule(new Selector[]{new Selector(null, null, null, object=
.getId(), true)}, properties);
-    }
-
-
     public Selector[] getSelectors() {
         return selectors;
     }
=20
-
     public Map<String, String> getProperties() {
         return properties;
     }
=20
-
-    public int appliesTo(CompiledObject object) throws CompilerException {
-        int appliesTo =3D Selector.NEVER_APPLIES;
-        for (Selector selector : selectors) {
-            appliesTo =3D Math.max(selector.appliesTo(object), appliesTo);
-            if (appliesTo =3D=3D Selector.ALWAYS_APPLIES || appliesTo =3D=3D=
 Selector.ALWAYS_APPLIES_INHERIT_ONLY)
-                break;
-        }
-        return appliesTo;
+    @Override
+    public int compareTo(Rule o) {
+        return selectors[0].compareTo(o.selectors[0]); // they are already s=
orted so we only need to compare the highest-ranked from each one
     }
=20
-
-    public int compareTo(Object o) {
-        Rule r =3D (Rule) o;
-        return selectors[0].compareTo(r.selectors[0]); // they are already s=
orted so we only need to compare the highest-ranked from each one
-    }
-
     @Override
     public String toString() {
-        return "Rule[" + Arrays.asList(selectors) + ", " + properties + "]";
+        return "Rule[" + java.util.Arrays.asList(selectors) + ", " + propert=
ies + "]";
     }
 }
\ No newline at end of file

Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Selector.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Selector.java	2008-12-28=
 15:44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Selector.java	2008-12-28=
 15:44:40 UTC (rev 1097)
@@ -4,12 +4,7 @@
  */
 package jaxx.css;
=20
-import jaxx.compiler.CompiledObject;
-import jaxx.reflect.ClassDescriptor;
-
-import java.io.Serializable;
-
-public class Selector implements Serializable, Comparable {
+public class Selector implements java.io.Serializable, Comparable<Selector> {
     public static final int NEVER_APPLIES =3D 0;
     public static final int PSEUDOCLASS_APPLIES_INHERIT_ONLY =3D 1;
     public static final int PSEUDOCLASS_APPLIES =3D 2;
@@ -21,7 +16,7 @@
     private String pseudoClass;
     private String id;
     private boolean inline;
-    private static final long serialVersionUID =3D 2183853334224189438L;
+    private static final long serialVersionUID =3D 1L;
=20
=20
     public Selector(String javaClassName, String styleClass, String pseudoCl=
ass, String id) {
@@ -38,44 +33,6 @@
     }
=20
=20
-    public int appliesTo(CompiledObject object) {
-        boolean inheritOnly =3D false;
-        CompiledObject parent =3D object;
-        while (parent !=3D null) {
-            boolean classMatch =3D (javaClassName =3D=3D null);
-            if (!classMatch) {
-                ClassDescriptor javaClass =3D parent.getObjectClass();
-                do {
-                    String name =3D javaClass.getName();
-                    if (name.equals(javaClassName) || name.substring(name.la=
stIndexOf(".") + 1).equals(javaClassName)) {
-                        classMatch =3D true;
-                        break;
-                    }
-                    javaClass =3D javaClass.getSuperclass();
-                }
-                while (javaClass !=3D null);
-            }
-
-            boolean styleClassMatch =3D (styleClass =3D=3D null || styleClas=
s.equals(parent.getStyleClass()));
-
-            String objectId =3D parent.getId();
-            objectId =3D objectId.substring(objectId.lastIndexOf(".") + 1);
-            boolean idMatch =3D (id =3D=3D null || (' ' + objectId + ' ').in=
dexOf(' ' + id + ' ') > -1);
-
-            if (classMatch && styleClassMatch && idMatch) {
-                if (pseudoClass !=3D null)
-                    return inheritOnly ? PSEUDOCLASS_APPLIES_INHERIT_ONLY : =
PSEUDOCLASS_APPLIES;
-                else
-                    return inheritOnly ? ALWAYS_APPLIES_INHERIT_ONLY : ALWAY=
S_APPLIES;
-            }
-
-            parent =3D parent.getParent();
-            inheritOnly =3D true;
-        }
-        return NEVER_APPLIES;
-    }
-
-
     public String getJavaClassName() {
         return javaClassName;
     }
@@ -100,29 +57,38 @@
         return inline;
     }
=20
-
-    public int compareTo(Object o) {
-        Selector selector =3D (Selector) o;
-        if (inline && !selector.inline)
+    @Override
+    public int compareTo(Selector selector) {
+        if (inline && !selector.inline) {
             return 1;
-        if (!inline && selector.inline)
+        }
+        if (!inline && selector.inline) {
             return -1;
-        if (pseudoClass !=3D null && selector.pseudoClass =3D=3D null)
+        }
+        if (pseudoClass !=3D null && selector.pseudoClass =3D=3D null) {
             return 1;
-        if (pseudoClass =3D=3D null && selector.pseudoClass !=3D null)
+        }
+        if (pseudoClass =3D=3D null && selector.pseudoClass !=3D null) {
             return -1;
-        if (id !=3D null && selector.id =3D=3D null)
+        }
+        if (id !=3D null && selector.id =3D=3D null) {
             return 1;
-        if (id =3D=3D null && selector.id !=3D null)
+        }
+        if (id =3D=3D null && selector.id !=3D null) {
             return -1;
-        if (styleClass !=3D null && selector.styleClass =3D=3D null)
+        }
+        if (styleClass !=3D null && selector.styleClass =3D=3D null) {
             return 1;
-        if (styleClass =3D=3D null && selector.styleClass !=3D null)
+        }
+        if (styleClass =3D=3D null && selector.styleClass !=3D null) {
             return -1;
-        if (javaClassName !=3D null && selector.javaClassName =3D=3D null)
+        }
+        if (javaClassName !=3D null && selector.javaClassName =3D=3D null) {
             return 1;
-        if (javaClassName =3D=3D null && selector.javaClassName !=3D null)
+        }
+        if (javaClassName =3D=3D null && selector.javaClassName !=3D null) {
             return -1;
+        }
         return 0;
     }
=20

Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Stylesheet.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Stylesheet.java	2008-12-=
28 15:44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/Stylesheet.java	2008-12-=
28 15:44:40 UTC (rev 1097)
@@ -4,33 +4,7 @@
  */
 package jaxx.css;
=20
-import jaxx.CompilerException;
-import jaxx.compiler.CompiledObject;
-import jaxx.compiler.DataBinding;
-import jaxx.compiler.DataSource;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.parser.JavaParser;
-import jaxx.parser.JavaParserTreeConstants;
-import jaxx.parser.SimpleNode;
-import jaxx.reflect.ClassDescriptor;
-import jaxx.reflect.ClassDescriptorLoader;
-import jaxx.reflect.MethodDescriptor;
-import jaxx.tags.DefaultObjectHandler;
-import jaxx.tags.TagManager;
-import jaxx.types.TypeManager;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.Serializable;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Stylesheet implements Serializable {
+public class Stylesheet implements java.io.Serializable {
     private Rule[] rules;
     private static final long serialVersionUID =3D 1L;
=20
@@ -39,411 +13,33 @@
         rules =3D new Rule[0];
     }
=20
-
     public Stylesheet(Rule[] rules) {
         this.rules =3D rules;
-        Arrays.sort(rules);
+        java.util.Arrays.sort(rules);
     }
=20
-
     public Rule[] getRules() {
         return rules;
     }
=20
-
     public void add(Rule newRule) {
         Rule[] oldRules =3D rules;
         rules =3D new Rule[oldRules.length + 1];
         System.arraycopy(oldRules, 0, rules, 0, oldRules.length);
         rules[rules.length - 1] =3D newRule;
-        Arrays.sort(rules);
+        java.util.Arrays.sort(rules);
     }
=20
-
     public void add(Rule[] newRules) {
         Rule[] oldRules =3D rules;
         rules =3D new Rule[oldRules.length + newRules.length];
         System.arraycopy(oldRules, 0, rules, 0, oldRules.length);
         System.arraycopy(newRules, 0, rules, oldRules.length, newRules.lengt=
h);
-        Arrays.sort(rules);
+        java.util.Arrays.sort(rules);
     }
=20
-
-    public void applyTo(CompiledObject object, JAXXCompiler compiler, Styles=
heet overrides) throws CompilerException {
-        Map<String, String> overriddenProperties;
-        if (overrides !=3D null)
-            overriddenProperties =3D overrides.getApplicableProperties(objec=
t);
-        else
-            overriddenProperties =3D null;
-
-        Map<String, String> properties =3D getApplicableProperties(object);
-        if (properties !=3D null) {
-            if (overriddenProperties !=3D null)
-                properties.keySet().removeAll(overriddenProperties.keySet());
-            DefaultObjectHandler handler =3D TagManager.getTagHandler(object=
.getObjectClass());
-            for (Map.Entry<String, String> e : properties.entrySet()) {
-                String value =3D e.getValue();
-                if (value.equals(Rule.INLINE_ATTRIBUTE) || value.equals(Rule=
.DATA_BINDING))
-                    continue;
-                handler.setAttribute(object, e.getKey(), e.getValue(), false=
, compiler);
-            }
-        }
-
-        Rule[] pseudoClasses =3D getApplicablePseudoClasses(object);
-        if (pseudoClasses !=3D null) {
-            Map<String, Map<String, String>> combinedPseudoClasses =3D new L=
inkedHashMap<String, Map<String, String>>();
-            for (Rule pseudoClass1 : pseudoClasses) {
-                Selector[] selectors =3D pseudoClass1.getSelectors();
-                for (Selector selector : selectors) {
-                    if (selector.appliesTo(object) =3D=3D Selector.PSEUDOCLA=
SS_APPLIES) {
-                        properties =3D pseudoClass1.getProperties();
-                        String pseudoClass =3D selector.getPseudoClass();
-                        // TODO: overrides by downstream pseudoclasses are n=
ot handled
-                        Map<String, String> combinedProperties =3D combinedP=
seudoClasses.get(pseudoClass);
-                        if (combinedProperties =3D=3D null) {
-                            combinedProperties =3D new HashMap<String, Strin=
g>();
-                            combinedPseudoClasses.put(pseudoClass, combinedP=
roperties);
-                        }
-                        combinedProperties.putAll(properties);
-                    }
-                }
-            }
-
-            int count =3D 0;
-            for (Map.Entry<String, Map<String, String>> e : combinedPseudoCl=
asses.entrySet()) {
-                applyPseudoClass(e.getKey(), e.getValue(), object, compiler,=
 count++);
-            }
-        }
-    }
-
-
-    /**
-     * Replaces all references to the variable "object" with the actual obje=
ct ID.
-     *
-     * @param code ?
-     * @param id   ?
-     * @return ?
-     * @throws jaxx.CompilerException ?
-     */
-    private String replaceObjectReferences(String code, String id) throws Co=
mpilerException {
-        JavaParser p =3D new JavaParser(new StringReader(code + ";"));
-        p.Expression();
-        SimpleNode node =3D p.popNode();
-        scanNode(node, id);
-        return node.getText();
-    }
-
-
-    private void scanNode(SimpleNode node, String id) {
-        if (node.getId() =3D=3D JavaParserTreeConstants.JJTNAME) {
-            String name =3D node.getText();
-            if (name.equals("object") || (name.indexOf(".") !=3D -1 && name.=
substring(0, name.indexOf(".")).trim().equals("object")))
-                node.firstToken.image =3D id;
-        } else {
-            int count =3D node.jjtGetNumChildren();
-            for (int i =3D 0; i < count; i++)
-                scanNode(node.getChild(i), id);
-        }
-    }
-
-
-    private void compilePseudoClassAdd(String pseudoClass, CompiledObject ob=
ject, String propertyCode, JAXXCompiler compiler) throws CompilerException {
-        if (pseudoClass.equals("mouseover")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseEntered",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseover pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
-            }
-        } else if (pseudoClass.equals("mouseout")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseExited",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-                compiler.appendInitDataBindings("{" + propertyCode + "}");
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseout pseudoclass cannot be applied=
 to object " + object.getObjectClass().getName() + " (no addMouseListener met=
hod)");
-            }
-        } else if (pseudoClass.equals("mousedown")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mousePressed",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mousedown pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
-            }
-        } else if (pseudoClass.equals("mouseup")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseReleased",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-                compiler.appendInitDataBindings("{" + propertyCode + "}");
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseup pseudoclass cannot be applied =
to object " + object.getObjectClass().getName() + " (no addMouseListener meth=
od)");
-            }
-        } else if (pseudoClass.startsWith("{")) {
-            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
-            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
-            String dest =3D object.getId() + ".style." + pseudoClass + ".add=
";
-            String destCode =3D TypeManager.getJavaCode(dest);
-            if (compiler.haveProcessDataBinding()) {
-                compiler.appendProcessDataBinding("else ");
-            }
-            compiler.appendProcessDataBinding("if ($dest.equals(" +  destCod=
e + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }");
-            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
-            compiler.appendInitDataBindings("applyDataBinding("+ destCode + =
");");
-        } else
-            throw new IllegalArgumentException("unrecognized pseudoclass: " =
+ pseudoClass);
-    }
-
-
-    private void compilePseudoClassRemove(String pseudoClass, CompiledObject=
 object, String propertyCode, JAXXCompiler compiler) throws CompilerException=
 {
-        if (pseudoClass.equals("mouseover")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseExited",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseover pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
-            }
-        } else if (pseudoClass.equals("mouseout")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseEntered",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseout pseudoclass cannot be applied=
 to object " + object.getObjectClass().getName() + " (no addMouseListener met=
hod)");
-            }
-        } else if (pseudoClass.equals("mousedown")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseReleased",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mousedown pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
-            }
-        } else if (pseudoClass.equals("mouseup")) {
-            try {
-                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
-                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
-                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
-                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mousePressed",
-                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
-                        propertyCode, compiler);
-            }
-            catch (NoSuchMethodException e) {
-                compiler.reportError("mouseup pseudoclass cannot be applied =
to object " + object.getObjectClass().getName() + " (no addMouseListener meth=
od)");
-            }
-        } else if (pseudoClass.startsWith("{")) {
-            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
-            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
-            String dest =3D object.getId() + ".style." + pseudoClass + ".rem=
ove";
-            String destCode =3D TypeManager.getJavaCode(dest);
-            if (compiler.haveProcessDataBinding()) {
-                compiler.appendProcessDataBinding("else ");
-            }
-            compiler.appendProcessDataBinding("if ($dest.equals(" + destCode=
 + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
-            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
-            compiler.appendInitDataBindings("applyDataBinding(" + destCode +=
 ");");
-        } else
-            throw new IllegalArgumentException("unrecognized pseudoclass: " =
+ pseudoClass);
-    }
-
-
-    private String invert(String javaCode) {
-        javaCode =3D javaCode.trim();
-        if (javaCode.startsWith("!"))
-            return javaCode.substring(1);
-        else
-            return "!(" + javaCode + ")";
-    }
-
-
-    private String unwrap(ClassDescriptor type, String valueCode) {
-        if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(boolean.cla=
ss))
-            return "((java.lang.Boolean) " + valueCode + ").booleanValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(byte.c=
lass))
-            return "((java.lang.Byte) " + valueCode + ").byteValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(short.=
class))
-            return "((java.lang.Short) " + valueCode + ").shortValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(int.cl=
ass))
-            return "((java.lang.Integer) " + valueCode + ").intValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(long.c=
lass))
-            return "((java.lang.Long) " + valueCode + ").longValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(float.=
class))
-            return "((java.lang.Float) " + valueCode + ").floatValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(double=
.class))
-            return "((java.lang.Double) " + valueCode + ").doubleValue()";
-        else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(char.c=
lass))
-            return "((java.lang.Character) " + valueCode + ").charValue()";
-        else
-            return valueCode;
-    }
-
-
-    protected void applyPseudoClass(String pseudoClass, Map<String, String> =
properties,
-                                    CompiledObject object, JAXXCompiler comp=
iler, int priority) throws CompilerException {
-        if (pseudoClass.indexOf("[") !=3D -1)
-            pseudoClass =3D pseudoClass.substring(0, pseudoClass.indexOf("["=
));
-        final StringBuffer buffer =3D new StringBuffer();
-        /*CompiledObject bufferObject =3D new CompiledObject(object.getId(),=
 object.getJavaCode(), object.getObjectClass(), compiler, true) {
-            public void appendInitializationCode(String code) {
-                buffer.append(code);
-            }
-            public void registerDataBinding(String src, String property, Str=
ing assignment, JAXXCompiler compiler) throws CompilerException {
-                buffer.append(assignment);
-            }
-        };*/
-
-        DefaultObjectHandler handler =3D TagManager.getTagHandler(object.get=
ObjectClass());
-        boolean valueDeclared =3D false;
-        for (Map.Entry<String, String> e : properties.entrySet()) {
-            String property =3D e.getKey();
-            ClassDescriptor type =3D handler.getPropertyType(object, propert=
y, compiler);
-            String dataBinding =3D compiler.processDataBindings(e.getValue()=
, type);
-            String valueCode;
-            if (dataBinding !=3D null) {
-                valueCode =3D "new jaxx.runtime.css.DataBinding(" + TypeMana=
ger.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
-                new DataBinding(dataBinding, object.getId() + "." + property=
 + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
-                        property, "(" + JAXXCompiler.getCanonicalName(type) =
+ ") " + dataBinding, compiler), compiler).compile(false);
-            } else {
-                try {
-                    Class typeClass =3D type !=3D null ? ClassDescriptorLoad=
er.getClass(type.getName(), type.getClassLoader()) : null;
-                    valueCode =3D TypeManager.getJavaCode(TypeManager.conver=
tFromString(e.getValue(), typeClass));
-                }
-                catch (ClassNotFoundException ex) {
-                    compiler.reportError("could not find class " + type.getN=
ame());
-                    return;
-                }
-            }
-            if (!valueDeclared) {
-                buffer.append("java.lang.Object ");
-                valueDeclared =3D true;
-            }
-            buffer.append("value =3D jaxx.runtime.css.Pseudoclasses.applyPro=
perty(").append(compiler.getOutputClassName()).append(".this, ").append(objec=
t.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).appen=
d(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").ap=
pend(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).ap=
pend("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparato=
r());
-            buffer.append("if (!(value instanceof jaxx.runtime.css.DataBindi=
ng)) {").append(JAXXCompiler.getLineSeparator());
-            String unwrappedValue =3D unwrap(type, "value");
-            buffer.append("    ").append(handler.getSetPropertyCode(object.g=
etJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
-                    ") " + unwrappedValue, compiler)).append(JAXXCompiler.ge=
tLineSeparator());
-            buffer.append("}").append(JAXXCompiler.getLineSeparator());
-        }
-
-        if (pseudoClass.equals("focused")) {
-            pseudoClass =3D "{ object.hasFocus() }";
-        } else if (pseudoClass.equals("unfocused")) {
-            pseudoClass =3D "{ !object.hasFocus() }";
-        } else if (pseudoClass.equals("enabled")) {
-            pseudoClass =3D "{ object.isEnabled() }";
-        } else if (pseudoClass.equals("disabled")) {
-            pseudoClass =3D "{ !object.isEnabled() }";
-        } else if (pseudoClass.equals("selected")) {
-            pseudoClass =3D "{ object.isSelected() }";
-        } else if (pseudoClass.equals("deselected")) {
-            pseudoClass =3D "{ !object.isSelected() }";
-        }
-
-        compilePseudoClassAdd(pseudoClass, object, buffer.toString(), compil=
er);
-
-        buffer.setLength(0);
-        valueDeclared =3D false;
-        for (Map.Entry<String, String> e : properties.entrySet()) {
-            String property =3D e.getKey();
-            ClassDescriptor type =3D handler.getPropertyType(object, propert=
y, compiler);
-            String dataBinding =3D compiler.processDataBindings(e.getValue()=
, type);
-            String valueCode;
-            if (dataBinding !=3D null) {
-                valueCode =3D "new jaxx.runtime.css.DataBinding(" + TypeMana=
ger.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
-                new DataBinding(dataBinding, object.getId() + "." + property=
 + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
-                        property, "(" + JAXXCompiler.getCanonicalName(type) =
+ ") " + dataBinding, compiler), compiler).compile(false);
-            } else {
-                try {
-                    Class typeClass =3D type !=3D null ? ClassDescriptorLoad=
er.getClass(type.getName(), type.getClassLoader()) : null;
-                    valueCode =3D TypeManager.getJavaCode(TypeManager.conver=
tFromString(e.getValue(), typeClass));
-                }
-                catch (ClassNotFoundException ex) {
-                    compiler.reportError("could not find class " + type.getN=
ame());
-                    return;
-                }
-            }
-            if (!valueDeclared) {
-                buffer.append("java.lang.Object ");
-                valueDeclared =3D true;
-            }
-            buffer.append("value =3D jaxx.runtime.css.Pseudoclasses.removePr=
operty(").append(compiler.getOutputClassName()).append(".this, ").append(obje=
ct.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).appe=
nd(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").a=
ppend(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).a=
ppend("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparat=
or());
-            buffer.append("if (!(value instanceof jaxx.runtime.css.DataBindi=
ng)) {").append(JAXXCompiler.getLineSeparator());
-            String unwrappedValue =3D unwrap(type, "value");
-            buffer.append("    ").append(handler.getSetPropertyCode(object.g=
etJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
-                    ") " + unwrappedValue, compiler)).append(JAXXCompiler.ge=
tLineSeparator());
-            buffer.append("}").append(JAXXCompiler.getLineSeparator());
-        }
-        compilePseudoClassRemove(pseudoClass, object, buffer.toString(), com=
piler);
-    }
-
-
-    public Map<String, String> getApplicableProperties(CompiledObject object=
) throws CompilerException {
-        DefaultObjectHandler handler =3D TagManager.getTagHandler(object.get=
ObjectClass());
-        Map<String, String> result =3D null;
-        for (Rule rule : rules) {
-            int apply =3D rule.appliesTo(object);
-            if (apply =3D=3D Selector.ALWAYS_APPLIES || apply =3D=3D Selecto=
r.ALWAYS_APPLIES_INHERIT_ONLY) {
-                if (result =3D=3D null)
-                    result =3D new HashMap<String, String>();
-                for (Map.Entry<String, String> entry : rule.getProperties().=
entrySet()) {
-                    String property =3D entry.getKey();
-                    if (apply =3D=3D Selector.ALWAYS_APPLIES || handler.isPr=
opertyInherited(property)) {
-                        result.put(property, entry.getValue());
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-
-    public Rule[] getApplicablePseudoClasses(CompiledObject object) throws C=
ompilerException {
-        List<Rule> result =3D null;
-        for (Rule rule : rules) {
-            if (rule.appliesTo(object) =3D=3D Selector.PSEUDOCLASS_APPLIES) {
-                if (result =3D=3D null) {
-                    result =3D new ArrayList<Rule>();
-                }
-                result.add(rule);
-            }
-        }
-        return result !=3D null ? result.toArray(new Rule[result.size()]) : =
null;
-    }
-
     @Override
     public String toString() {
-        return "Stylesheet" + Arrays.asList(rules);
+        return "Stylesheet" + java.util.Arrays.asList(rules);
     }
 }
\ No newline at end of file

Added: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/StylesheetHelper.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/StylesheetHelper.java	  =
                      (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/css/StylesheetHelper.java	20=
08-12-28 15:44:40 UTC (rev 1097)
@@ -0,0 +1,564 @@
+package jaxx.css;
+
+import jaxx.CompilerException;
+import jaxx.compiler.CompiledObject;
+import jaxx.compiler.DataBinding;
+import jaxx.compiler.DataSource;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXCompilerHelper;
+import jaxx.parser.JavaParser;
+import jaxx.parser.JavaParserTreeConstants;
+import jaxx.parser.SimpleNode;
+import jaxx.reflect.ClassDescriptor;
+import jaxx.reflect.ClassDescriptorLoader;
+import jaxx.reflect.MethodDescriptor;
+import jaxx.tags.DefaultObjectHandler;
+import jaxx.tags.TagManager;
+import jaxx.types.TypeManager;
+
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A helper class to compute {@link Stylesheet}, {@link Rule} and {@link Sel=
ector}
+ * and extract all the compiler logic from this class.
+ * <p/>
+ * In that way we can make the compiler as a single module and a runtime as =
another module.
+ *
+ * @author chemit
+ */
+public class StylesheetHelper {
+
+    public static void applyTo(CompiledObject object, JAXXCompiler compiler,=
 Stylesheet stylesheet, Stylesheet overrides) throws CompilerException {
+        Map<String, String> overriddenProperties;
+        if (overrides !=3D null) {
+            overriddenProperties =3D getApplicableProperties(overrides, obje=
ct);
+            //overriddenProperties =3D overrides.getApplicableProperties(s,o=
bject);
+        } else {
+            overriddenProperties =3D null;
+        }
+
+        Map<String, String> properties =3D getApplicableProperties(styleshee=
t, object);
+        if (properties !=3D null) {
+            if (overriddenProperties !=3D null) {
+                properties.keySet().removeAll(overriddenProperties.keySet());
+            }
+            DefaultObjectHandler handler =3D TagManager.getTagHandler(object=
.getObjectClass());
+            for (Map.Entry<String, String> e : properties.entrySet()) {
+                String value =3D e.getValue();
+                if (value.equals(Rule.INLINE_ATTRIBUTE) || value.equals(Rule=
.DATA_BINDING)) {
+                    continue;
+                }
+                handler.setAttribute(object, e.getKey(), e.getValue(), false=
, compiler);
+            }
+        }
+
+        Rule[] pseudoClasses =3D getApplicablePseudoClasses(stylesheet, obje=
ct);
+        if (pseudoClasses !=3D null) {
+            Map<String, Map<String, String>> combinedPseudoClasses =3D new L=
inkedHashMap<String, Map<String, String>>();
+            for (Rule pseudoClass1 : pseudoClasses) {
+                Selector[] selectors =3D pseudoClass1.getSelectors();
+                for (Selector selector : selectors) {
+                    if (appliesTo(selector, object) =3D=3D Selector.PSEUDOCL=
ASS_APPLIES) {
+                        properties =3D pseudoClass1.getProperties();
+                        String pseudoClass =3D selector.getPseudoClass();
+                        // TODO: overrides by downstream pseudoclasses are n=
ot handled
+                        Map<String, String> combinedProperties =3D combinedP=
seudoClasses.get(pseudoClass);
+                        if (combinedProperties =3D=3D null) {
+                            combinedProperties =3D new HashMap<String, Strin=
g>();
+                            combinedPseudoClasses.put(pseudoClass, combinedP=
roperties);
+                        }
+                        combinedProperties.putAll(properties);
+                    }
+                }
+            }
+
+            int count =3D 0;
+            for (Map.Entry<String, Map<String, String>> e : combinedPseudoCl=
asses.entrySet()) {
+                applyPseudoClass(e.getKey(), e.getValue(), object, compiler,=
 count++);
+            }
+        }
+    }
+
+    /**
+     * Replaces all references to the variable "object" with the actual obje=
ct ID.
+     *
+     * @param code ?
+     * @param id   ?
+     * @return ?
+     * @throws jaxx.CompilerException ?
+     */
+    public static String replaceObjectReferences(String code, String id) thr=
ows CompilerException {
+        JavaParser p =3D new JavaParser(new StringReader(code + ";"));
+        p.Expression();
+        jaxx.parser.SimpleNode node =3D p.popNode();
+        scanNode(node, id);
+        return node.getText();
+    }
+
+    public static void scanNode(SimpleNode node, String id) {
+        if (node.getId() =3D=3D JavaParserTreeConstants.JJTNAME) {
+            String name =3D node.getText();
+            if (name.equals("object") || (name.indexOf(".") !=3D -1 && name.=
substring(0, name.indexOf(".")).trim().equals("object"))) {
+                node.firstToken.image =3D id;
+            }
+        } else {
+            int count =3D node.jjtGetNumChildren();
+            for (int i =3D 0; i < count; i++) {
+                scanNode(node.getChild(i), id);
+            }
+        }
+    }
+
+    public static void compilePseudoClassAdd(String pseudoClass, CompiledObj=
ect object, String propertyCode, JAXXCompiler compiler) throws CompilerExcept=
ion {
+
+        if (pseudoClass.startsWith("{")) {
+            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
+            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
+            String dest =3D object.getId() + ".style." + pseudoClass + ".add=
";
+            String destCode =3D TypeManager.getJavaCode(dest);
+            if (compiler.haveProcessDataBinding()) {
+                compiler.appendProcessDataBinding("else ");
+            }
+            compiler.appendProcessDataBinding("if ($dest.equals(" + destCode=
 + ")) { if (" + pseudoClass + ") { " + propertyCode + "} }");
+            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
+            compiler.appendInitDataBindings("applyDataBinding(" + destCode +=
 ");");
+            return;
+        }
+
+        MouseEventEnum constant =3D MouseEventEnum.valueOf(pseudoClass);
+
+        String property =3D null;
+        switch (constant) {
+            case mousedown:
+                property =3D "mousePressed";
+                break;
+            case mouseout:
+                property =3D "mouseExited";
+                break;
+            case mouseover:
+                property =3D "mouseEntered";
+                break;
+            case mouseup:
+                property =3D "mouseReleased";
+                break;
+        }
+
+        ClassDescriptor mouseListenerDescriptor =3D ClassDescriptorLoader.ge=
tClassDescriptor(MouseListener.class);
+        ClassDescriptor mouseEventDescriptor =3D ClassDescriptorLoader.getCl=
assDescriptor(MouseEvent.class);
+
+        try {
+            MethodDescriptor addMouseListener =3D object.getObjectClass().ge=
tMethodDescriptor("addMouseListener", mouseListenerDescriptor);
+            MethodDescriptor methodDescriptor =3D mouseListenerDescriptor.ge=
tMethodDescriptor(property, mouseEventDescriptor);
+            object.addEventHandler("style." + pseudoClass + ".add", addMouse=
Listener, methodDescriptor, propertyCode, compiler);
+
+        } catch (NoSuchMethodException e) {
+            compiler.reportError("mouseover pseudoclass cannot be applied to=
 object " + object.getObjectClass().getName() + " (no addMouseListener method=
)");
+        }
+
+        /*if (pseudoClass.equals("mouseover")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseEntered",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseover pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
+            }
+        } else if (pseudoClass.equals("mouseout")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseExited",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+                compiler.appendInitDataBindings("{" + propertyCode + "}");
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseout pseudoclass cannot be applied=
 to object " + object.getObjectClass().getName() + " (no addMouseListener met=
hod)");
+            }
+        } else if (pseudoClass.equals("mousedown")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mousePressed",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mousedown pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
+            }
+        } else if (pseudoClass.equals("mouseup")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".add", addM=
ouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseReleased",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+                compiler.appendInitDataBindings("{" + propertyCode + "}");
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseup pseudoclass cannot be applied =
to object " + object.getObjectClass().getName() + " (no addMouseListener meth=
od)");
+            }
+        } else if (pseudoClass.startsWith("{")) {
+            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
+            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
+            String dest =3D object.getId() + ".style." + pseudoClass + ".add=
";
+            String destCode =3D TypeManager.getJavaCode(dest);
+            if (compiler.haveProcessDataBinding()) {
+                compiler.appendProcessDataBinding("else ");
+            }
+            compiler.appendProcessDataBinding("if ($dest.equals(" +  destCod=
e + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }");
+            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
+            compiler.appendInitDataBindings("applyDataBinding("+ destCode + =
");");
+        } else
+            throw new IllegalArgumentException("unrecognized pseudoclass: " =
+ pseudoClass);*/
+    }
+
+    public static void compilePseudoClassRemove(String pseudoClass, Compiled=
Object object, String propertyCode, JAXXCompiler compiler) throws CompilerExc=
eption {
+        if (pseudoClass.startsWith("{")) {
+            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
+            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
+            String dest =3D object.getId() + ".style." + pseudoClass + ".rem=
ove";
+            String destCode =3D TypeManager.getJavaCode(dest);
+            if (compiler.haveProcessDataBinding()) {
+                compiler.appendProcessDataBinding("else ");
+            }
+            compiler.appendProcessDataBinding("if ($dest.equals(" + destCode=
 + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
+            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
+            compiler.appendInitDataBindings("applyDataBinding(" + destCode +=
 ");");
+            return;
+        }
+
+        MouseEventEnum constant =3D MouseEventEnum.valueOf(pseudoClass);
+
+        String property =3D null;
+        switch (constant) {
+            case mousedown:
+                property =3D "mousePressed";
+                break;
+            case mouseout:
+                property =3D "mouseReleased";
+                break;
+            case mouseover:
+                property =3D "mouseExited";
+                break;
+            case mouseup:
+                property =3D "mousePressed";
+                break;
+        }
+
+        ClassDescriptor mouseListenerDescriptor =3D ClassDescriptorLoader.ge=
tClassDescriptor(MouseListener.class);
+        ClassDescriptor mouseEventDescriptor =3D ClassDescriptorLoader.getCl=
assDescriptor(MouseEvent.class);
+
+        try {
+            MethodDescriptor addMouseListener =3D object.getObjectClass().ge=
tMethodDescriptor("addMouseListener", mouseListenerDescriptor);
+            MethodDescriptor methodDescriptor =3D mouseListenerDescriptor.ge=
tMethodDescriptor(property, mouseEventDescriptor);
+            object.addEventHandler("style." + pseudoClass + ".remove", addMo=
useListener, methodDescriptor, propertyCode, compiler);
+
+        } catch (NoSuchMethodException e) {
+            compiler.reportError("mouseover pseudoclass cannot be applied to=
 object " + object.getObjectClass().getName() + " (no addMouseListener method=
)");
+        }
+
+        /*if (pseudoClass.equals("mouseover")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseExited",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseover pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
+            }
+        } else if (pseudoClass.equals("mouseout")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseEntered",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseout pseudoclass cannot be applied=
 to object " + object.getObjectClass().getName() + " (no addMouseListener met=
hod)");
+            }
+        } else if (pseudoClass.equals("mousedown")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mouseReleased",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mousedown pseudoclass cannot be applie=
d to object " + object.getObjectClass().getName() + " (no addMouseListener me=
thod)");
+            }
+        } else if (pseudoClass.equals("mouseup")) {
+            try {
+                MethodDescriptor addMouseListener =3D object.getObjectClass(=
).getMethodDescriptor("addMouseListener",
+                        new ClassDescriptor[]{ClassDescriptorLoader.getClass=
Descriptor(MouseListener.class)});
+                object.addEventHandler("style." + pseudoClass + ".remove", a=
ddMouseListener,
+                        ClassDescriptorLoader.getClassDescriptor(MouseListen=
er.class).getMethodDescriptor("mousePressed",
+                                new ClassDescriptor[]{ClassDescriptorLoader.=
getClassDescriptor(MouseEvent.class)}),
+                        propertyCode, compiler);
+            }
+            catch (NoSuchMethodException e) {
+                compiler.reportError("mouseup pseudoclass cannot be applied =
to object " + object.getObjectClass().getName() + " (no addMouseListener meth=
od)");
+            }
+        } else if (pseudoClass.startsWith("{")) {
+            pseudoClass =3D pseudoClass.substring(1, pseudoClass.length() - =
1).trim();
+            pseudoClass =3D replaceObjectReferences(pseudoClass, object.getJ=
avaCode());
+            String dest =3D object.getId() + ".style." + pseudoClass + ".rem=
ove";
+            String destCode =3D TypeManager.getJavaCode(dest);
+            if (compiler.haveProcessDataBinding()) {
+                compiler.appendProcessDataBinding("else ");
+            }
+            compiler.appendProcessDataBinding("if ($dest.equals(" + destCode=
 + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
+            new DataSource(dest, pseudoClass, compiler).compile("new jaxx.ru=
ntime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " +=
 destCode + ")");
+            compiler.appendInitDataBindings("applyDataBinding(" + destCode +=
 ");");
+        } else {
+            throw new IllegalArgumentException("unrecognized pseudoclass: " =
+ pseudoClass);
+        }*/
+    }
+
+    public static String invert(String javaCode) {
+        javaCode =3D javaCode.trim();
+        return javaCode.startsWith("!") ? javaCode.substring(1) : "!(" + jav=
aCode + ")";
+    }
+
+    public static String unwrap(ClassDescriptor type, String valueCode) {
+        if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(boolean.cla=
ss)) {
+            return "((java.lang.Boolean) " + valueCode + ").booleanValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(byte=
.class)) {
+            return "((java.lang.Byte) " + valueCode + ").byteValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(shor=
t.class)) {
+            return "((java.lang.Short) " + valueCode + ").shortValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(int.=
class)) {
+            return "((java.lang.Integer) " + valueCode + ").intValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(long=
.class)) {
+            return "((java.lang.Long) " + valueCode + ").longValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(floa=
t.class)) {
+            return "((java.lang.Float) " + valueCode + ").floatValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(doub=
le.class)) {
+            return "((java.lang.Double) " + valueCode + ").doubleValue()";
+        } else if (type =3D=3D ClassDescriptorLoader.getClassDescriptor(char=
.class)) {
+            return "((java.lang.Character) " + valueCode + ").charValue()";
+        } else {
+            return valueCode;
+        }
+    }
+
+    public static void applyPseudoClass(String pseudoClass, Map<String, Stri=
ng> properties,
+                                        CompiledObject object, JAXXCompiler =
compiler, int priority) throws CompilerException {
+        if (pseudoClass.indexOf("[") !=3D -1) {
+            pseudoClass =3D pseudoClass.substring(0, pseudoClass.indexOf("["=
));
+        }
+        final StringBuffer buffer =3D new StringBuffer();
+        /*CompiledObject bufferObject =3D new CompiledObject(object.getId(),=
 object.getJavaCode(), object.getObjectClass(), compiler, true) {
+            public void appendInitializationCode(String code) {
+                buffer.append(code);
+            }
+            public void registerDataBinding(String src, String property, Str=
ing assignment, JAXXCompiler compiler) throws CompilerException {
+                buffer.append(assignment);
+            }
+        };*/
+
+        DefaultObjectHandler handler =3D TagManager.getTagHandler(object.get=
ObjectClass());
+        boolean valueDeclared =3D false;
+        for (Map.Entry<String, String> e : properties.entrySet()) {
+            String property =3D e.getKey();
+            ClassDescriptor type =3D handler.getPropertyType(object, propert=
y, compiler);
+            String dataBinding =3D compiler.processDataBindings(e.getValue()=
, type);
+            String valueCode;
+            if (dataBinding !=3D null) {
+                valueCode =3D "new jaxx.runtime.css.DataBinding(" + TypeMana=
ger.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
+                new DataBinding(dataBinding, object.getId() + "." + property=
 + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
+                        property, "(" + JAXXCompilerHelper.getCanonicalName(=
type) + ") " + dataBinding, compiler), compiler).compile(false);
+            } else {
+                try {
+                    Class typeClass =3D type !=3D null ? ClassDescriptorLoad=
er.getClass(type.getName(), type.getClassLoader()) : null;
+                    valueCode =3D TypeManager.getJavaCode(TypeManager.conver=
tFromString(e.getValue(), typeClass));
+                }
+                catch (ClassNotFoundException ex) {
+                    compiler.reportError("could not find class " + type.getN=
ame());
+                    return;
+                }
+            }
+            if (!valueDeclared) {
+                buffer.append("java.lang.Object ");
+                valueDeclared =3D true;
+            }
+            buffer.append("value =3D jaxx.runtime.css.Pseudoclasses.applyPro=
perty(").append(compiler.getOutputClassName()).append(".this, ").append(objec=
t.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).appen=
d(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").ap=
pend(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).ap=
pend("), ").append(priority).append(");").append(JAXXCompilerHelper.getLineSe=
parator());
+            buffer.append("if (!(value instanceof jaxx.runtime.css.DataBindi=
ng)) {").append(JAXXCompilerHelper.getLineSeparator());
+            String unwrappedValue =3D unwrap(type, "value");
+            buffer.append("    ").append(handler.getSetPropertyCode(object.g=
etJavaCode(), property, "(" + JAXXCompilerHelper.getCanonicalName(type) +
+                    ") " + unwrappedValue, compiler)).append(JAXXCompilerHel=
per.getLineSeparator());
+            buffer.append("}").append(JAXXCompilerHelper.getLineSeparator());
+        }
+
+        if (pseudoClass.equals("focused")) {
+            pseudoClass =3D "{ object.hasFocus() }";
+        } else if (pseudoClass.equals("unfocused")) {
+            pseudoClass =3D "{ !object.hasFocus() }";
+        } else if (pseudoClass.equals("enabled")) {
+            pseudoClass =3D "{ object.isEnabled() }";
+        } else if (pseudoClass.equals("disabled")) {
+            pseudoClass =3D "{ !object.isEnabled() }";
+        } else if (pseudoClass.equals("selected")) {
+            pseudoClass =3D "{ object.isSelected() }";
+        } else if (pseudoClass.equals("deselected")) {
+            pseudoClass =3D "{ !object.isSelected() }";
+        }
+
+        compilePseudoClassAdd(pseudoClass, object, buffer.toString(), compil=
er);
+
+        buffer.setLength(0);
+        valueDeclared =3D false;
+        for (Map.Entry<String, String> e : properties.entrySet()) {
+            String property =3D e.getKey();
+            ClassDescriptor type =3D handler.getPropertyType(object, propert=
y, compiler);
+            String dataBinding =3D compiler.processDataBindings(e.getValue()=
, type);
+            String valueCode;
+            if (dataBinding !=3D null) {
+                valueCode =3D "new jaxx.runtime.css.DataBinding(" + TypeMana=
ger.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
+                new DataBinding(dataBinding, object.getId() + "." + property=
 + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
+                        property, "(" + JAXXCompilerHelper.getCanonicalName(=
type) + ") " + dataBinding, compiler), compiler).compile(false);
+            } else {
+                try {
+                    Class typeClass =3D type !=3D null ? ClassDescriptorLoad=
er.getClass(type.getName(), type.getClassLoader()) : null;
+                    valueCode =3D TypeManager.getJavaCode(TypeManager.conver=
tFromString(e.getValue(), typeClass));
+                }
+                catch (ClassNotFoundException ex) {
+                    compiler.reportError("could not find class " + type.getN=
ame());
+                    return;
+                }
+            }
+            if (!valueDeclared) {
+                buffer.append("java.lang.Object ");
+                valueDeclared =3D true;
+            }
+            buffer.append("value =3D jaxx.runtime.css.Pseudoclasses.removePr=
operty(").append(compiler.getOutputClassName()).append(".this, ").append(obje=
ct.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).appe=
nd(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").a=
ppend(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).a=
ppend("), ").append(priority).append(");").append(JAXXCompilerHelper.getLineS=
eparator());
+            buffer.append("if (!(value instanceof jaxx.runtime.css.DataBindi=
ng)) {").append(JAXXCompilerHelper.getLineSeparator());
+            String unwrappedValue =3D unwrap(type, "value");
+            buffer.append("    ").append(handler.getSetPropertyCode(object.g=
etJavaCode(), property, "(" + JAXXCompilerHelper.getCanonicalName(type) +
+                    ") " + unwrappedValue, compiler)).append(JAXXCompilerHel=
per.getLineSeparator());
+            buffer.append("}").append(JAXXCompilerHelper.getLineSeparator());
+        }
+        compilePseudoClassRemove(pseudoClass, object, buffer.toString(), com=
piler);
+    }
+
+    public static Map<String, String> getApplicableProperties(Stylesheet s, =
CompiledObject object) throws CompilerException {
+        DefaultObjectHandler handler =3D TagManager.getTagHandler(object.get=
ObjectClass());
+        Map<String, String> result =3D null;
+        for (Rule rule : s.getRules()) {
+            int apply =3D appliesTo(rule, object);
+            if (apply =3D=3D Selector.ALWAYS_APPLIES || apply =3D=3D Selecto=
r.ALWAYS_APPLIES_INHERIT_ONLY) {
+                if (result =3D=3D null) {
+                    result =3D new HashMap<String, String>();
+                }
+                for (Map.Entry<String, String> entry : rule.getProperties().=
entrySet()) {
+                    String property =3D entry.getKey();
+                    if (apply =3D=3D Selector.ALWAYS_APPLIES || handler.isPr=
opertyInherited(property)) {
+                        result.put(property, entry.getValue());
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    public static Rule[] getApplicablePseudoClasses(Stylesheet s, CompiledOb=
ject object) throws CompilerException {
+        List<Rule> result =3D null;
+        for (Rule rule : s.getRules()) {
+            if (appliesTo(rule, object) =3D=3D Selector.PSEUDOCLASS_APPLIES)=
 {
+                if (result =3D=3D null) {
+                    result =3D new ArrayList<Rule>();
+                }
+                result.add(rule);
+            }
+        }
+        return result !=3D null ? result.toArray(new Rule[result.size()]) : =
null;
+    }
+
+    public static Rule inlineAttribute(CompiledObject object, String propert=
yName, boolean dataBinding) {
+        Map<String, String> properties =3D new HashMap<String, String>();
+        properties.put(propertyName, dataBinding ? Rule.DATA_BINDING : Rule.=
INLINE_ATTRIBUTE);
+        return new Rule(new Selector[]{new Selector(null, null, null, object=
.getId(), true)}, properties);
+    }
+
+    public static int appliesTo(Rule rule, CompiledObject object) throws Com=
pilerException {
+        int appliesTo =3D Selector.NEVER_APPLIES;
+        for (Selector selector : rule.getSelectors()) {
+            appliesTo =3D Math.max(appliesTo(selector, object), appliesTo);
+            if (appliesTo =3D=3D Selector.ALWAYS_APPLIES || appliesTo =3D=3D=
 Selector.ALWAYS_APPLIES_INHERIT_ONLY) {
+                break;
+            }
+        }
+        return appliesTo;
+    }
+
+    public static int appliesTo(Selector selector, CompiledObject object) {
+        boolean inheritOnly =3D false;
+        CompiledObject parent =3D object;
+        String javaClassName =3D selector.getJavaClassName();
+        String styleClass =3D selector.getStyleClass();
+        String pseudoClass =3D selector.getPseudoClass();
+        String id =3D selector.getId();
+
+        while (parent !=3D null) {
+            boolean classMatch =3D (javaClassName =3D=3D null);
+            if (!classMatch) {
+                ClassDescriptor javaClass =3D parent.getObjectClass();
+                do {
+                    String name =3D javaClass.getName();
+                    if (name.equals(javaClassName) || name.substring(name.la=
stIndexOf(".") + 1).equals(javaClassName)) {
+                        classMatch =3D true;
+                        break;
+                    }
+                    javaClass =3D javaClass.getSuperclass();
+                }
+                while (javaClass !=3D null);
+            }
+
+            boolean styleClassMatch =3D (styleClass =3D=3D null || styleClas=
s.equals(parent.getStyleClass()));
+
+            String objectId =3D parent.getId();
+            objectId =3D objectId.substring(objectId.lastIndexOf(".") + 1);
+            boolean idMatch =3D (id =3D=3D null || (' ' + objectId + ' ').in=
dexOf(' ' + id + ' ') > -1);
+
+            if (classMatch && styleClassMatch && idMatch) {
+                if (pseudoClass !=3D null) {
+                    return inheritOnly ? Selector.PSEUDOCLASS_APPLIES_INHERI=
T_ONLY : Selector.PSEUDOCLASS_APPLIES;
+                } else {
+                    return inheritOnly ? Selector.ALWAYS_APPLIES_INHERIT_ONL=
Y : Selector.ALWAYS_APPLIES;
+                }
+            }
+
+            parent =3D parent.getParent();
+            inheritOnly =3D true;
+        }
+        return Selector.NEVER_APPLIES;
+    }
+
+    public enum MouseEventEnum {
+        mouseover,
+        mouseout,
+        mousedown,
+        mouseup
+    }
+}

Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/DefaultObjectHand=
ler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/DefaultObjectHandler.ja=
va	2008-12-28 15:44:10 UTC (rev 1096)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/DefaultObjectHandler.ja=
va	2008-12-28 15:44:40 UTC (rev 1097)
@@ -11,6 +11,7 @@
 import jaxx.compiler.JavaArgument;
 import jaxx.compiler.JavaMethod;
 import jaxx.css.Stylesheet;
+import jaxx.css.StylesheetHelper;
 import jaxx.introspection.JAXXBeanInfo;
 import jaxx.introspection.JAXXEventSetDescriptor;
 import jaxx.introspection.JAXXIntrospector;
@@ -328,8 +329,8 @@
             if (propertyName !=3D null) {
                 try {
                     // check for property-specific addPropertyChangeListener=
 method
-                    getBeanClass().getMethodDescriptor("addPropertyChangeLis=
tener", new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(String=
.class),
-                            ClassDescriptorLoader.getClassDescriptor(Propert=
yChangeListener.class)});
+                    getBeanClass().getMethodDescriptor("addPropertyChangeLis=
tener", ClassDescriptorLoader.getClassDescriptor(String.class),
+                            ClassDescriptorLoader.getClassDescriptor(Propert=
yChangeListener.class));
                     return objectCode + ".addPropertyChangeListener(\"" + pr=
opertyName + "\", " + propertyChangeListenerCode + ");\n";
                 } catch (NoSuchMethodException e) {
                     // no property-specific method, use general one=20
@@ -359,7 +360,7 @@
             }
             try {
                 String modelMemberName =3D eventInfo.modelName !=3D null ? "=
get" + JAXXCompiler.capitalize(eventInfo.modelName) : null;
-                String modelClassName =3D modelMemberName !=3D null ? getBea=
nClass().getMethodDescriptor(modelMemberName, new ClassDescriptor[0]).getRetu=
rnType().getName() : JAXXCompiler.getCanonicalName(getBeanClass());
+                String modelClassName =3D modelMemberName !=3D null ? getBea=
nClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAX=
XCompiler.getCanonicalName(getBeanClass());
                 String code =3D objectCode + (eventInfo.modelName !=3D null =
? "." + modelMemberName + "()" : "");
                 result.append("((").append(modelClassName).append(") $bindin=
gSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMeth=
od).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass=
)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCan=
onicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRo=
otObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodN=
ame)).append("));\n");
                 if (eventInfo.modelName !=3D null) {
@@ -389,8 +390,8 @@
             if (propertyName !=3D null) {
                 try {
                     // check for property-specific removePropertyChangeListe=
ner method
-                    getBeanClass().getMethodDescriptor("removePropertyChange=
Listener", new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(Str=
ing.class),
-                            ClassDescriptorLoader.getClassDescriptor(Propert=
yChangeListener.class)});
+                    getBeanClass().getMethodDescriptor("removePropertyChange=
Listener", ClassDescriptorLoader.getClassDescriptor(String.class),
+                            ClassDescriptorLoader.getClassDescriptor(Propert=
yChangeListener.class));
                     return objectCode + ".removePropertyChangeListener(\"" +=
 propertyName + "\", " + propertyChangeListenerCode + ");\n";
                 } catch (NoSuchMethodException e) {
                     // no property-specific method, use general one=20
@@ -865,7 +866,7 @@
                     object.appendInitializationCode(child.getInitializationC=
ode(compiler));
                 }
             } else if (stylesheet !=3D null) {
-                stylesheet.applyTo(object, compiler, overrides);
+                StylesheetHelper.applyTo(object, compiler,stylesheet, overri=
des);
             }
         }
         catch (ClassNotFoundException e) {


--===============8526406087834712813==--


