Buix-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r1435 - in guix/trunk/guix-compiler/src/main/java/org/w3c: css/sac css/sac/helpers flute/parser/selectors flute/util
by kmorin@users.labs.libre-entreprise.org May 19, 2009
by kmorin@users.labs.libre-entreprise.org May 19, 2009
May 19, 2009
Author: kmorin
Date: 2009-05-19 08:39:48 +0000 (Tue, 19 May 2009)
New Revision: 1435
Added:
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties
Log:
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: SelectorList.java,v 1.1 1999/09/26 10:06:45 plehegar Exp $
+ */
+package org.w3c.css.sac;
+
+/**
+ * The SelectorList interface provides the abstraction of an ordered collection
+ * of selectors, without defining or constraining how this collection is
+ * implemented.
+ *
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public interface SelectorList {
+
+ /**
+ * Returns the length of this selector list
+ */
+ public int getLength();
+
+ /**
+ * Returns the selector at the specified index, or <code>null</code> if this
+ * is not a valid index.
+ */
+ public Selector item(int index);
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ParserFactory.java,v 1.1 2000/02/14 15:54:49 plehegar Exp $
+ */
+package org.w3c.css.sac.helpers;
+
+import org.w3c.css.sac.Parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class ParserFactory {
+
+ /**
+ * Create a parser with given selectors factory and conditions factory.
+ */
+ public Parser makeParser()
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ NullPointerException,
+ ClassCastException {
+ String className = System.getProperty("org.w3c.css.sac.parser");
+ if (className == null) {
+ throw new NullPointerException("No value for sac.parser property");
+ } else {
+ return (Parser)(Class.forName(className).newInstance());
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: AndConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.CombinatorCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class AndConditionImpl implements CombinatorCondition {
+
+ Condition firstCondition;
+ Condition secondCondition;
+
+ /**
+ * Creates a new AndConditionImpl
+ */
+ public AndConditionImpl(Condition firstCondition, Condition secondCondition) {
+ this.firstCondition = firstCondition;
+ this.secondCondition = secondCondition;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_AND_CONDITION;
+ }
+
+ /**
+ * Returns the first condition.
+ */
+ public Condition getFirstCondition() {
+ return firstCondition;
+ }
+
+ /**
+ * Returns the second condition.
+ */
+ public Condition getSecondCondition() {
+ return secondCondition;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: AttributeConditionImpl.java,v 1.2 2002/06/17 14:08:15 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class AttributeConditionImpl implements AttributeCondition {
+
+ String localName;
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public AttributeConditionImpl(String localName, String value) {
+ this.localName = localName;
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return false;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: BeginHyphenAttributeConditionImpl.java,v 1.2 2002/06/17 14:11:10 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class BeginHyphenAttributeConditionImpl implements AttributeCondition {
+
+ String localName;
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public BeginHyphenAttributeConditionImpl(String localName, String value) {
+ this.localName = localName;
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_BEGIN_HYPHEN_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return false;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ChildSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.DescendantSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class ChildSelectorImpl implements DescendantSelector {
+
+ Selector parent;
+ SimpleSelector child;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_CHILD_SELECTOR;
+ }
+
+ /**
+ * Creates a new ChildSelectorImpl
+ */
+ public ChildSelectorImpl(Selector parent, SimpleSelector child) {
+ this.parent = parent;
+ this.child = child;
+ }
+
+
+ /**
+ * Returns the parent selector.
+ */
+ public Selector getAncestorSelector() {
+ return parent;
+ }
+
+ /*
+ * Returns the simple selector.
+ */
+ public SimpleSelector getSimpleSelector() {
+ return child;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ClassConditionImpl.java,v 1.2 2002/06/17 14:10:28 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class ClassConditionImpl implements AttributeCondition {
+
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public ClassConditionImpl(String value) {
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_CLASS_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return false;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ConditionFactoryImpl.java,v 1.2 2002/06/17 14:12:38 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.LangCondition;
+import org.w3c.css.sac.ContentCondition;
+import org.w3c.css.sac.CombinatorCondition;
+import org.w3c.css.sac.PositionalCondition;
+import org.w3c.css.sac.NegativeCondition;
+import org.w3c.css.sac.ConditionFactory;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class ConditionFactoryImpl implements ConditionFactory {
+
+ /**
+ * Creates an and condition
+ *
+ * @param first the first condition
+ * @param second the second condition
+ * @return A combinator condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public CombinatorCondition createAndCondition(Condition first,
+ Condition second)
+ throws CSSException {
+ return new AndConditionImpl(first, second);
+ }
+
+ /**
+ * Creates an or condition
+ *
+ * @param first the first condition
+ * @param second the second condition
+ * @return A combinator condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public CombinatorCondition createOrCondition(Condition first,
+ Condition second)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a negative condition
+ *
+ * @param condition the condition
+ * @return A negative condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public NegativeCondition createNegativeCondition(Condition condition)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+
+ /**
+ * Creates a positional condition
+ *
+ * @param position the position of the node in the list.
+ * @param typeNode <code>true</code> if the list should contain
+ * only nodes of the same type (element, text node, ...).
+ * @param type <code>true</code> true if the list should contain
+ * only nodes of the same node (for element, same localName
+ * and same namespaceURI).
+ * @return A positional condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public PositionalCondition createPositionalCondition(int position,
+ boolean typeNode,
+ boolean type)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * creates an attribute condition
+ *
+ * @param localName the localName of the attribute
+ * @param namespaceURI the namespace URI of the attribute
+ * @param specified <code>true</code> if the attribute must be specified
+ * in the document.
+ * @param value the value of this attribute.
+ * @return An attribute condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createAttributeCondition(String localName,
+ String namespaceURI,
+ boolean specified,
+ String value)
+ throws CSSException {
+ if ((namespaceURI != null) || specified) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new AttributeConditionImpl(localName, value);
+ }
+ }
+
+ /**
+ * Creates an id condition
+ *
+ * @param value the value of the id.
+ * @return An Id condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createIdCondition(String value)
+ throws CSSException {
+ return new IdConditionImpl(value);
+ }
+
+ /**
+ * Creates a lang condition
+ *
+ * @param value the value of the language.
+ * @return A lang condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public LangCondition createLangCondition(String lang)
+ throws CSSException {
+ return new LangConditionImpl(lang);
+ }
+
+ /**
+ * Creates a "one of" attribute condition
+ *
+ * @param localName the localName of the attribute
+ * @param namespaceURI the namespace URI of the attribute
+ * @param specified <code>true</code> if the attribute must be specified
+ * in the document.
+ * @param value the value of this attribute.
+ * @return A "one of" attribute condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createOneOfAttributeCondition(String localName,
+ String namespaceURI,
+ boolean specified,
+ String value)
+ throws CSSException {
+ if ((namespaceURI != null) || specified) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new OneOfAttributeConditionImpl(localName, value);
+ }
+ }
+
+ /**
+ * Creates a "begin hyphen" attribute condition
+ *
+ * @param localName the localName of the attribute
+ * @param namespaceURI the namespace URI of the attribute
+ * @param specified <code>true</code> if the attribute must be specified
+ * in the document.
+ * @param value the value of this attribute.
+ * @return A "begin hyphen" attribute condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createBeginHyphenAttributeCondition(String localName,
+ String namespaceURI,
+ boolean specified,
+ String value)
+ throws CSSException {
+ if ((namespaceURI != null) || specified) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new BeginHyphenAttributeConditionImpl(localName, value);
+ }
+ }
+
+ /**
+ * Creates a class condition
+ *
+ * @param localName the localName of the attribute
+ * @param namespaceURI the namespace URI of the attribute
+ * @param specified <code>true</code> if the attribute must be specified
+ * in the document.
+ * @param value the name of the class.
+ * @return A class condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createClassCondition(String namespaceURI,
+ String value)
+ throws CSSException {
+ return new ClassConditionImpl(value);
+ }
+
+ /**
+ * Creates a pseudo class condition
+ *
+ * @param namespaceURI the namespace URI of the attribute
+ * @param value the name of the pseudo class
+ * @return A pseudo class condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public AttributeCondition createPseudoClassCondition(String namespaceURI,
+ String value)
+ throws CSSException {
+ return new PseudoClassConditionImpl(value);
+ }
+
+ /**
+ * Creates a "only one" child condition
+ *
+ * @return A "only one" child condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public Condition createOnlyChildCondition() throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a "only one" type condition
+ *
+ * @return A "only one" type condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public Condition createOnlyTypeCondition() throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a content condition
+ *
+ * @param data the data in the content
+ * @return A content condition
+ * @exception CSSException if this exception is not supported.
+ */
+ public ContentCondition createContentCondition(String data)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ConditionalSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.ConditionalSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class ConditionalSelectorImpl implements ConditionalSelector {
+
+ SimpleSelector simpleSelector;
+ Condition condition;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_CONDITIONAL_SELECTOR;
+ }
+
+
+ /**
+ * Creates a new ConditionalSelectorImpl
+ */
+ public ConditionalSelectorImpl(SimpleSelector simpleSelector,
+ Condition condition) {
+ this.simpleSelector = simpleSelector;
+ this.condition = condition;
+ }
+
+
+ /**
+ * Returns the simple selector.
+ * <p>The simple selector can't be a <code>ConditionalSelector</code>.</p>
+ */
+ public SimpleSelector getSimpleSelector() {
+ return simpleSelector;
+ }
+
+ /**
+ * Returns the condition to be applied on the simple selector.
+ */
+ public Condition getCondition() {
+ return condition;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: DescendantSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.DescendantSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class DescendantSelectorImpl implements DescendantSelector {
+
+ Selector parent;
+ SimpleSelector simpleSelector;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_DESCENDANT_SELECTOR;
+ }
+
+ /**
+ * Creates a new DescendantSelectorImpl
+ */
+ public DescendantSelectorImpl(Selector parent, SimpleSelector simpleSelector) {
+ this.parent = parent;
+ this.simpleSelector = simpleSelector;
+ }
+
+
+ /**
+ * Returns the parent selector.
+ */
+ public Selector getAncestorSelector() {
+ return parent;
+ }
+
+ /*
+ * Returns the simple selector.
+ */
+ public SimpleSelector getSimpleSelector() {
+ return simpleSelector;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: DirectAdjacentSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.SiblingSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class DirectAdjacentSelectorImpl implements SiblingSelector {
+
+ Selector child;
+ SimpleSelector directAdjacent;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_DIRECT_ADJACENT_SELECTOR;
+ }
+
+ /**
+ * Creates a new DescendantSelectorImpl
+ */
+ public DirectAdjacentSelectorImpl(Selector child,
+ SimpleSelector directAdjacent) {
+ this.child = child;
+ this.directAdjacent = directAdjacent;
+ }
+
+ public short getNodeType() {
+ return 1;
+ }
+
+ /**
+ * Returns the parent selector.
+ */
+ public Selector getSelector() {
+ return child;
+ }
+
+ /*
+ * Returns the simple selector.
+ */
+ public SimpleSelector getSiblingSelector() {
+ return directAdjacent;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: ElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class ElementSelectorImpl implements ElementSelector {
+
+ String localName;
+
+ /**
+ * Creates a new ElementSelectorImpl
+ */
+ public ElementSelectorImpl(String localName) {
+ this.localName = localName;
+ }
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_ELEMENT_NODE_SELECTOR;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this element selector.
+ * <p><code>NULL</code> if this element selector can match any namespace.</p>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this element.
+ * <p><code>NULL</code> if this element selector can match any element.</p>
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: IdConditionImpl.java,v 1.2 2002/06/17 14:08:28 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class IdConditionImpl implements AttributeCondition {
+
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public IdConditionImpl(String value) {
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ID_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return false;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: LangConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.LangCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class LangConditionImpl implements LangCondition {
+
+ String lang;
+
+ /**
+ * Creates a new LangConditionImpl
+ */
+ public LangConditionImpl(String lang) {
+ this.lang = lang;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_LANG_CONDITION;
+ }
+
+ /**
+ * Returns the language
+ */
+ public String getLang() {
+ return lang;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: OneOfAttributeConditionImpl.java,v 1.2 2002/06/17 14:09:59 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class OneOfAttributeConditionImpl implements AttributeCondition {
+
+ String localName;
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public OneOfAttributeConditionImpl(String localName, String value) {
+ this.localName = localName;
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_ONE_OF_ATTRIBUTE_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return false;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: PseudoClassConditionImpl.java,v 1.2 2002/06/17 14:08:37 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.AttributeCondition;
+import org.w3c.css.sac.Condition;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class PseudoClassConditionImpl implements AttributeCondition {
+
+ String value;
+
+ /**
+ * Creates a new AttributeConditionImpl
+ */
+ public PseudoClassConditionImpl(String value) {
+ this.value = value;
+ }
+
+ /**
+ * An integer indicating the type of <code>Condition</code>.
+ */
+ public short getConditionType() {
+ return Condition.SAC_PSEUDO_CLASS_CONDITION;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this attribute condition.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li>this attribute condition can match any namespace.
+ * <li>this attribute is an id attribute.
+ * </ul>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this attribute.
+ * <p><code>NULL</code> if :
+ * <ul>
+ * <li><p>this attribute condition can match any attribute.
+ * <li><p>this attribute is a class attribute.
+ * <li><p>this attribute is an id attribute.
+ * <li><p>this attribute is a pseudo-class attribute.
+ * </ul>
+ */
+ public String getLocalName() {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute must have an explicit value
+ * in the original document, <code>false</code> otherwise.
+ */
+ public boolean getSpecified() {
+ return true;
+ }
+
+ /**
+ * Returns the value of the attribute.
+ * If this attribute is a class or a pseudo class attribute, you'll get
+ * the class name (or psedo class name) without the '.' or ':'.
+ */
+ public String getValue() {
+ return value;
+ }
+}
+
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: PseudoElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class PseudoElementSelectorImpl implements ElementSelector {
+
+ String localName;
+
+ /**
+ * Creates a new ElementSelectorImpl
+ */
+ public PseudoElementSelectorImpl(String localName) {
+ this.localName = localName;
+ }
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType() {
+ return Selector.SAC_PSEUDO_ELEMENT_SELECTOR;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of this element selector.
+ * <p><code>NULL</code> if this element selector can match any namespace.</p>
+ */
+ public String getNamespaceURI() {
+ return null;
+ }
+
+ /**
+ * Returns the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a>
+ * of the
+ * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified
+ * name</a> of this element.
+ * <p><code>NULL</code> if this element selector can match any element.</p>
+ * </ul>
+ */
+ public String getLocalName() {
+ return localName;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: SelectorFactoryImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $
+ */
+package org.w3c.flute.parser.selectors;
+
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.ConditionalSelector;
+import org.w3c.css.sac.NegativeSelector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.ElementSelector;
+import org.w3c.css.sac.CharacterDataSelector;
+import org.w3c.css.sac.ProcessingInstructionSelector;
+import org.w3c.css.sac.SiblingSelector;
+import org.w3c.css.sac.DescendantSelector;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.CSSException;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class SelectorFactoryImpl implements SelectorFactory {
+
+ /**
+ * Creates a conditional selector.
+ *
+ * @param selector a selector.
+ * @param condition a condition
+ * @return the conditional selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public ConditionalSelector createConditionalSelector(SimpleSelector selector,
+ Condition condition)
+ throws CSSException {
+ return new ConditionalSelectorImpl(selector, condition);
+ }
+
+ /**
+ * Creates an any node selector.
+ *
+ * @return the any node selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public SimpleSelector createAnyNodeSelector() throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates an root node selector.
+ *
+ * @return the root node selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public SimpleSelector createRootNodeSelector() throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates an negative selector.
+ *
+ * @param selector a selector.
+ * @return the negative selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public NegativeSelector createNegativeSelector(SimpleSelector selector)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates an element selector.
+ *
+ * @param namespaceURI the <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of the element selector.
+ * @param tagName the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local
+ * part</a> of the element name. <code>NULL</code> if this element
+ * selector can match any element.</p>
+ * @return the element selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public ElementSelector createElementSelector(String namespaceURI, String localName)
+ throws CSSException {
+ if (namespaceURI != null) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new ElementSelectorImpl(localName);
+ }
+ }
+
+ /**
+ * Creates a text node selector.
+ *
+ * @param data the data
+ * @return the text node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public CharacterDataSelector createTextNodeSelector(String data)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a cdata section node selector.
+ *
+ * @param data the data
+ * @return the cdata section node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public CharacterDataSelector createCDataSectionSelector(String data)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a processing instruction node selector.
+ *
+ * @param target the target
+ * @param data the data
+ * @return the processing instruction node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public ProcessingInstructionSelector
+ createProcessingInstructionSelector(String target,
+ String data)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a comment node selector.
+ *
+ * @param data the data
+ * @return the comment node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public CharacterDataSelector createCommentSelector(String data)
+ throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Creates a pseudo element selector.
+ *
+ * @param pseudoName the pseudo element name. <code>NULL</code> if this
+ * element selector can match any pseudo element.</p>
+ * @return the element selector
+ * @exception CSSException If this selector is not supported.
+ */
+ public ElementSelector createPseudoElementSelector(String namespaceURI,
+ String pseudoName)
+ throws CSSException {
+ if (namespaceURI != null) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new PseudoElementSelectorImpl(pseudoName);
+ }
+ }
+
+ /**
+ * Creates a descendant selector.
+ *
+ * @param parent the parent selector
+ * @param descendant the descendant selector
+ * @return the combinator selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public DescendantSelector createDescendantSelector(Selector parent,
+ SimpleSelector descendant)
+ throws CSSException {
+ return new DescendantSelectorImpl(parent, descendant);
+ }
+
+ /**
+ * Creates a child selector.
+ *
+ * @param parent the parent selector
+ * @param child the child selector
+ * @return the combinator selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public DescendantSelector createChildSelector(Selector parent,
+ SimpleSelector child)
+ throws CSSException {
+ return new ChildSelectorImpl(parent, child);
+ }
+
+ /**
+ * Creates a direct adjacent selector.
+ *
+ * @param child the child selector
+ * @param adjacent the direct adjacent selector
+ * @return the combinator selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ public SiblingSelector createDirectAdjacentSelector(short nodeType,
+ Selector child,
+ SimpleSelector directAdjacent)
+ throws CSSException {
+ if (nodeType != 1) {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ } else {
+ return new DirectAdjacentSelectorImpl(child, directAdjacent);
+ }
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: Encoding.java,v 1.1 1999/04/02 13:23:32 plehegar Exp $
+ */
+package org.w3c.flute.util;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class Encoding {
+ private Encoding() {}
+
+ /**
+ * Converts the format encoding information into Java encoding information.
+ */
+ public static String getJavaEncoding(String encoding) {
+ String _result = encodings.getProperty(encoding);
+ if (_result == null) {
+ return encoding;
+ }
+ return _result;
+ }
+
+ static Properties encodings;
+
+ static {
+ encodings = new Properties();
+
+ try {
+ URL url = Encoding.class.getResource("encoding.properties");
+ InputStream f = url.openStream();
+ encodings.load(f);
+ f.close();
+ } catch (Exception e) {
+ System.err.println(Encoding.class
+ + ": couldn't load encoding properties ");
+ e.printStackTrace();
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties 2009-05-19 08:39:48 UTC (rev 1435)
@@ -0,0 +1,92 @@
+iso-ir-6 = ASCII
+ANSI_X3.4-1986 = ASCII
+ISO_646.irv:1991 = ASCII
+ASCII = ASCII
+ISO646-US = ASCII
+US-ASCII = ASCII
+us = ASCII
+IBM367 = ASCII
+cp367 = ASCII
+csASCII = ASCII
+
+iso-ir-100 = ISO8859_1
+ISO_8859-1:1987 = ISO8859_1
+ISO_8859-1 = ISO8859_1
+ISO-8859-1 = ISO8859_1
+latin1 = ISO8859_1
+l1 = ISO8859_1
+IBM819 = ISO8859_1
+CP819 = ISO8859_1
+csISOLatin1 = ISO8859_1
+
+iso-ir-101 = ISO8859_2
+ISO_8859-2:1987 = ISO8859_2
+ISO_8859-2 = ISO8859_2
+ISO-8859-2 = ISO8859_2
+latin2 = ISO8859_2
+l2 = ISO8859_2
+csISOLatin2 = ISO8859_2
+
+ISO_8859-3:1988 = ISO8859_3
+iso-ir-109 = ISO8859_3
+ISO_8859-3 = ISO8859_3
+ISO-8859-3 = ISO8859_3
+latin3 = ISO8859_3
+l3 = ISO8859_3
+csISOLatin3 = ISO8859_3
+
+iso-ir-110 = ISO8859_4
+ISO_8859-4:1988 = ISO8859_4
+ISO_8859-4 = ISO8859_4
+ISO-8859-4 = ISO8859_4
+latin4 = ISO8859_4
+l4 = ISO8859_4
+csISOLatin4 = ISO8859_4
+
+iso-ir-127 = ISO8859_6
+ISO_8859-6 = ISO8859_6
+ISO_8859-6:1987 = ISO8859_6
+ISO-8859-6 = ISO8859_6
+ECMA-114 = ISO8859_6
+ASMO-708 = ISO8859_6
+arabic = ISO8859_6
+csISOLatinArabic = ISO8859_6
+
+iso-ir-126 = ISO8859_7
+ISO_8859-7 = ISO8859_7
+ISO_8859-7:1987 = ISO8859_7
+ISO-8859-7 = ISO8859_7
+ELOT_928 = ISO8859_7
+ECMA-118 = ISO8859_7
+greek = ISO8859_7
+greek8 = ISO8859_7
+csISOLatinGreek = ISO8859_7
+
+ISO_8859-8:1988 = ISO8859_8
+iso-ir-138 = ISO8859_8
+ISO_8859-8 = ISO8859_8
+ISO-8859-8 = ISO8859_8
+hebrew = ISO8859_8
+csISOLatinHebrew = ISO8859_8
+
+ISO_8859-9:1989 = ISO8859_9
+iso-ir-148 = ISO8859_9
+ISO_8859-9 = ISO8859_9
+ISO-8859-9 = ISO8859_9
+latin5 = ISO8859_9
+l5 = ISO8859_9
+csISOLatin5 = ISO8859_9
+
+ISO_8859-15 = ISO8859_15_FDIS
+
+UTF-8 = UTF8
+
+Shift_JIS = SJIS
+MS_Kanji = SJIS
+csShiftJIS = SJIS
+
+EUC-JP = EUC_JP
+csEUCPkdFmtJapanese = EUC_JP
+Extended_UNIX_Code_Packed_Format_for_Japanese = EUC_JP
+
+csBig5 = Big5
1
0
r1434 - in guix/trunk/guix-test: . src/main/java/org/nuiton/guix src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org May 19, 2009
by kmorin@users.labs.libre-entreprise.org May 19, 2009
May 19, 2009
Author: kmorin
Date: 2009-05-19 08:39:27 +0000 (Tue, 19 May 2009)
New Revision: 1434
Added:
guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java
guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java
Modified:
guix/trunk/guix-test/pom.xml
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
Log:
Modified: guix/trunk/guix-test/pom.xml
===================================================================
--- guix/trunk/guix-test/pom.xml 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/pom.xml 2009-05-19 08:39:27 UTC (rev 1434)
@@ -25,6 +25,11 @@
<artifactId>spring-beans</artifactId>
<version>2.0.5</version>
</dependency>
+ <dependency>
+ <groupId>org.jdesktop</groupId>
+ <artifactId>beansbinding</artifactId>
+ <version>1.2.1</version>
+ </dependency>
</dependencies>
@@ -61,7 +66,7 @@
<guixFilesDir>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
<targetDirectory>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/target/generatedFiles/</targetDirectory>
<rootPackage>org.nuiton.guix</rootPackage>
- <mainClass>org.nuiton.guix.GuixDemo2</mainClass>
+ <mainClass>org.nuiton.guix.GuixDemo</mainClass>
</configuration>
<executions>
<execution>
Added: guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java (rev 0)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo.java 2009-05-19 08:39:27 UTC (rev 1434)
@@ -0,0 +1,144 @@
+package org.nuiton.guix;
+
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import org.nuiton.guix.GuixDemo2;
+import javax.swing.*;
+import java.awt.*;
+
+public class GuixDemo extends javax.swing.JFrame {
+ private org.jdesktop.beansbinding.BindingGroup bindingGroup;
+ private GuixDemo2 gd2;
+ private JLabel label;
+ private JPanel panel;
+ private JTextField textfield;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Statics methods --------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {public void run() {GuixDemo main = new GuixDemo();
+ main.pack();
+ main.setVisible(true);}});
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public GuixDemo() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
+ return bindingGroup;
+ }
+
+ public GuixDemo2 getGd2() {
+ return gd2;
+ }
+
+ public JLabel getLabel() {
+ return label;
+ }
+
+ public JPanel getPanel() {
+ return panel;
+ }
+
+ public JTextField getTextfield() {
+ return textfield;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
+ this.bindingGroup = newValue;
+ }
+
+ public void setGd2(GuixDemo2 newValue) {
+ this.gd2 = newValue;
+ }
+
+ public void setLabel(JLabel newValue) {
+ this.label = newValue;
+ }
+
+ public void setPanel(JPanel newValue) {
+ this.panel = newValue;
+ }
+
+ public void setTextfield(JTextField newValue) {
+ this.textfield = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void createComponents() {
+ this.setLayout(new FlowLayout());
+ createPanel();
+ createTextfield();
+ createLabel();
+ createGd2();
+ }
+
+ public void initComponents() {
+ this.setTitle("JAXX Demo");
+ this.setSize(300,200);
+ this.add(panel);
+ panel.add(textfield);
+ panel.add(label);
+ this.add(gd2);
+ }
+
+ public void initDataBinding() {
+ bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
+ bindingGroup.addBinding(
+ org.jdesktop.beansbinding.Bindings.createAutoBinding(
+ org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${gd2.button.selected}"),textfield,org.jdesktop.beansbinding.BeanProperty.create("enabled")));
+ bindingGroup.bind();
+ bindingGroup.addBinding(
+ org.jdesktop.beansbinding.Bindings.createAutoBinding(
+ org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,this,org.jdesktop.beansbinding.ELProperty.create("${textfield.text}"),label,org.jdesktop.beansbinding.BeanProperty.create("text")));
+ bindingGroup.bind();
+ }
+
+ public void initialize() {
+ createComponents();
+ initComponents();
+ initDataBinding();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ private void createGd2() {
+ gd2 = new GuixDemo2();
+ }
+
+ private void createLabel() {
+ label = new JLabel();
+ label.setForeground(Color.BLUE);
+
+ }
+
+ private void createPanel() {
+ panel = new JPanel();
+ }
+
+ private void createTextfield() {
+ textfield = new JTextField("test");
+ }
+
+}
\ No newline at end of file
Added: guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java (rev 0)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/GuixDemo2.java 2009-05-19 08:39:27 UTC (rev 1434)
@@ -0,0 +1,76 @@
+package org.nuiton.guix;
+
+import javax.swing.JToggleButton;
+import javax.swing.*;
+import java.awt.*;
+
+public class GuixDemo2 extends javax.swing.JPanel {
+ private org.jdesktop.beansbinding.BindingGroup bindingGroup;
+ private JToggleButton button;
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Constructors -----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public GuixDemo2() {
+ initialize();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public acessor methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public org.jdesktop.beansbinding.BindingGroup getBindingGroup() {
+ return bindingGroup;
+ }
+
+ public JToggleButton getButton() {
+ return button;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void setBindingGroup(org.jdesktop.beansbinding.BindingGroup newValue) {
+ this.bindingGroup = newValue;
+ }
+
+ public void setButton(JToggleButton newValue) {
+ this.button = newValue;
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- public mutator methods -------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ public void createComponents() {
+ this.setLayout(new FlowLayout());
+ createButton();
+ }
+
+ public void initComponents() {
+ this.add(button);
+ }
+
+ public void initDataBinding() {
+ bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
+ }
+
+ public void initialize() {
+ createComponents();
+ initComponents();
+ initDataBinding();
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- ui creation methods ----------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+
+ private void createButton() {
+ button = new JToggleButton();
+ button.setText("-Push me");
+ button.setSelected(false);
+ }
+
+}
\ No newline at end of file
Modified: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.css 2009-05-19 08:39:27 UTC (rev 1434)
@@ -1,5 +1,17 @@
-#display:{object . getText( ) . startsWith( "-" )}
+#button:{object . getText( ) . startsWith( "-" )}
{
foreground: red;
-}
+}
+#label
+{
+ background : blue;
+}
+
+
+.bold
+{
+ font : bold;
+ margin-top: 10px;
+}
+
Modified: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-19 08:39:17 UTC (rev 1433)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-19 08:39:27 UTC (rev 1434)
@@ -1,152 +1,9 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!-- test javadoc Application -->
-<Application title="JAXX Demo" width='1024' height='800' xmlns:swing='javax.swing.*'>
- <script><![CDATA[
-
-org.codelutin.i18n.I18n.init();
-
-void $afterCompleteSetup() {
- try { jaxx.runtime.SwingUtil.initNimbusLoookAndFeel(); } catch (Exception e) { log.error(e.getMessage(), e); }
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- int i=0;
- while( i < list.getRowCount()) {
- list.expandRow(i++);
- }
- }
- });
-}
-
-]]></script>
-
- <style><![CDATA[
-#table {
- border: { BorderFactory . createEmptyBorder( 4, 4, 4, 4 )
-}
-
-;
-font-face:
-
-"Trebuchet MS"
-;
-}
-
-#display {
- background: #BCE5AD;
- opaque: true;
- horizontalAlignment: right;
- border: { BorderFactory . createBevelBorder( BevelBorder . LOWERED )
-}
-
-;
-font-size:
-
-22
-;
-font-weight: bold
-
-;
-}
-]]></style>
- <!-- test javadoc $JSplitPane1 -->
- <swing:JSplitPane>
- <!-- JSplitPane dividerLocation='200' -->
- <swing:JScrollPane>
- <swing:JTree id='list' showsRootHandles='true'
- onValueChanged='cardLayout.show(preview, list.getSelectionValue() instanceof DemoPanel ? ((DemoPanel) list.getSelectionValue()).getLabel() : emptyDemo.getLabel())'
- cellRenderer='{new javax.swing.tree.DefaultTreeCellRenderer() {
- public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
- if (value instanceof DemoPanel)
- value = ((DemoPanel) value).getLabel();
- return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
- }
- }
- }'>
- <!-- test javadoc $item1 -->
- <item value="Components">
- <item value='Buttons'>
- <item value='{buttonDemo}'/>
- <item value='{checkBoxDemo}'/>
- <item value='{radioButtonDemo}'/>
- <item value='{toggleButtonDemo}'/>
- </item>
-
- <item value='Form elements'>
- <item value='Text'>
- <item value='{passwordFieldDemo}'/>
- <item value='{textFieldDemo}'/>
- <item value='{textAreaDemo}'/>
- </item>
-
- <item value='{comboBoxDemo}'/>
- <item value='{listDemo}'/>
- <item value='{sliderDemo}'/>
- <item value='{spinnerDemo}'/>
- </item>
-
- <item value='Layout components'>
- <item value='{splitPaneDemo}'/>
- </item>
-
- <item value='Menus'>
- <item value='{menuItemDemo}'/>
- <item value='{checkBoxMenuItemDemo}'/>
- <item value='{radioButtonMenuItemDemo}'/>
- </item>
-
- <item value='Windows'>
- <item value='{dialogDemo}'/>
- </item>
-
- <item value='{progressBarDemo}'/>
-
- </item>
-
- <item value='{labelStyleDemo}'/>
-
- <item value='{counterDemo}'/>
- <item value='{calculatorDemo}'/>
-
- <item value='New features'>
- <item value='Validation'>
- <item value='{validationDemo1}'/>
- <item value='{validationDemo2}'/>
- </item>
- <item value='{dataBindingDemo}'/>
- <item value='{boxedDecoratorDemo}'/>
- </item>
- </swing:JTree>
- </swing:JScrollPane>
- <java.awt.CardLayout id='cardLayout'/>
-<script source="scriptFile.script" />
- <Panel id='preview' layout='{cardLayout}'>
- <EmptyDemo id='emptyDemo' constraints='emptyDemo.getLabel()'/>
- <JButtonDemo id='buttonDemo' constraints='buttonDemo.getLabel()'/>
- <JCheckBoxDemo id='checkBoxDemo' constraints='checkBoxDemo.getLabel()'/>
- <JCheckBoxMenuItemDemo id='checkBoxMenuItemDemo' constraints='checkBoxMenuItemDemo.getLabel()'/>
- <JComboBoxDemo id='comboBoxDemo' constraints='comboBoxDemo.getLabel()'/>
- <JDialogDemo id='dialogDemo' constraints='dialogDemo.getLabel()'/>
- <JListDemo id='listDemo' constraints='listDemo.getLabel()'/>
- <JMenuItemDemo id='menuItemDemo' constraints='menuItemDemo.getLabel()'/>
- <JPasswordFieldDemo id='passwordFieldDemo' constraints='passwordFieldDemo.getLabel()'/>
- <JProgressBarDemo id='progressBarDemo' constraints='progressBarDemo.getLabel()'/>
- <JSliderDemo id='sliderDemo' constraints='sliderDemo.getLabel()'/>
- <JSpinnerDemo id='spinnerDemo' constraints='spinnerDemo.getLabel()'/>
- <JSplitPaneDemo id='splitPaneDemo' constraints='splitPaneDemo.getLabel()'/>
- <JRadioButtonDemo id='radioButtonDemo' constraints='radioButtonDemo.getLabel()'/>
- <JRadioButtonMenuItemDemo id='radioButtonMenuItemDemo' constraints='radioButtonMenuItemDemo.getLabel()'/>
- <JToggleButtonDemo id='toggleButtonDemo' constraints='toggleButtonDemo.getLabel()'/>
- <JTextFieldDemo id='textFieldDemo' constraints='textFieldDemo.getLabel()'/>
- <JTextAreaDemo id='textAreaDemo' constraints='textAreaDemo.getLabel()'/>
- <ValidationListDemo id='validationDemo1' constraints='validationDemo1.getLabel()'/>
- <ValidationTableDemo id='validationDemo2' constraints='validationDemo2.getLabel()'/>
- <BeanDataBindingDemo id='dataBindingDemo' constraints='dataBindingDemo.getLabel()'/>
- <LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/>
- <CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/>
- <CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/>
- <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/>
- </Panel>
- <style source="JButton.css" />
- </swing:JSplitPane>
-</Application>
+<swing:JFrame title="JAXX Demo" size="300,200" xmlns:swing='javax.swing.*'>
+ <swing:JPanel id="panel">
+ <swing:JTextField id="textfield" constructor='"test"' enabled="{gd2.getButton().isSelected()}" />
+ <swing:JLabel id="label" text="{textfield.getText()}" styleClass="bold" />
+ </swing:JPanel>
+ <GuixDemo2 id="gd2" />
+</swing:JFrame>
1
0
r1433 - guix/trunk/guix-runtime/src/test/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org May 19, 2009
by kmorin@users.labs.libre-entreprise.org May 19, 2009
May 19, 2009
Author: kmorin
Date: 2009-05-19 08:39:17 +0000 (Tue, 19 May 2009)
New Revision: 1433
Added:
guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java
Log:
Added: guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java
===================================================================
--- guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java (rev 0)
+++ guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/AppTest.java 2009-05-19 08:39:17 UTC (rev 1433)
@@ -0,0 +1,38 @@
+package org.nuiton.guix;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
1
0
r1432 - guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator
by kmorin@users.labs.libre-entreprise.org May 19, 2009
by kmorin@users.labs.libre-entreprise.org May 19, 2009
May 19, 2009
Author: kmorin
Date: 2009-05-19 08:39:07 +0000 (Tue, 19 May 2009)
New Revision: 1432
Modified:
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
Log:
Ajout du module (pas encore fonctionnel) guix-runtime
Modified: guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java 2009-05-19 08:39:00 UTC (rev 1431)
+++ guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java 2009-05-19 08:39:07 UTC (rev 1432)
@@ -8,11 +8,20 @@
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.nuiton.guix.databinding.BindingUtils;
import org.nuiton.guix.model.AttributeDescriptor;
+import org.nuiton.guix.model.Rule;
+import org.nuiton.guix.model.Selector;
+import org.nuiton.guix.model.StyleSheet;
/**
*
@@ -20,12 +29,16 @@
*/
public class SwingFileGenerator extends JavaFileGenerator {
+ List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
+
public SwingFileGenerator(GuixModelObject gmo) {
super(gmo);
jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
Modifier.PUBLIC,
gmo.getClassDescriptor().getName(),
null);
+ if(gmo.getStyleSheets() != null)
+ styleSheets.addAll(gmo.getStyleSheets());
}
@Override
@@ -82,11 +95,10 @@
if (gmo.getParent() != null) {
String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
- StringBuffer creationMethod = new StringBuffer(gmo.getId()).append(" = new ").append(gmo.getClassDescriptor().getName()).append("();");
- jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
+ StringBuffer creationMethod = new StringBuffer();
+ creationMethod.append(gmo.getId()).append(" = new ").append(gmo.getClassDescriptor().getName()).append("(").append(gmo.getConstructor() != null ? gmo.getConstructor() : ""). append(");\n");
componentsCreation.append("create").append(capitalizedId).append("();\n");
-
componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId()).append(");\n");
for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
@@ -101,23 +113,78 @@
addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("get" + capitalizedAttribute, null).getReturnType().equals(String.class);
}
catch (ClassNotFoundException ex) {
- log.error(ex);
+ if(log.isErrorEnabled())
+ log.error(ex);
}
catch (NoSuchMethodException ex) {
try {
addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("is" + capitalizedAttribute, null).getReturnType().equals(String.class);
}
catch (ClassNotFoundException ex2) {
- log.error(ex2);
+ if(log.isErrorEnabled())
+ log.error(ex2);
}
catch (NoSuchMethodException ex2) {
- log.error(ex2);
+ if(log.isErrorEnabled())
+ log.error(ex2);
}
}
- componentsTree.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ creationMethod.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
}
}
+
+ if(gmo.getStyleSheets() != null)
+ styleSheets.addAll(gmo.getStyleSheets());
+ for(StyleSheet ss : styleSheets) {
+ for(Selector sel : ss.getSelectors()) {
+ if((sel.getJavaClassName() == null || sel.getJavaClassName().equals(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()))
+ && (sel.getId() == null || sel.getId().equals(gmo.getId()))
+ //&& sel.getPseudoClass().equals("")
+ && (sel.getStyleClass() == null || sel.getStyleClass().equals(gmo.getStyleClass()))) {
+ for(Rule rule : sel.getRules()) {
+ for(Entry<String,String> entry : rule.getProperties().entrySet()) {
+ String capitalizedAttribute = (entry.getKey().length() > 0) ? Character.toUpperCase(entry.getKey().charAt(0)) + entry.getKey().substring(1) : entry.getKey();
+ creationMethod.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(entry.getValue()).append(");\n");
+ }
+ }
+ }
+ }
+ }
+ jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
}
+ else {
+ for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
+ String binding = BindingUtils.processDataBindings(attr.getValue());
+ if (binding != null) {
+ bindings.append("bindingGroup.addBinding(\n").append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\norg.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,").append("this").append(",org.jdesktop.beansbinding.ELProperty.create(\"${").append(binding).append("}\"),").append(gmo.getId()).append(",org.jdesktop.beansbinding.BeanProperty.create(\"").append(attr.getName()).append("\")").append("));\n").append("bindingGroup.bind();\n");
+ }
+ else {
+ String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
+ boolean addQuote = false;
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName()).getMethod("get" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex) {
+ if(log.isErrorEnabled())
+ log.error(ex);
+ }
+ catch (NoSuchMethodException ex) {
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName()).getMethod("is" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex2) {
+ if(log.isErrorEnabled())
+ log.error(ex2);
+ }
+ catch (NoSuchMethodException ex2) {
+ if(log.isErrorEnabled())
+ log.error(ex2);
+ }
+ }
+ componentsTree.append("this.set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ }
+ }
+ }
for (GuixModelObject child : gmo.getChildren()) {
Map<String, String> methodBodies = browseModelObjects(child);
componentsCreation.append(methodBodies.get("componentsCreation"));
1
0
r1431 - in guix/trunk/guix-compiler/src/main/java: . org org/nuiton/guix/compiler org/nuiton/guix/model org/nuiton/guix/tags org/w3c org/w3c/css org/w3c/flute org/w3c/flute/parser
by kmorin@users.labs.libre-entreprise.org May 19, 2009
by kmorin@users.labs.libre-entreprise.org May 19, 2009
May 19, 2009
Author: kmorin
Date: 2009-05-19 08:39:00 +0000 (Tue, 19 May 2009)
New Revision: 1431
Added:
guix/trunk/guix-compiler/src/main/java/org/w3c/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/
guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/
guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/
Modified:
guix/trunk/guix-compiler/src/main/java/
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
Log:
Ajout du module (pas encore fonctionnel) guix-runtime
Property changes on: guix/trunk/guix-compiler/src/main/java
___________________________________________________________________
Name: svn:ignore
+ .fr-UIndVX
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -137,8 +137,8 @@
String tagPackageName = resolvePackageName(tagNameSpace, xpp.getName());
// creation of the root GuixModelObject
- rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), doc.toString(),
- xpp.getAttributeValue("", "styleClass"));
+ rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), xpp.getAttributeValue("", "constructor"),
+ doc.toString(), xpp.getAttributeValue("", "styleClass"));
// the class name is the name of the file minus the extension
String className = src.getName().substring(0, src.getName().lastIndexOf('.'));
@@ -285,7 +285,8 @@
: "$" + tagName + index++);
// create the GuixModelObject representing the tag
- GuixModelObject mo = new GuixModelObject(id, javaDoc, xpp.getAttributeValue("", "styleClass"));
+ GuixModelObject mo = new GuixModelObject(id, xpp.getAttributeValue("", "constructor"),
+ javaDoc, xpp.getAttributeValue("", "styleClass"));
mo.setParent(previousMO);
mo.setAttributeDescriptors(getAttributes(xpp));
@@ -389,7 +390,8 @@
List<AttributeDescriptor> result = new ArrayList<AttributeDescriptor>();
for (int i = 0; i < xpp.getAttributeCount(); i++) {
- if (!xpp.getAttributeName(i).equals("id")) {
+ if (!xpp.getAttributeName(i).equals("id") && !xpp.getAttributeName(i).equals("constructor")
+ && !xpp.getAttributeName(i).equals("styleClass")) {
result.add(new AttributeDescriptor(xpp.getAttributeName(i), xpp.getAttributeValue(i)));
}
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -30,6 +30,9 @@
/** The id of the object */
private String id;
+ /** The contructor parameters fro this object */
+ private String constructor;
+
/** The javaDoc of the object */
private String javadoc;
@@ -46,8 +49,9 @@
* @param javadoc the javadoc of the object
* @param styleClass the styleclass of the object
*/
- public GuixModelObject(String id, String javadoc, String styleClass) {
+ public GuixModelObject(String id, String constructor, String javadoc, String styleClass) {
this.id = id;
+ this.constructor = constructor;
this.javadoc = javadoc;
this.styleClass = styleClass;
}
@@ -84,6 +88,14 @@
this.id = id;
}
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public void setConstructor(String constructor) {
+ this.constructor = constructor;
+ }
+
public GuixModelObject getParent() {
return parent;
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-18 15:54:21 UTC (rev 1430)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -1,7 +1,8 @@
package org.nuiton.guix.tags;
//~--- non-JDK imports --------------------------------------------------------
-
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -13,24 +14,26 @@
import org.nuiton.guix.model.Rule;
import org.nuiton.guix.model.Selector;
import org.nuiton.guix.model.StyleSheet;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.Parser;
+import org.w3c.css.sac.helpers.ParserFactory;
+import org.w3c.flute.parser.ParserConstants;
+;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
//~--- JDK imports ------------------------------------------------------------
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
/**
* Handles the <code><style></code> tag.
*
@@ -40,7 +43,6 @@
/** log */
protected static final Log log = LogFactory.getLog(TagManager.class);
-
/** List of the selectors */
private List<Selector> selectors = new ArrayList<Selector>();
@@ -54,9 +56,9 @@
*/
private String loadStyleFile(File styleFile) throws FileNotFoundException, IOException {
StringWriter styleBuffer = new StringWriter();
- FileReader in = new FileReader(styleFile);
- char[] readBuffer = new char[2048];
- int c;
+ FileReader in = new FileReader(styleFile);
+ char[] readBuffer = new char[2048];
+ int c;
while ((c = in.read(readBuffer)) > 0) {
styleBuffer.write(readBuffer, 0, c);
@@ -95,8 +97,8 @@
* while parsing the guix file
*/
public StyleSheet compileStyle(XmlPullParser xpp, File styleFile) throws IOException, XmlPullParserException {
- StyleSheet result = null;
- StringBuffer style = new StringBuffer();
+ StyleSheet result = null;
+ StringBuffer style = new StringBuffer();
if ((styleFile != null) && styleFile.exists()) {
style.append(loadStyleFile(styleFile));
@@ -106,21 +108,21 @@
do {
switch (xpp.getEventType()) {
- case XmlPullParser.START_TAG :
- if (log.isWarnEnabled()) {
- log.warn("<style> tag may not contain child elements: " + xpp.getName());
- }
+ case XmlPullParser.START_TAG:
+ if (log.isWarnEnabled()) {
+ log.warn("<style> tag may not contain child elements: " + xpp.getName());
+ }
- break;
+ break;
- case XmlPullParser.TEXT :
- break; // fall through
+ case XmlPullParser.TEXT:
+ break; // fall through
- case XmlPullParser.CDSECT :
- style.append(xpp.getText());
- xpp.nextToken();
+ case XmlPullParser.CDSECT:
+ style.append(xpp.getText());
+ xpp.nextToken();
- break;
+ break;
}
} while ((xpp.getEventType() != XmlPullParser.END_TAG) && (!xpp.getName().equals("style")));
@@ -145,44 +147,44 @@
}
String javaClassName = null;
- String styleClass = null;
- String pseudoClass = null;
- String id = null;
+ String styleClass = null;
+ String pseudoClass = null;
+ String id = null;
for (int i = 0; i < selector.jjtGetNumChildren(); i++) {
SimpleNode child = selector.getChild(i);
switch (child.getId()) {
- // class
- case CSSParserTreeConstants.JJTJAVACLASS :
- if (!child.getText().trim().equals("*")) {
- javaClassName = child.getText();
- }
+ // class
+ case CSSParserTreeConstants.JJTJAVACLASS:
+ if (!child.getText().trim().equals("*")) {
+ javaClassName = child.getText();
+ }
- break;
+ break;
- // styleclass
- case CSSParserTreeConstants.JJTCLASS :
- styleClass = child.getText().substring(1);
+ // styleclass
+ case CSSParserTreeConstants.JJTCLASS:
+ styleClass = child.getText().substring(1);
- break;
+ break;
- // pseudoclass
- case CSSParserTreeConstants.JJTPSEUDOCLASS :
- pseudoClass = child.getText().substring(1);
+ // pseudoclass
+ case CSSParserTreeConstants.JJTPSEUDOCLASS:
+ pseudoClass = child.getText().substring(1);
- break;
+ break;
- // id
- case CSSParserTreeConstants.JJTID :
- id = child.getText().substring(1);
+ // id
+ case CSSParserTreeConstants.JJTID:
+ id = child.getText().substring(1);
- break;
+ break;
- // error if other
- default :
- throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
+ // error if other
+ default:
+ throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
}
}
@@ -211,7 +213,7 @@
// analyses each selector
for (int i = 0; i < selectorsNode.jjtGetNumChildren(); i++) {
SimpleNode selectorNode = selectorsNode.getChild(i);
- Selector selector = processSelector(selectorNode);
+ Selector selector = processSelector(selectorNode);
ruleSelectors.add(selector);
@@ -228,11 +230,11 @@
SimpleNode declarationNode = ruleNode.getChild(i);
if (declarationNode.getId() == CSSParserTreeConstants.JJTDECLARATION) {
- String key = declarationNode.getChild(0).getText();
+ String key = declarationNode.getChild(0).getText();
SimpleNode valueNode = declarationNode.getChild(1);
- String value = valueNode.getText();
+ String value = valueNode.getText();
- if (valueNode.firstToken.kind == CSSParserConstants.STRING) {
+ if (valueNode.firstToken.kind == ParserConstants.STRING) {
value = value.substring(1, value.length() - 1);
}
@@ -260,34 +262,39 @@
* @param stylesheetText the content of the CSS file or the style tag
* @return the StyleSheet containing the rules of the CSS file or the style tag
*/
- protected StyleSheet processStylesheet(String stylesheetText) {
-
- // parses the CSS
- CSSParser p = new CSSParser(new StringReader(stylesheetText));
- SimpleNode node;
-
+ protected StyleSheet processStylesheet(String stylesheetText) throws IOException {
try {
- node = p.Stylesheet();
- } catch (ParseException ex) {
- throw ex;
- }
+ Parser p = new org.w3c.flute.parser.Parser();
+ p.parseStyleSheet(new InputSource(new StringReader(stylesheetText)));
- List<Rule> rules = new ArrayList<Rule>();
+ // parses the CSS
+ /* CSSParser p = new CSSParser(new StringReader(stylesheetText));
- // analyses each rule
- for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode node = p.Stylesheet();*/
+ List<Rule> rules = new ArrayList<Rule>();
+
+ // analyses each rule
+ /*for (int i = 0; i < node.jjtGetNumChildren(); i++) {
SimpleNode ruleNode = node.getChild(i);
Rule rule = processRule(ruleNode);
rules.add(rule);
- }
+ }*/
- StyleSheet styleSheet = new StyleSheet();
+ StyleSheet styleSheet = new StyleSheet();
- styleSheet.setRules(rules);
- styleSheet.setSelectors(selectors);
+ styleSheet.setRules(rules);
+ styleSheet.setSelectors(selectors);
- return styleSheet;
+ return styleSheet;
+ }
+ catch (Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ ex.printStackTrace();
+ }
+ }
+ return null;
}
/**
@@ -298,30 +305,16 @@
*/
private boolean selectorRecorded(Selector newSelector) {
for (Selector selector : selectors) {
- boolean areJavaClassNamesNull = (newSelector.getJavaClassName() == null)
- && (selector.getJavaClassName() == null);
- boolean areJavaClassNamesNotNull = (newSelector.getJavaClassName() != null)
- && (selector.getJavaClassName() != null);
- boolean areStyleClassesNull = (newSelector.getStyleClass() == null)
- && (selector.getStyleClass() == null);
- boolean areStyleClassesNotNull = (newSelector.getStyleClass() != null)
- && (selector.getStyleClass() != null);
- boolean arePseudoClassesNull = (newSelector.getPseudoClass() == null)
- && (selector.getPseudoClass() == null);
- boolean arePseudoClassesNotNull = (newSelector.getPseudoClass() != null)
- && (selector.getPseudoClass() != null);
- boolean areIdsNull = (newSelector.getId() == null) && (selector.getId() == null);
+ boolean areJavaClassNamesNull = (newSelector.getJavaClassName() == null) && (selector.getJavaClassName() == null);
+ boolean areJavaClassNamesNotNull = (newSelector.getJavaClassName() != null) && (selector.getJavaClassName() != null);
+ boolean areStyleClassesNull = (newSelector.getStyleClass() == null) && (selector.getStyleClass() == null);
+ boolean areStyleClassesNotNull = (newSelector.getStyleClass() != null) && (selector.getStyleClass() != null);
+ boolean arePseudoClassesNull = (newSelector.getPseudoClass() == null) && (selector.getPseudoClass() == null);
+ boolean arePseudoClassesNotNull = (newSelector.getPseudoClass() != null) && (selector.getPseudoClass() != null);
+ boolean areIdsNull = (newSelector.getId() == null) && (selector.getId() == null);
boolean areIdsNotNull = (newSelector.getId() != null) && (selector.getId() != null);
- if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName()
- .equals(selector
- .getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector
- .getStyleClass()
- .equals(selector
- .getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector
- .getPseudoClass()
- .equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector
- .getId().equals(selector.getId())))) {
+ if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName().equals(selector.getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector.getStyleClass().equals(selector.getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector.getPseudoClass().equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector.getId().equals(selector.getId())))) {
return true;
}
}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/CharStream.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,110 @@
+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 0.7pre6 */
+package org.w3c.flute.parser;
+
+/**
+ * This interface describes a character stream that maintains line and
+ * column number positions of the characters. It also has the capability
+ * to backup the stream to some extent. An implementation of this
+ * interface is used in the TokenManager implementation generated by
+ * JavaCCParser.
+ *
+ * All the methods except backup can be implemented in any fashion. backup
+ * needs to be implemented correctly for the correct operation of the lexer.
+ * Rest of the methods are all used to get information like line number,
+ * column number and the String that constitutes a token and are not used
+ * by the lexer. Hence their implementation won't affect the generated lexer's
+ * operation.
+ */
+
+abstract public interface CharStream {
+
+ /**
+ * Returns the next character from the selected input. The method
+ * of selecting the input is the responsibility of the class
+ * implementing this interface. Can throw any java.io.IOException.
+ */
+ abstract public char readChar() throws java.io.IOException;
+
+ /**
+ * Returns the column position of the character last read.
+ * @deprecated
+ * @see #getEndColumn
+ */
+ abstract public int getColumn();
+
+ /**
+ * Returns the line number of the character last read.
+ * @deprecated
+ * @see #getEndLine
+ */
+ abstract public int getLine();
+
+ /**
+ * Returns the column number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getEndColumn();
+
+ /**
+ * Returns the line number of the last character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getEndLine();
+
+ /**
+ * Returns the column number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getBeginColumn();
+
+ /**
+ * Returns the line number of the first character for current token (being
+ * matched after the last call to BeginTOken).
+ */
+ abstract public int getBeginLine();
+
+ /**
+ * Backs up the input stream by amount steps. Lexer calls this method if it
+ * had already read some characters, but could not use them to match a
+ * (longer) token. So, they will be used again as the prefix of the next
+ * token and it is the implemetation's responsibility to do this right.
+ */
+ abstract public void backup(int amount);
+
+ /**
+ * Returns the next character that marks the beginning of the next token.
+ * All characters must remain in the buffer between two successive calls
+ * to this method to implement backup correctly.
+ */
+ abstract public char BeginToken() throws java.io.IOException;
+
+ /**
+ * Returns a string made up of characters from the marked token beginning
+ * to the current buffer position. Implementations have the choice of returning
+ * anything that they want to. For example, for efficiency, one might decide
+ * to just return null, which is a valid implementation.
+ */
+ abstract public String GetImage();
+
+ /**
+ * Returns an array of characters that make up the suffix of length 'len' for
+ * the currently matched token. This is used to build up the matched string
+ * for use in actions in the case of MORE. A simple and inefficient
+ * implementation of this is as follows :
+ *
+ * {
+ * String t = GetImage();
+ * return t.substring(t.length() - len, t.length()).toCharArray();
+ * }
+ */
+ abstract public char[] GetSuffix(int len);
+
+ /**
+ * The lexer calls this function to indicate that it is done with the stream
+ * and hence implementations can free any resources held by this class.
+ * Again, the body of this function can be just empty and it will not
+ * affect the lexer's operation.
+ */
+ abstract public void Done();
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Generic_CharStream.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,355 @@
+/* Generated By:JavaCC: Do not edit this line. Generic_CharStream.java Version 0.7pre6 */
+package org.w3c.flute.parser;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class Generic_CharStream implements CharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader reader;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = reader.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ reader.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = (char)((char)0xff & buffer[bufpos]);
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public Generic_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ reader = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public Generic_CharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ reader = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/JumpException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,22 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: JumpException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+public class JumpException extends RuntimeException {
+ /**
+ * Creates a new JumpException
+ */
+ public JumpException() {
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LexicalUnitImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LexicalUnitImpl.java,v 1.3 2000/02/15 02:08:19 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.LexicalUnit;
+
+/**
+ * @version $Revision: 1.3 $
+ * @author Philippe Le Hegaret
+ */
+class LexicalUnitImpl implements LexicalUnit {
+
+ LexicalUnit prev;
+ LexicalUnit next;
+
+ short type;
+ int line;
+ int column;
+
+ int i;
+ float f;
+ short dimension;
+ String sdimension;
+ String s;
+ String fname;
+ LexicalUnitImpl params;
+
+ LexicalUnitImpl(short type, int line, int column, LexicalUnitImpl p) {
+ if (p != null) {
+ prev = p;
+ p.next = this;
+ }
+ this.line = line;
+ this.column = column -1;
+ this.type = type;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous, int i) {
+ this(SAC_INTEGER, line, column, previous);
+ this.i = i;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous,
+ short dimension, String sdimension, float f) {
+ this(dimension, line, column, previous);
+ this.f = f;
+ this.dimension = dimension;
+ this.sdimension = sdimension;
+ }
+
+ LexicalUnitImpl(int line, int column, LexicalUnitImpl previous,
+ short type, String s) {
+ this(type, line, column, previous);
+ this.s = s;
+ }
+
+ LexicalUnitImpl(short type, int line, int column,
+ LexicalUnitImpl previous, String fname,
+ LexicalUnitImpl params) {
+ this(type, line, column, previous);
+ this.fname = fname;
+ this.params = params;
+ }
+
+
+
+ public int getLineNumber() {
+ return line;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public short getLexicalUnitType() {
+ return type;
+ }
+
+ public LexicalUnit getNextLexicalUnit() {
+ return next;
+ }
+
+ public LexicalUnit getPreviousLexicalUnit() {
+ return prev;
+ }
+
+ public int getIntegerValue() {
+ return i;
+ }
+
+ void setIntegerValue(int i) {
+ this.i = i;
+ }
+
+ public float getFloatValue() {
+ return f;
+ }
+
+ void setFloatValue(float f) {
+ this.f = f;
+ }
+
+ public String getDimensionUnitText() {
+ switch (type) {
+ case SAC_PERCENTAGE:
+ return "%";
+ case SAC_EM:
+ return "em";
+ case SAC_EX:
+ return "ex";
+ case SAC_PIXEL:
+ return "px";
+ case SAC_CENTIMETER:
+ return "cm";
+ case SAC_MILLIMETER:
+ return "mm";
+ case SAC_INCH:
+ return "in";
+ case SAC_POINT:
+ return "pt";
+ case SAC_PICA:
+ return "pc";
+ case SAC_DEGREE:
+ return "deg";
+ case SAC_RADIAN:
+ return "rad";
+ case SAC_GRADIAN:
+ return "grad";
+ case SAC_MILLISECOND:
+ return "ms";
+ case SAC_SECOND:
+ return "s";
+ case SAC_HERTZ:
+ return "Hz";
+ case SAC_KILOHERTZ:
+ return "kHz";
+ case SAC_DIMENSION:
+ return sdimension;
+ default:
+ throw new IllegalStateException("invalid dimension " + type);
+ }
+ }
+
+ public String getStringValue() {
+ return s;
+ }
+
+ public String getFunctionName() {
+ return fname;
+ }
+
+ public org.w3c.css.sac.LexicalUnit getParameters() {
+ return params;
+ }
+
+ public org.w3c.css.sac.LexicalUnit getSubValues() {
+ return params;
+ }
+
+ public String toString() {
+ String text;
+ switch (type) {
+ case SAC_OPERATOR_COMMA:
+ text = ",";
+ break;
+ case SAC_OPERATOR_PLUS:
+ text = "+";
+ break;
+ case SAC_OPERATOR_MINUS:
+ text = "-";
+ break;
+ case SAC_OPERATOR_MULTIPLY:
+ text = "*";
+ break;
+ case SAC_OPERATOR_SLASH:
+ text = "/";
+ break;
+ case SAC_OPERATOR_MOD:
+ text = "%";
+ break;
+ case SAC_OPERATOR_EXP:
+ text = "^";
+ break;
+ case SAC_OPERATOR_LT:
+ text = "<";
+ break;
+ case SAC_OPERATOR_GT:
+ text = ">";
+ break;
+ case SAC_OPERATOR_LE:
+ text = "<=";
+ break;
+ case SAC_OPERATOR_GE:
+ text = "=>";
+ break;
+ case SAC_OPERATOR_TILDE:
+ text = "~";
+ break;
+ case SAC_INHERIT:
+ text = "inherit";
+ break;
+ case SAC_INTEGER:
+ text = Integer.toString(i, 10);
+ break;
+ case SAC_REAL:
+ text = f + "";
+ break;
+ case SAC_EM:
+ case SAC_EX:
+ case SAC_PIXEL:
+ case SAC_INCH:
+ case SAC_CENTIMETER:
+ case SAC_MILLIMETER:
+ case SAC_POINT:
+ case SAC_PICA:
+ case SAC_PERCENTAGE:
+ case SAC_DEGREE:
+ case SAC_GRADIAN:
+ case SAC_RADIAN:
+ case SAC_MILLISECOND:
+ case SAC_SECOND:
+ case SAC_HERTZ:
+ case SAC_KILOHERTZ:
+ case SAC_DIMENSION:
+ String fs = null;
+ int i = (int) f;
+ if (((float) i) == f) {
+ text = i + getDimensionUnitText();
+ } else {
+ text = f + getDimensionUnitText();
+ }
+ break;
+ case SAC_URI:
+ text = "uri(" + s + ")";
+ break;
+ case SAC_COUNTER_FUNCTION:
+ case SAC_COUNTERS_FUNCTION:
+ case SAC_RGBCOLOR:
+ case SAC_RECT_FUNCTION:
+ case SAC_FUNCTION:
+ text = getFunctionName() + "(" + getParameters() + ")";
+ break;
+ case SAC_IDENT:
+ text = "attr(" + getStringValue() + ")";
+ break;
+ case SAC_STRING_VALUE:
+ // @@SEEME. not exact
+ text = "\"" + getStringValue() + "\"";
+ break;
+ case SAC_ATTR:
+ text = "attr(" + getStringValue() + ")";
+ break;
+ case SAC_UNICODERANGE:
+ text = "@@TODO";
+ break;
+ case SAC_SUB_EXPRESSION:
+ text = getSubValues().toString();
+ break;
+ default:
+ text = "@unknown";
+ break;
+ }
+ if (next != null) {
+ return text + ' ' + next;
+ } else {
+ return text;
+ }
+ }
+
+ // here some useful function for creation
+ static LexicalUnitImpl createNumber(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ int i = (int) v;
+ if (v == ((float) i)) {
+ return new LexicalUnitImpl(line, column, previous, i);
+ } else {
+ return new LexicalUnitImpl(line, column, previous, SAC_REAL, "", v);
+ }
+ }
+ static LexicalUnitImpl createInteger(int line, int column,
+ LexicalUnitImpl previous, int i) {
+ return new LexicalUnitImpl(line, column, previous, i);
+ }
+ static LexicalUnitImpl createPercentage(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_PERCENTAGE, null, v);
+ }
+ static LexicalUnitImpl createEMS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_EM, null, v);
+ }
+ static LexicalUnitImpl createEXS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_EX, null, v);
+ }
+ static LexicalUnitImpl createPX(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_PIXEL,
+ null, v);
+ }
+ static LexicalUnitImpl createCM(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_CENTIMETER, null, v);
+ }
+ static LexicalUnitImpl createMM(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_MILLIMETER, null, v);
+ }
+ static LexicalUnitImpl createIN(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_INCH,
+ null, v);
+ }
+ static LexicalUnitImpl createPT(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_POINT,
+ null, v);
+ }
+ static LexicalUnitImpl createPC(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_PICA,
+ null, v);
+ }
+ static LexicalUnitImpl createDEG(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_DEGREE,
+ null, v);
+ }
+ static LexicalUnitImpl createRAD(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_RADIAN,
+ null, v);
+ }
+ static LexicalUnitImpl createGRAD(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ return new LexicalUnitImpl(line, column, previous, SAC_GRADIAN,
+ null, v);
+ }
+ static LexicalUnitImpl createMS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Time values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_MILLISECOND, null, v);
+ }
+ static LexicalUnitImpl createS(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Time values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_SECOND,
+ null, v);
+ }
+ static LexicalUnitImpl createHZ(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Frequency values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous, SAC_HERTZ,
+ null, v);
+ }
+ static LexicalUnitImpl createKHZ(int line, int column,
+ LexicalUnitImpl previous, float v) {
+ if (v < 0) {
+ throw new ParseException("Frequency values may not be negative");
+ }
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_KILOHERTZ, null, v);
+ }
+ static LexicalUnitImpl createDimen(int line, int column,
+ LexicalUnitImpl previous,
+ float v, String s) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_DIMENSION, s, v);
+ }
+ static LexicalUnitImpl createInherit(int line, int column,
+ LexicalUnitImpl previous) {
+ return new LexicalUnitImpl(line, column, previous, SAC_INHERIT, "inherit");
+ }
+ static LexicalUnitImpl createIdent(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_IDENT, s);
+ }
+ static LexicalUnitImpl createString(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous,
+ SAC_STRING_VALUE, s);
+ }
+ static LexicalUnitImpl createURL(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_URI, s);
+ }
+ static LexicalUnitImpl createAttr(int line, int column,
+ LexicalUnitImpl previous, String s) {
+ return new LexicalUnitImpl(line, column, previous, SAC_ATTR, s);
+ }
+ static LexicalUnitImpl createCounter(int line, int column,
+ LexicalUnitImpl previous,
+ LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_COUNTER_FUNCTION, line,
+ column, previous, "counter",
+ (LexicalUnitImpl) params);
+ }
+ static LexicalUnitImpl createCounters(int line, int column,
+ LexicalUnitImpl previous,
+ LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_COUNTERS_FUNCTION, line,
+ column, previous, "counters",
+ (LexicalUnitImpl) params);
+ }
+ static LexicalUnitImpl createRGBColor(int line, int column,
+ LexicalUnitImpl previous,
+ LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_RGBCOLOR, line, column,
+ previous, "color",
+ (LexicalUnitImpl) params);
+ }
+ static LexicalUnitImpl createRect(int line, int column,
+ LexicalUnitImpl previous,
+ LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_RECT_FUNCTION, line, column,
+ previous, "rect",
+ (LexicalUnitImpl) params);
+ }
+ static LexicalUnitImpl createFunction(int line, int column,
+ LexicalUnitImpl previous,
+ String fname,
+ LexicalUnit params) {
+ return new LexicalUnitImpl(SAC_FUNCTION, line, column, previous,
+ fname,
+ (LexicalUnitImpl) params);
+ }
+ static LexicalUnitImpl createUnicodeRange(int line, int column,
+ LexicalUnit previous,
+ LexicalUnit params) {
+ // @@ return new LexicalUnitImpl(line, column, previous, null, SAC_UNICODERANGE, params);
+ return null;
+ }
+ static LexicalUnitImpl createComma(int line, int column,
+ LexicalUnitImpl previous) {
+ return new LexicalUnitImpl(SAC_OPERATOR_COMMA, line, column, previous);
+ }
+ static LexicalUnitImpl createSlash(int line, int column,
+ LexicalUnitImpl previous) {
+ return new LexicalUnitImpl(SAC_OPERATOR_SLASH, line, column, previous);
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/LocatorImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: LocatorImpl.java,v 1.2 2000/02/14 16:59:06 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.Locator;
+
+/**
+ * @version $Revision: 1.2 $
+ * @author Philippe Le Hegaret
+ */
+public class LocatorImpl implements Locator {
+
+ // W3C DEBUG mode
+ private static boolean W3CDebug;
+ static {
+ try {
+ W3CDebug = (Boolean.getBoolean("debug")
+ || Boolean.getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
+ || Boolean.getBoolean("org.w3c.flute.parser.debug")
+ || Boolean.getBoolean("org.w3c.flute.debug")
+ || Boolean.getBoolean("org.w3c.debug")
+ || Boolean.getBoolean("org.debug"));
+ } catch (Exception e) {
+ // nothing
+ }
+ }
+
+ String uri;
+ int line;
+ int column;
+
+ public String getURI() {
+ return uri;
+ }
+
+ public int getLineNumber() {
+ return line;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ /**
+ * Creates a new LocatorImpl
+ */
+ public LocatorImpl(Parser p) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p + ");");
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p
+ + ", " + tok + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::newLocator(" + p
+ + ", " + line
+ + ", " + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::reInit(" + p + ");" );
+ }
+ uri = p.source.getURI();
+ line = p.token.beginLine;
+ column = p.token.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, Token tok) {
+ if (W3CDebug) {
+ System.err.println( "LocatorImpl::reInit(" + p
+ + ", " + tok + ");");
+ }
+ uri = p.source.getURI();
+ line = tok.beginLine;
+ column = tok.beginColumn;
+ return this;
+ }
+
+ /**
+ * Reinitializes a LocatorImpl
+ */
+ public LocatorImpl reInit(Parser p, int line, int column) {
+ if (W3CDebug) {
+ System.err.println("LocatorImpl::reInit(" + p
+ + ", " + line
+ + ", " + column + ");");
+ }
+ uri = p.source.getURI();
+ this.line = line;
+ this.column = column;
+ return this;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/MediaListImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,78 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: MediaListImpl.java,v 1.4 2000/04/26 13:40:19 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SACMediaList;
+
+/**
+ * @version $Revision: 1.4 $
+ * @author Philippe Le Hegaret
+ */
+public class MediaListImpl implements SACMediaList {
+
+ String[] array = new String[10];
+ int current;
+
+ public int getLength() {
+ return current;
+ }
+
+ public String item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return array[index];
+ }
+
+ void addItem(String medium) {
+ if (medium.equals("all")) {
+ array[0] = "all";
+ current = 1;
+ return;
+ }
+ for (int i = 0; i < current; i++) {
+ if (medium.equals(array[i])) {
+ return;
+ }
+ }
+ if (current == array.length) {
+ String[] old = array;
+ array = new String[current + current];
+ System.arraycopy(old, 0, array, 0, current);
+ }
+ array[current++] = medium;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ */
+ public String toString() {
+ int _i;
+
+ switch (current) {
+ case 0:
+ return "";
+ case 1:
+ return array[0];
+ default:
+ boolean not_done = true;
+ int i = 0;
+ StringBuffer buf = new StringBuffer(50);
+ do {
+ buf.append(array[i++]);
+ if (i == current) {
+ not_done = false;
+ } else {
+ buf.append(", ");
+ }
+ } while (not_done);
+ return buf.toString();
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParseException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,193 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.CSSException;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends CSSException {
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,3599 @@
+/* Generated By:JavaCC: Do not edit this line. Parser.java */
+package org.w3c.flute.parser;
+
+import java.io.*;
+import java.net.*;
+import java.util.Locale;
+
+
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+
+import org.w3c.flute.util.Encoding;
+
+/**
+ * A CSS2 parser
+ *
+ * @author Philippe Le H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final StringBuffer SPACE = new StringBuffer(" ");
+
+ // the document handler for the parser
+ protected DocumentHandler documentHandler;
+ // the error handler for the parser
+ protected ErrorHandler errorHandler;
+ // the input source for the parser
+ protected InputSource source;
+
+ protected ConditionFactory conditionFactory;
+ protected SelectorFactory selectorFactory;
+
+ // temporary place holder for pseudo-element ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = handler;
+ }
+
+ public void setSelectorFactory(SelectorFactory selectorFactory) {
+ this.selectorFactory = selectorFactory;
+ }
+
+ public void setConditionFactory(ConditionFactory conditionFactory) {
+ this.conditionFactory = conditionFactory;
+ }
+
+ /**
+ * Set the error handler for this parser
+ */
+ public void setErrorHandler(ErrorHandler error) {
+ this.errorHandler = error;
+ }
+
+ /**
+ * Main parse methods
+ *
+ * @param source the source of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+
+ parserUnit();
+ }
+
+ /**
+ * Convenient method for URIs.
+ *
+ * @param systemId the fully resolved URI of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(String systemId)
+ throws CSSException, IOException {
+ parseStyleSheet(new InputSource(systemId));
+ }
+
+ /**
+ * This method parses only one rule (style rule or at-rule, except @charset).
+ *
+ * @param source the source of the rule.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseRule();
+ }
+
+ /**
+ * This method parses a style declaration (including the surrounding curly
+ * braces).
+ *
+ * @param source the source of the style declaration.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseDeclarationBlock();
+ }
+
+ /**
+ * This methods returns "http://www.w3.org/TR/REC-CSS2".
+ * @return the string "http://www.w3.org/TR/REC-CSS2".
+ */
+ public String getParserVersion() {
+ return "http://www.w3.org/TR/REC-CSS2";
+ }
+
+ /**
+ * Parse methods used by DOM Level 2 implementation.
+ */
+ public void parseImportRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseImportRule();
+ }
+
+ public void parseMediaRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseMediaRule();
+ }
+
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ return _parseSelectors();
+ }
+
+ public LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return expr();
+ }
+
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return prio();
+ }
+
+ /**
+ * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
+ */
+ private Reader getReader(InputSource source) throws IOException {
+ if (source.getCharacterStream() != null) {
+ return source.getCharacterStream();
+ } else if (source.getByteStream() != null) {
+ // My DOM level 2 implementation doesn't use this case.
+ if (source.getEncoding() == null) {
+ // unknown encoding, use ASCII as default.
+ return new InputStreamReader(source.getByteStream(), "ASCII");
+ } else {
+ return new InputStreamReader(source.getByteStream(),
+ source.getEncoding());
+ }
+ } else {
+ // systemId
+ // @@TODO
+ throw new CSSException("not yet implemented");
+ }
+ }
+
+ /**
+ * Convert the source into a CharStream with encoding informations.
+ * The encoding can be found in the InputSource or in the CSS document.
+ * Since this method marks the reader and make a reset after looking for
+ * the charset declaration, you'll find the charset declaration into the
+ * stream.
+ */
+ private CharStream getCharStreamWithLurk(InputSource source)
+ throws CSSException, IOException {
+ if (source.getCharacterStream() != null) {
+ // all encoding are supposed to be resolved by the user
+ // return the reader
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ } else if (source.getByteStream() == null) {
+ // @@CONTINUE ME. see also getReader() with systemId
+ try {
+ source.setByteStream(new URL(source.getURI()).openStream());
+ } catch (Exception e) {
+ try {
+ source.setByteStream(new FileInputStream(source.getURI()));
+ } catch (IOException ex) {
+ throw new CSSException("invalid url ?");
+ }
+ }
+ }
+ String encoding = "ASCII";
+ InputStream input = source.getByteStream();
+ char c = ' ';
+
+ if (!input.markSupported()) {
+ input = new BufferedInputStream(input);
+ source.setByteStream(input);
+ }
+ input.mark(100);
+ c = (char) input.read();
+
+ if (c == '@') {
+ // hum, is it a charset ?
+ int size = 100;
+ byte[] buf = new byte[size];
+ input.read(buf, 0, 7);
+ String keyword = new String(buf, 0, 7);
+ if (keyword.equals("charset")) {
+ // Yes, this is the charset declaration !
+
+ // here I don't use the right declaration : white space are ' '.
+ while ((c = (char) input.read()) == ' ') {
+ // find the first quote
+ }
+ char endChar = c;
+ int i = 0;
+
+ if ((endChar != '"') && (endChar != '\'')) {
+ // hum this is not a quote.
+ throw new CSSException("invalid charset declaration");
+ }
+
+ while ((c = (char) input.read()) != endChar) {
+ buf[i++] = (byte) c;
+ if (i == size) {
+ byte[] old = buf;
+ buf = new byte[size + 100];
+ System.arraycopy(old, 0, buf, 0, size);
+ size += 100;
+ }
+ }
+ while ((c = (char) input.read()) == ' ') {
+ // find the next relevant character
+ }
+ if (c != ';') {
+ // no semi colon at the end ?
+ throw new CSSException("invalid charset declaration: "
+ + "missing semi colon");
+ }
+ encoding = new String(buf, 0, i);
+ if (source.getEncoding() != null) {
+ // compare the two encoding informations.
+ // For example, I don't accept to have ASCII and after UTF-8.
+ // Is it really good ? That is the question.
+ if (!encoding.equals(source.getEncoding())) {
+ throw new CSSException("invalid encoding information.");
+ }
+ }
+ } // else no charset declaration available
+ }
+ // ok set the real encoding of this source.
+ source.setEncoding(encoding);
+ // set the real reader of this source.
+ source.setCharacterStream(new InputStreamReader(source.getByteStream(),
+ Encoding.getJavaEncoding(encoding)));
+ // reset the stream (leave the charset declaration in the stream).
+ input.reset();
+
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ }
+
+ private LocatorImpl currentLocator;
+ private Locator getLocator() {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this);
+ }
+ private LocatorImpl getLocator(Token save) {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this, save);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this, save);
+ }
+
+ private void reportError(Locator l, Exception e) {
+ if (errorHandler != null) {
+ if (e instanceof ParseException) {
+ // construct a clean error message.
+ ParseException pe = (ParseException) e;
+ if (pe.specialConstructor) {
+ StringBuffer errorM = new StringBuffer();
+ if (pe.currentToken != null) {
+ errorM.append("encountered \"")
+ .append(pe.currentToken.next);
+ }
+ errorM.append('"');
+ if (pe.expectedTokenSequences.length != 0) {
+ errorM.append(". Was expecting one of: ");
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ int kind = pe.expectedTokenSequences[i][j];
+ if (kind != S) {
+ errorM.append(pe.tokenImage[kind]);
+ errorM.append(' ');
+ }
+ }
+ }
+ }
+ errorHandler.error(new CSSParseException(errorM.toString(),
+ l, e));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
+ }
+ } else if (e == null) {
+ errorHandler.error(new CSSParseException("error", l, null));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(), l, e));
+ }
+ }
+ }
+
+ private void reportWarningSkipText(Locator l, String text) {
+ if (errorHandler != null && text != null) {
+ errorHandler.warning(new CSSParseException("Skipping: " + text, l));
+ }
+ }
+
+/*
+ * The grammar of CSS2
+ */
+
+/**
+ * The main entry for the parser.
+ *
+ * @exception ParseException exception during the parse
+ */
+ final public void parserUnit() throws ParseException {
+ try {
+ documentHandler.startDocument(source);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CHARSET_SYM:
+ charset();
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ ;
+ }
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_1;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ jj_consume_token(S);
+ break;
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ignoreStatement();
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ label_2:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT_SYM:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_2;
+ }
+ importDeclaration();
+ label_3:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ break label_3;
+ }
+ ignoreStatement();
+ label_4:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_4;
+ }
+ jj_consume_token(S);
+ }
+ }
+ }
+ afterImportDeclaration();
+ jj_consume_token(0);
+ } finally {
+ documentHandler.endDocument(source);
+ }
+ }
+
+ final public void charset() throws ParseException {
+ Token n;
+ try {
+ jj_consume_token(CHARSET_SYM);
+ label_5:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ break label_5;
+ }
+ jj_consume_token(S);
+ }
+ n = jj_consume_token(STRING);
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ break label_6;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+ final public void afterImportDeclaration() throws ParseException {
+ String ret;
+ Locator l;
+ label_7:
+ while (true) {
+ ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ l = getLocator();
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case CDC:
+ case ATKEYWORD:
+ ;
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ break label_8;
+ }
+ ignoreStatement();
+ label_9:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ break label_9;
+ }
+ jj_consume_token(S);
+ }
+ }
+ }
+ }
+
+ final public void ignoreStatement() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ jj_consume_token(CDO);
+ break;
+ case CDC:
+ jj_consume_token(CDC);
+ break;
+ case ATKEYWORD:
+ atRuleDeclaration();
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+/**
+ * The import statement
+ *
+ * @exception ParseException exception during the parse
+ */
+ final public void importDeclaration() throws ParseException {
+ Token n;
+ String uri;
+ MediaListImpl ml = new MediaListImpl();
+ try {
+ jj_consume_token(IMPORT_SYM);
+ label_10:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ break label_10;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ uri = convertStringIndex(n.image, 1,
+ n.image.length() -1);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ uri = n.image.substring(4, n.image.length()-1).trim();
+ if ((uri.charAt(0) == '"')
+ || (uri.charAt(0) == '\'')) {
+ uri = uri.substring(1, uri.length()-1);
+ }
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_11:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ break label_11;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ mediaStatement(ml);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ label_12:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ break label_12;
+ }
+ jj_consume_token(S);
+ }
+ if (ml.getLength() == 0) {
+ // see section 6.3 of the CSS2 recommandation.
+ ml.addItem("all");
+ }
+ documentHandler.importStyle(uri, ml, null);
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void media() throws ParseException {
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+ try {
+ jj_consume_token(MEDIA_SYM);
+ label_13:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_13;
+ }
+ jj_consume_token(S);
+ }
+ mediaStatement(ml);
+ start = true; documentHandler.startMedia(ml);
+ jj_consume_token(LBRACE);
+ label_14:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ break label_14;
+ }
+ jj_consume_token(S);
+ }
+ label_15:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case NONASCII:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case HASH:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ ;
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ break label_15;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case CDO:
+ case LBRACE:
+ case DASHMATCH:
+ case INCLUDES:
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case SEMICOLON:
+ case PRECEDES:
+ case NONASCII:
+ case STRING:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case IMPORT_SYM:
+ case MEDIA_SYM:
+ case CHARSET_SYM:
+ case PAGE_SYM:
+ case FONT_FACE_SYM:
+ case ATKEYWORD:
+ case IMPORTANT_SYM:
+ case UNICODERANGE:
+ case FUNCTION:
+ case UNKNOWN:
+ skipUnknownRule();
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_16:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ break label_16;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+ }
+
+ final public void mediaStatement(MediaListImpl ml) throws ParseException {
+ String m;
+ m = medium();
+ label_17:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ break label_17;
+ }
+ jj_consume_token(COMMA);
+ label_18:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ break label_18;
+ }
+ jj_consume_token(S);
+ }
+ ml.addItem(m);
+ m = medium();
+ }
+ ml.addItem(m);
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String medium() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_19:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ break label_19;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void page() throws ParseException {
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+ try {
+ jj_consume_token(PAGE_SYM);
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_20;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ label_21:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ break label_21;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COLON:
+ pseudo = pseudo_page();
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ ;
+ }
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ jj_consume_token(LBRACE);
+ label_22:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ break label_22;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ ;
+ }
+ label_23:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ break label_23;
+ }
+ jj_consume_token(SEMICOLON);
+ label_24:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ break label_24;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_25:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ break label_25;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+ }
+
+ final public String pseudo_page() throws ParseException {
+ Token n;
+ jj_consume_token(COLON);
+ n = jj_consume_token(IDENT);
+ label_26:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_26;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void fontFace() throws ParseException {
+ boolean start = false;
+ try {
+ jj_consume_token(FONT_FACE_SYM);
+ label_27:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ break label_27;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LBRACE);
+ label_28:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ break label_28;
+ }
+ jj_consume_token(S);
+ }
+ start = true; documentHandler.startFontFace();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ ;
+ }
+ label_29:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ break label_29;
+ }
+ jj_consume_token(SEMICOLON);
+ label_30:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ break label_30;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[41] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_31:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[42] = jj_gen;
+ break label_31;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void atRuleDeclaration() throws ParseException {
+ Token n;
+ String ret;
+ n = jj_consume_token(ATKEYWORD);
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+ final public void skipUnknownRule() throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ATKEYWORD:
+ n = jj_consume_token(ATKEYWORD);
+ break;
+ case CDO:
+ n = jj_consume_token(CDO);
+ break;
+ case CHARSET_SYM:
+ n = jj_consume_token(CHARSET_SYM);
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ break;
+ case DASHMATCH:
+ n = jj_consume_token(DASHMATCH);
+ break;
+ case FONT_FACE_SYM:
+ n = jj_consume_token(FONT_FACE_SYM);
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ break;
+ case IMPORTANT_SYM:
+ n = jj_consume_token(IMPORTANT_SYM);
+ break;
+ case IMPORT_SYM:
+ n = jj_consume_token(IMPORT_SYM);
+ break;
+ case INCLUDES:
+ n = jj_consume_token(INCLUDES);
+ break;
+ case LBRACE:
+ n = jj_consume_token(LBRACE);
+ break;
+ case MEDIA_SYM:
+ n = jj_consume_token(MEDIA_SYM);
+ break;
+ case NONASCII:
+ n = jj_consume_token(NONASCII);
+ break;
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ break;
+ case PAGE_SYM:
+ n = jj_consume_token(PAGE_SYM);
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ break;
+ case STRING:
+ n = jj_consume_token(STRING);
+ break;
+ case UNICODERANGE:
+ n = jj_consume_token(UNICODERANGE);
+ break;
+ case URL:
+ n = jj_consume_token(URL);
+ break;
+ case SEMICOLON:
+ n = jj_consume_token(SEMICOLON);
+ break;
+ case PLUS:
+ n = jj_consume_token(PLUS);
+ break;
+ case PRECEDES:
+ n = jj_consume_token(PRECEDES);
+ break;
+ case MINUS:
+ n = jj_consume_token(MINUS);
+ break;
+ case UNKNOWN:
+ n = jj_consume_token(UNKNOWN);
+ break;
+ default:
+ jj_la1[43] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char combinator() throws ParseException {
+char connector = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ label_32:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[44] = jj_gen;
+ break label_32;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '+';}
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ label_33:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[45] = jj_gen;
+ break label_33;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return '>';}
+ break;
+ case S:
+ jj_consume_token(S);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case PRECEDES:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ connector = '+';
+ break;
+ case PRECEDES:
+ jj_consume_token(PRECEDES);
+ connector = '>';
+ break;
+ default:
+ jj_la1[46] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_34:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[47] = jj_gen;
+ break label_34;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[48] = jj_gen;
+ ;
+ }
+ {if (true) return connector;}
+ break;
+ default:
+ jj_la1[49] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public String property() throws ParseException {
+ Token n;
+ n = jj_consume_token(IDENT);
+ label_35:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[50] = jj_gen;
+ break label_35;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return convertIdent(n.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void styleRule() throws ParseException {
+ boolean start = false;
+ SelectorList l = null;
+ Token save;
+ Locator loc;
+ try {
+ l = selectorList();
+ save = token;
+ jj_consume_token(LBRACE);
+ label_36:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[51] = jj_gen;
+ break label_36;
+ }
+ jj_consume_token(S);
+ }
+ start = true;
+ documentHandler.startSelector(l);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[52] = jj_gen;
+ ;
+ }
+ label_37:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[53] = jj_gen;
+ break label_37;
+ }
+ jj_consume_token(SEMICOLON);
+ label_38:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[54] = jj_gen;
+ break label_38;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[55] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RBRACE);
+ label_39:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[56] = jj_gen;
+ break label_39;
+ }
+ jj_consume_token(S);
+ }
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector(l);
+ }
+ }
+ }
+
+ final public SelectorList selectorList() throws ParseException {
+ SelectorListImpl selectors = new SelectorListImpl();
+ Selector selector;
+ selector = selector();
+ label_40:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[57] = jj_gen;
+ break label_40;
+ }
+ jj_consume_token(COMMA);
+ label_41:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[58] = jj_gen;
+ break label_41;
+ }
+ jj_consume_token(S);
+ }
+ selectors.addSelector(selector);
+ selector = selector();
+ }
+ selectors.addSelector(selector);
+ {if (true) return selectors;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Selector selector() throws ParseException {
+ Selector selector;
+ char comb;
+ try {
+ selector = simple_selector(null, ' ');
+ label_42:
+ while (true) {
+ if (jj_2_1(2)) {
+ ;
+ } else {
+ break label_42;
+ }
+ comb = combinator();
+ selector = simple_selector(selector, comb);
+ }
+ label_43:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[59] = jj_gen;
+ break label_43;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return selector;}
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
+ */
+ Token t = getToken(1);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ getNextToken();
+ t = getToken(1);
+ }
+
+ {if (true) throw new ThrowedParseException(e);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Selector simple_selector(Selector selector, char comb) throws ParseException {
+ SimpleSelector simple_current = null;
+ Condition cond = null;
+
+ pseudoElt = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ANY:
+ case IDENT:
+ simple_current = element_name();
+ label_44:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[60] = jj_gen;
+ break label_44;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[61] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case HASH:
+ cond = hash(cond);
+ label_45:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ ;
+ break;
+ default:
+ jj_la1[62] = jj_gen;
+ break label_45;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[63] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case DOT:
+ cond = _class(cond);
+ label_46:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[64] = jj_gen;
+ break label_46;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[65] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ label_47:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[66] = jj_gen;
+ break label_47;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[67] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ label_48:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACKET:
+ case DOT:
+ case COLON:
+ case HASH:
+ ;
+ break;
+ default:
+ jj_la1[68] = jj_gen;
+ break label_48;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case HASH:
+ cond = hash(cond);
+ break;
+ case DOT:
+ cond = _class(cond);
+ break;
+ case LBRACKET:
+ cond = attrib(cond);
+ break;
+ case COLON:
+ cond = pseudo(cond);
+ break;
+ default:
+ jj_la1[69] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ default:
+ jj_la1[70] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ if (simple_current == null) {
+ simple_current = selectorFactory.createElementSelector(null, null);
+ }
+ if (cond != null) {
+ simple_current = selectorFactory.createConditionalSelector(simple_current,
+ cond);
+ }
+ if (selector != null) {
+ switch (comb) {
+ case ' ':
+ selector = selectorFactory.createDescendantSelector(selector,
+ simple_current);
+ break;
+ case '+':
+ selector =
+ selectorFactory.createDirectAdjacentSelector((short) 1,
+ selector,
+ simple_current);
+ break;
+ case '>':
+ selector = selectorFactory.createChildSelector(selector,
+ simple_current);
+ break;
+ default:
+ {if (true) throw new ParseException("invalid state. send a bug report");}
+ }
+ } else {
+ selector= simple_current;
+ }
+ if (pseudoElt != null) {
+ selector = selectorFactory.createChildSelector(selector,
+ selectorFactory.createPseudoElementSelector(null, pseudoElt));
+ }
+ {if (true) return selector;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Condition _class(Condition pred) throws ParseException {
+ Token n;
+Condition c;
+ jj_consume_token(DOT);
+ n = jj_consume_token(IDENT);
+ c = conditionFactory.createClassCondition(null, n.image);
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return conditionFactory.createAndCondition(pred, c);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public SimpleSelector element_name() throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ {if (true) return selectorFactory.createElementSelector(null, convertIdent(n.image));}
+ break;
+ case ANY:
+ jj_consume_token(ANY);
+ {if (true) return selectorFactory.createElementSelector(null, null);}
+ break;
+ default:
+ jj_la1[71] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Condition attrib(Condition pred) throws ParseException {
+ int cases = 0;
+ Token att = null;
+ Token val = null;
+ String attValue = null;
+ jj_consume_token(LBRACKET);
+ label_49:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ break label_49;
+ }
+ jj_consume_token(S);
+ }
+ att = jj_consume_token(IDENT);
+ label_50:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ break label_50;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DASHMATCH:
+ case INCLUDES:
+ case EQ:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case EQ:
+ jj_consume_token(EQ);
+ cases = 1;
+ break;
+ case INCLUDES:
+ jj_consume_token(INCLUDES);
+ cases = 2;
+ break;
+ case DASHMATCH:
+ jj_consume_token(DASHMATCH);
+ cases = 3;
+ break;
+ default:
+ jj_la1[74] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_51:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[75] = jj_gen;
+ break label_51;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ val = jj_consume_token(IDENT);
+ attValue = val.image;
+ break;
+ case STRING:
+ val = jj_consume_token(STRING);
+ attValue = convertStringIndex(val.image, 1,
+ val.image.length() -1);
+ break;
+ default:
+ jj_la1[76] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_52:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[77] = jj_gen;
+ break label_52;
+ }
+ jj_consume_token(S);
+ }
+ break;
+ default:
+ jj_la1[78] = jj_gen;
+ ;
+ }
+ jj_consume_token(RBRACKET);
+ String name = convertIdent(att.image);
+ Condition c;
+ switch (cases) {
+ case 0:
+ c = conditionFactory.createAttributeCondition(name, null, false, null);
+ break;
+ case 1:
+ c = conditionFactory.createAttributeCondition(name, null, false,
+ attValue);
+ break;
+ case 2:
+ c = conditionFactory.createOneOfAttributeCondition(name, null, false,
+ attValue);
+ break;
+ case 3:
+ c = conditionFactory.createBeginHyphenAttributeCondition(name, null,
+ false,
+ attValue);
+ break;
+ default:
+ // never reached.
+ c = null;
+ }
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return conditionFactory.createAndCondition(pred, c);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Condition pseudo(Condition pred) throws ParseException {
+ Token n;
+Token language;
+ jj_consume_token(COLON);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ String s = convertIdent(n.image);
+ if (s.equals("first-letter") || s.equals("first-line")) {
+ if (pseudoElt != null) {
+ {if (true) throw new CSSParseException("duplicate pseudo element definition "
+ + s, getLocator());}
+ } else {
+ pseudoElt = s;
+ {if (true) return pred;}
+ }
+ } else {
+ Condition c =
+ conditionFactory.createPseudoClassCondition(null, s);
+ if (pred == null) {
+ {if (true) return c;}
+ } else {
+ {if (true) return conditionFactory.createAndCondition(pred, c);}
+ }
+ }
+ break;
+ case FUNCTION:
+ n = jj_consume_token(FUNCTION);
+ label_53:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[79] = jj_gen;
+ break label_53;
+ }
+ jj_consume_token(S);
+ }
+ language = jj_consume_token(IDENT);
+ label_54:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[80] = jj_gen;
+ break label_54;
+ }
+ jj_consume_token(S);
+ }
+ jj_consume_token(LPARAN);
+ String f = convertIdent(n.image);
+ if (f.equals("lang(")) {
+ Condition d =
+ conditionFactory.createLangCondition(convertIdent(language.image));
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return conditionFactory.createAndCondition(pred, d);}
+ }
+ } else {
+ {if (true) throw new CSSParseException("invalid pseudo function name "
+ + f, getLocator());}
+ }
+ break;
+ default:
+ jj_la1[81] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public Condition hash(Condition pred) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ Condition d =
+ conditionFactory.createIdCondition(n.image.substring(1));
+ if (pred == null) {
+ {if (true) return d;}
+ } else {
+ {if (true) return conditionFactory.createAndCondition(pred, d);}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public void declaration() throws ParseException {
+ boolean important = false;
+ String name;
+ LexicalUnit exp;
+ Token save;
+ try {
+ name = property();
+ save = token;
+ jj_consume_token(COLON);
+ label_55:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[82] = jj_gen;
+ break label_55;
+ }
+ jj_consume_token(S);
+ }
+ exp = expr();
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORTANT_SYM:
+ important = prio();
+ break;
+ default:
+ jj_la1[83] = jj_gen;
+ ;
+ }
+ documentHandler.property(name, exp, important);
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public boolean prio() throws ParseException {
+ jj_consume_token(IMPORTANT_SYM);
+ label_56:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[84] = jj_gen;
+ break label_56;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return true;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DIV:
+ n = jj_consume_token(DIV);
+ label_57:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[85] = jj_gen;
+ break label_57;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ case COMMA:
+ n = jj_consume_token(COMMA);
+ label_58:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[86] = jj_gen;
+ break label_58;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev);}
+ break;
+ default:
+ jj_la1[87] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnit expr() throws ParseException {
+ LexicalUnitImpl first, res;
+ char op;
+ first = term(null);
+ res = first;
+ label_59:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case COMMA:
+ case DIV:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ ;
+ break;
+ default:
+ jj_la1[88] = jj_gen;
+ break label_59;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ case DIV:
+ res = operator(res);
+ break;
+ default:
+ jj_la1[89] = jj_gen;
+ ;
+ }
+ res = term(res);
+ }
+ {if (true) return first;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public char unaryOperator() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MINUS:
+ jj_consume_token(MINUS);
+ {if (true) return '-';}
+ break;
+ case PLUS:
+ jj_consume_token(PLUS);
+ {if (true) return '+';}
+ break;
+ default:
+ jj_la1[90] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException {
+ LexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case NUMBER:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case FUNCTION:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ op = unaryOperator();
+ break;
+ default:
+ jj_la1[91] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NUMBER:
+ n = jj_consume_token(NUMBER);
+ result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
+ prev, number(op, n, 0));
+ break;
+ case PERCENTAGE:
+ n = jj_consume_token(PERCENTAGE);
+ result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1));
+ break;
+ case PT:
+ n = jj_consume_token(PT);
+ result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case CM:
+ n = jj_consume_token(CM);
+ result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case MM:
+ n = jj_consume_token(MM);
+ result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case PC:
+ n = jj_consume_token(PC);
+ result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case IN:
+ n = jj_consume_token(IN);
+ result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case PX:
+ n = jj_consume_token(PX);
+ result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case EMS:
+ n = jj_consume_token(EMS);
+ result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case EXS:
+ n = jj_consume_token(EXS);
+ result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case DEG:
+ n = jj_consume_token(DEG);
+ result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case RAD:
+ n = jj_consume_token(RAD);
+ result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case GRAD:
+ n = jj_consume_token(GRAD);
+ result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case SECOND:
+ n = jj_consume_token(SECOND);
+ result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1));
+ break;
+ case MS:
+ n = jj_consume_token(MS);
+ result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case HZ:
+ n = jj_consume_token(HZ);
+ result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2));
+ break;
+ case KHZ:
+ n = jj_consume_token(KHZ);
+ result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3));
+ break;
+ case DIMEN:
+ n = jj_consume_token(DIMEN);
+ String s = n.image;
+ int i = 0;
+ while (i < s.length()
+ && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
+ i++;
+ }
+ result = LexicalUnitImpl.createDimen(n.beginLine, n.beginColumn, prev,
+ Float.valueOf(s.substring(0, i)).floatValue(),
+ s.substring(i));
+ break;
+ case FUNCTION:
+ result = function(op, prev);
+ break;
+ default:
+ jj_la1[92] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ case STRING:
+ case IDENT:
+ case URL:
+ case HASH:
+ case UNICODERANGE:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING:
+ n = jj_consume_token(STRING);
+ result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));
+ break;
+ case IDENT:
+ n = jj_consume_token(IDENT);
+ String s = convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+
+ break;
+ case HASH:
+ result = hexcolor(prev);
+ break;
+ case URL:
+ result = url(prev);
+ break;
+ case UNICODERANGE:
+ result = unicode(prev);
+ break;
+ default:
+ jj_la1[93] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_la1[94] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ label_60:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[95] = jj_gen;
+ break label_60;
+ }
+ jj_consume_token(S);
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * Handle all CSS2 functions.
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl function(char operator, LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ LexicalUnit params = null;
+ n = jj_consume_token(FUNCTION);
+ label_61:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[96] = jj_gen;
+ break label_61;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case PLUS:
+ case MINUS:
+ case STRING:
+ case IDENT:
+ case NUMBER:
+ case URL:
+ case PERCENTAGE:
+ case PT:
+ case MM:
+ case CM:
+ case PC:
+ case IN:
+ case PX:
+ case EMS:
+ case EXS:
+ case DEG:
+ case RAD:
+ case GRAD:
+ case MS:
+ case SECOND:
+ case HZ:
+ case KHZ:
+ case DIMEN:
+ case HASH:
+ case UNICODERANGE:
+ case FUNCTION:
+ params = expr();
+ break;
+ default:
+ jj_la1[97] = jj_gen;
+ ;
+ }
+ jj_consume_token(LPARAN);
+ if (operator != ' ') {
+ {if (true) throw new CSSParseException("invalid operator before a function.",
+ getLocator());}
+ }
+ String f = convertIdent(n.image);
+ LexicalUnitImpl l = (LexicalUnitImpl) params;
+ boolean loop = true;
+ if ("rgb(".equals(f)) {
+ // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ if (loop) {
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ }
+ if ((i == 5) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);}
+ } else {
+ if (errorHandler != null) {
+ String errorText;
+ Locator loc;
+ if (i < 5) {
+ if (params == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters.";
+ } else if (l == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters: "
+ + params.toString();
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
+ }
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
+ }
+ errorHandler.error(new CSSParseException(errorText, loc));
+ }
+
+ {if (true) throw new JumpException();}
+ }
+ } else if ("counter".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 3) {
+ switch (i) {
+ case 0:
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 1:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 1) || (i == 3)) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+
+ } else if ("counters(".equals(f)) {
+
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 4:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 3) || (i == 5)) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+ } else if ("attr(".equals(f)) {
+ if ((l != null)
+ && (l.getNextLexicalUnit() == null)
+ && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
+ {if (true) return LexicalUnitImpl.createAttr(l.getLineNumber(),
+ l.getColumnNumber(),
+ prev, l.getStringValue());}
+ }
+ } else if ("rect(".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 7) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ switch (l.getLexicalUnitType()) {
+ case LexicalUnit.SAC_INTEGER:
+ if (l.getIntegerValue() != 0) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ if (!l.getStringValue().equals("auto")) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ // nothing
+ break;
+ default:
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ {if (true) throw new ParseException("implementation error");}
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if ((i == 7) && loop && (l == null)) {
+ {if (true) return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
+ prev, params);}
+ }
+ }
+ {if (true) return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
+ f.substring(0,
+ f.length() -1),
+ params);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(UNICODERANGE);
+ LexicalUnitImpl params = null;
+ String s = n.image.substring(2);
+ int index = s.indexOf('-');
+ if (index == -1) {
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s, 16));
+ } else {
+ String s1 = s.substring(0, index);
+ String s2 = s.substring(index);
+
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s1, 16));
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s2, 16));
+ }
+
+ {if (true) return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
+ prev, params);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(URL);
+ String urlname = n.image.substring(4, n.image.length()-1).trim();
+ if (urlname.charAt(0) == '"'
+ || urlname.charAt(0) == '\'') {
+ urlname = urlname.substring(1, urlname.length()-1);
+ }
+ {if (true) return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);}
+ throw new Error("Missing return statement in function");
+ }
+
+/**
+ * @exception ParseException exception during the parse
+ */
+ final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException {
+ Token n;
+ n = jj_consume_token(HASH);
+ int r;
+ LexicalUnitImpl first, params = null;
+ String s = n.image.substring(1);
+
+ if (s.length() == 3) {
+ String sh = s.substring(0,1);
+ r = Integer.parseInt(sh+sh, 16);
+ first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ sh = s.substring(1,2);
+ r = Integer.parseInt(sh+sh, 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ sh = s.substring(2,3);
+ r = Integer.parseInt(sh+sh, 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ } else if (s.length() == 6) {
+ r = Integer.parseInt(s.substring(0,2), 16);
+ first = params = LexicalUnitImpl.createInteger(n.beginLine,
+ n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ r = Integer.parseInt(s.substring(2,4), 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ r = Integer.parseInt(s.substring(4,6), 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ } else {
+ first = null;
+ {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
+ getLocator());}
+ }
+ {if (true) return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn,
+ prev, first);}
+ throw new Error("Missing return statement in function");
+ }
+
+ float number(char operator, Token n, int lengthUnit) throws ParseException {
+ String image = n.image;
+ float f = 0;
+
+ if (lengthUnit != 0) {
+ image = image.substring(0, image.length() - lengthUnit);
+ }
+ f = Float.valueOf(image).floatValue();
+ return (operator == '-')? -f: f;
+ }
+
+ String skipStatement() throws ParseException {
+ StringBuffer s = new StringBuffer();
+ Token tok = getToken(0);
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ return null;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ getNextToken();
+ s.append(skip_to_matching_brace());
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == RBRACE) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == SEMICOLON) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ }
+ getNextToken();
+ }
+
+ // skip white space
+ while (true) {
+ if (tok.kind != S) {
+ break;
+ }
+ tok = getNextToken();
+ tok = getToken(1);
+ }
+
+ return s.toString().trim();
+ }
+
+ String skip_to_matching_brace() throws ParseException {
+ StringBuffer s = new StringBuffer();
+ Token tok;
+ int nesting = 1;
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ break;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ nesting++;
+ } else if (tok.kind == RBRACE) {
+ nesting--;
+ if (nesting == 0) {
+ break;
+ }
+ }
+ getNextToken();
+ }
+ return s.toString();
+ }
+
+ String convertStringIndex(String s, int start, int len) throws ParseException {
+ StringBuffer buf = new StringBuffer(len);
+ int index = start;
+
+ while (index < len) {
+ char c = s.charAt(index);
+ if (c == '\\') {
+ if (++index < len) {
+ c = s.charAt(index);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ int numValue = Character.digit(c, 16);
+ int count = 0;
+ int p = 16;
+
+ while (index + 1 < len && count < 6) {
+ c = s.charAt(index+1);
+
+ if (Character.digit(c, 16) != -1) {
+ numValue = (numValue * 16) + Character.digit(c, 16);
+ p *= 16;
+ index++;
+ } else {
+ if (c == ' ') {
+ // skip the latest white space
+ index++;
+ }
+ break;
+ }
+ }
+ buf.append((char) numValue);
+ break;
+ case '\n':
+ case '\f':
+ break;
+ case '\r':
+ if (index + 1 < len) {
+ if (s.charAt(index + 1) == '\n') {
+ index ++;
+ }
+ }
+ break;
+ default:
+ buf.append(c);
+ }
+ } else {
+ throw new CSSParseException("invalid string " + s, getLocator());
+ }
+ } else {
+ buf.append(c);
+ }
+ index++;
+ }
+
+ return buf.toString();
+ }
+
+ String convertIdent(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
+
+ String convertString(String s) throws ParseException {
+ return convertStringIndex(s, 0, s.length());
+ }
+
+ void rejectToken(Token t) throws ParseException {
+ Token fakeToken = new Token();
+ t.next = token;
+ fakeToken.next = t;
+ token = fakeToken;
+ }
+
+ String skipAfterExpression() throws ParseException {
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+
+ while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+
+ return s.toString();
+ }
+
+/**
+ * The following functions are useful for a DOM CSS implementation only and are
+ * not part of the general CSS2 parser.
+ */
+ final public void _parseRule() throws ParseException {
+ String ret = null;
+ label_62:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[98] = jj_gen;
+ break label_62;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IMPORT_SYM:
+ importDeclaration();
+ break;
+ case LBRACKET:
+ case ANY:
+ case DOT:
+ case COLON:
+ case IDENT:
+ case HASH:
+ styleRule();
+ break;
+ case MEDIA_SYM:
+ media();
+ break;
+ case PAGE_SYM:
+ page();
+ break;
+ case FONT_FACE_SYM:
+ fontFace();
+ break;
+ default:
+ jj_la1[99] = jj_gen;
+ ret = skipStatement();
+ if ((ret == null) || (ret.length() == 0)) {
+ {if (true) return;}
+ }
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ {if (true) throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());}
+ }
+ }
+ }
+
+ final public void _parseImportRule() throws ParseException {
+ label_63:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[100] = jj_gen;
+ break label_63;
+ }
+ jj_consume_token(S);
+ }
+ importDeclaration();
+ }
+
+ final public void _parseMediaRule() throws ParseException {
+ label_64:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[101] = jj_gen;
+ break label_64;
+ }
+ jj_consume_token(S);
+ }
+ media();
+ }
+
+ final public void _parseDeclarationBlock() throws ParseException {
+ label_65:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[102] = jj_gen;
+ break label_65;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[103] = jj_gen;
+ ;
+ }
+ label_66:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[104] = jj_gen;
+ break label_66;
+ }
+ jj_consume_token(SEMICOLON);
+ label_67:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[105] = jj_gen;
+ break label_67;
+ }
+ jj_consume_token(S);
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENT:
+ declaration();
+ break;
+ default:
+ jj_la1[106] = jj_gen;
+ ;
+ }
+ }
+ }
+
+ final public SelectorList _parseSelectors() throws ParseException {
+ SelectorList p = null;
+ try {
+ label_68:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case S:
+ ;
+ break;
+ default:
+ jj_la1[107] = jj_gen;
+ break label_68;
+ }
+ jj_consume_token(S);
+ }
+ p = selectorList();
+ {if (true) return p;}
+ } catch (ThrowedParseException e) {
+ {if (true) throw (ParseException) e.e.fillInStackTrace();}
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ boolean retval = !jj_3_1();
+ jj_save(0, xla);
+ return retval;
+ }
+
+ final private boolean jj_3R_70() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_74()) {
+ jj_scanpos = xsp;
+ if (jj_3R_75()) {
+ jj_scanpos = xsp;
+ if (jj_3R_76()) {
+ jj_scanpos = xsp;
+ if (jj_3R_77()) {
+ jj_scanpos = xsp;
+ if (jj_3R_78()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_88() {
+ if (jj_scan_token(PRECEDES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_87() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_86() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_80() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_81() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_87()) {
+ jj_scanpos = xsp;
+ if (jj_3R_88()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_79() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_83() {
+ if (jj_scan_token(HASH)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_72() {
+ if (jj_scan_token(PRECEDES)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_80()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_90() {
+ if (jj_scan_token(ANY)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_73() {
+ if (jj_scan_token(S)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_81()) jj_scanpos = xsp;
+ else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_71() {
+ if (jj_scan_token(PLUS)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_79()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_69() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_71()) {
+ jj_scanpos = xsp;
+ if (jj_3R_72()) {
+ jj_scanpos = xsp;
+ if (jj_3R_73()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_89() {
+ if (jj_scan_token(IDENT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_82() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_89()) {
+ jj_scanpos = xsp;
+ if (jj_3R_90()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_69()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_3R_70()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_84() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_85() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_78() {
+ if (jj_3R_86()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_77() {
+ if (jj_3R_85()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_76() {
+ if (jj_3R_84()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_75() {
+ if (jj_3R_83()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_74() {
+ if (jj_3R_82()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ public ParserTokenManager token_source;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[108];
+ final private int[] jj_la1_0 = {0x0,0x62,0x62,0x0,0x60,0x2,0x2,0x2,0x1340000,0x60,0x2,0x60,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x335f6a0,0x335f6a0,0x2,0x4000,0x2,0x2,0x2,0x2,0x0,0x1000000,0x2,0x0,0x8000,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,0x201f6a0,0x2,0x2,0x11000,0x2,0x11000,0x11002,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,0x4000,0x2,0x2,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1240000,0x1340000,0x100000,0x2,0x2,0xe00,0x2,0x0,0x2,0xe00,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x24000,0x27000,0x24000,0x3000,0x3000,0x0,0x0,0x3000,0x2,0x2,0x3000,0x2,0x1340000,0x2,0x2,0x2,0x0,0x8000,0x2,0x0,0x2,};
+ final private int[] jj_la1_1 = {0x8000000,0x40000000,0x40000000,0x2000000,0x40000000,0x0,0x0,0x0,0x35000008,0x40000000,0x0,0x40000000,0x0,0x44,0x0,0x8,0x0,0x0,0x0,0xff0000dc,0xff0000dc,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0xfe0000d4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000008,0x8,0x0,0x0,0x0,0x0,0xc,0x0,0x0,0x0,0x0,0x8,0x0,0x80000000,0x0,0x0,0x0,0x0,0x1ffffdc,0x0,0x0,0x0,0xffff90,0x100004c,0x1ffffdc,0x0,0x0,0x1ffffdc,0x0,0x37000008,0x0,0x0,0x0,0x8,0x0,0x0,0x8,0x0,};
+ final private int[] jj_la1_2 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x400,0x200,0x600,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ final private JJCalls[] jj_2_rtns = new JJCalls[1];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ public Parser(CharStream stream) {
+ token_source = new ParserTokenManager(stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 108; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(CharStream stream) {
+ token_source.ReInit(stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 108; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public Parser(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 108; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ public void ReInit(ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 108; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration _enum = jj_expentries.elements(); _enum.hasMoreElements();) {
+ int[] oldentry = (int[])(_enum.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ final public ParseException generateParseException() {
+ jj_expentries.removeAllElements();
+ boolean[] la1tokens = new boolean[76];
+ for (int i = 0; i < 76; i++) {
+ la1tokens[i] = false;
+ }
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 108; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ if ((jj_la1_2[i] & (1<<j)) != 0) {
+ la1tokens[64+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 76; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.addElement(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+ final private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 1; i++) {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Parser.jj 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,1978 @@
+/* -*-java-extended-*-
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: Parser.jj,v 1.15 2000/10/27 21:09:37 plehegar Exp $
+ */
+
+options {
+ IGNORE_CASE = true;
+ STATIC = false;
+ USER_CHAR_STREAM = true;
+ /* DEBUG_TOKEN_MANAGER = true;
+ DEBUG_PARSER = true; */
+}
+
+PARSER_BEGIN(Parser)
+
+package org.w3c.flute.parser;
+
+import java.io.*;
+import java.net.*;
+import java.util.Locale;
+
+
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+
+import org.w3c.flute.util.Encoding;
+
+/**
+ * A CSS2 parser
+ *
+ * @author Philippe Le H�garet
+ * @version $Revision: 1.15 $
+ */
+public class Parser implements org.w3c.css.sac.Parser {
+
+ // replaces all \t, \n, etc with this StringBuffer.
+ static final StringBuffer SPACE = new StringBuffer(" ");
+
+ // the document handler for the parser
+ protected DocumentHandler documentHandler;
+ // the error handler for the parser
+ protected ErrorHandler errorHandler;
+ // the input source for the parser
+ protected InputSource source;
+
+ protected ConditionFactory conditionFactory;
+ protected SelectorFactory selectorFactory;
+
+ // temporary place holder for pseudo-element ...
+ private String pseudoElt;
+
+ /**
+ * Creates a new Parser
+ */
+ public Parser() {
+ this((CharStream) null);
+ }
+
+ /**
+ * @@TODO
+ * @exception CSSException Not yet implemented
+ */
+ public void setLocale(Locale locale) throws CSSException {
+ throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
+ }
+
+ /**
+ * Set the document handler for this parser
+ */
+ public void setDocumentHandler(DocumentHandler handler) {
+ this.documentHandler = handler;
+ }
+
+ public void setSelectorFactory(SelectorFactory selectorFactory) {
+ this.selectorFactory = selectorFactory;
+ }
+
+ public void setConditionFactory(ConditionFactory conditionFactory) {
+ this.conditionFactory = conditionFactory;
+ }
+
+ /**
+ * Set the error handler for this parser
+ */
+ public void setErrorHandler(ErrorHandler error) {
+ this.errorHandler = error;
+ }
+
+ /**
+ * Main parse methods
+ *
+ * @param source the source of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+
+ parserUnit();
+ }
+
+ /**
+ * Convenient method for URIs.
+ *
+ * @param systemId the fully resolved URI of the style sheet.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleSheet(String systemId)
+ throws CSSException, IOException {
+ parseStyleSheet(new InputSource(systemId));
+ }
+
+ /**
+ * This method parses only one rule (style rule or at-rule, except @charset).
+ *
+ * @param source the source of the rule.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseRule();
+ }
+
+ /**
+ * This method parses a style declaration (including the surrounding curly
+ * braces).
+ *
+ * @param source the source of the style declaration.
+ * @exception IOException the source can't be parsed.
+ * @exception CSSException the source is not CSS valid.
+ */
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseDeclarationBlock();
+ }
+
+ /**
+ * This methods returns "http://www.w3.org/TR/REC-CSS2".
+ * @return the string "http://www.w3.org/TR/REC-CSS2".
+ */
+ public String getParserVersion() {
+ return "http://www.w3.org/TR/REC-CSS2";
+ }
+
+ /**
+ * Parse methods used by DOM Level 2 implementation.
+ */
+ public void parseImportRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseImportRule();
+ }
+
+ public void parseMediaRule(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ _parseMediaRule();
+ }
+
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ if (selectorFactory == null) {
+ selectorFactory = new SelectorFactoryImpl();
+ }
+ if (conditionFactory == null) {
+ conditionFactory = new ConditionFactoryImpl();
+ }
+ return _parseSelectors();
+ }
+
+ public LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return expr();
+ }
+
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException {
+ this.source = source;
+ ReInit(getCharStreamWithLurk(source));
+
+ return prio();
+ }
+
+ /**
+ * Convert the source into a Reader. Used only by DOM Level 2 parser methods.
+ */
+ private Reader getReader(InputSource source) throws IOException {
+ if (source.getCharacterStream() != null) {
+ return source.getCharacterStream();
+ } else if (source.getByteStream() != null) {
+ // My DOM level 2 implementation doesn't use this case.
+ if (source.getEncoding() == null) {
+ // unknown encoding, use ASCII as default.
+ return new InputStreamReader(source.getByteStream(), "ASCII");
+ } else {
+ return new InputStreamReader(source.getByteStream(),
+ source.getEncoding());
+ }
+ } else {
+ // systemId
+ // @@TODO
+ throw new CSSException("not yet implemented");
+ }
+ }
+
+ /**
+ * Convert the source into a CharStream with encoding informations.
+ * The encoding can be found in the InputSource or in the CSS document.
+ * Since this method marks the reader and make a reset after looking for
+ * the charset declaration, you'll find the charset declaration into the
+ * stream.
+ */
+ private CharStream getCharStreamWithLurk(InputSource source)
+ throws CSSException, IOException {
+ if (source.getCharacterStream() != null) {
+ // all encoding are supposed to be resolved by the user
+ // return the reader
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ } else if (source.getByteStream() == null) {
+ // @@CONTINUE ME. see also getReader() with systemId
+ try {
+ source.setByteStream(new URL(source.getURI()).openStream());
+ } catch (Exception e) {
+ try {
+ source.setByteStream(new FileInputStream(source.getURI()));
+ } catch (IOException ex) {
+ throw new CSSException("invalid url ?");
+ }
+ }
+ }
+ String encoding = "ASCII";
+ InputStream input = source.getByteStream();
+ char c = ' ';
+
+ if (!input.markSupported()) {
+ input = new BufferedInputStream(input);
+ source.setByteStream(input);
+ }
+ input.mark(100);
+ c = (char) input.read();
+
+ if (c == '@') {
+ // hum, is it a charset ?
+ int size = 100;
+ byte[] buf = new byte[size];
+ input.read(buf, 0, 7);
+ String keyword = new String(buf, 0, 7);
+ if (keyword.equals("charset")) {
+ // Yes, this is the charset declaration !
+
+ // here I don't use the right declaration : white space are ' '.
+ while ((c = (char) input.read()) == ' ') {
+ // find the first quote
+ }
+ char endChar = c;
+ int i = 0;
+
+ if ((endChar != '"') && (endChar != '\'')) {
+ // hum this is not a quote.
+ throw new CSSException("invalid charset declaration");
+ }
+
+ while ((c = (char) input.read()) != endChar) {
+ buf[i++] = (byte) c;
+ if (i == size) {
+ byte[] old = buf;
+ buf = new byte[size + 100];
+ System.arraycopy(old, 0, buf, 0, size);
+ size += 100;
+ }
+ }
+ while ((c = (char) input.read()) == ' ') {
+ // find the next relevant character
+ }
+ if (c != ';') {
+ // no semi colon at the end ?
+ throw new CSSException("invalid charset declaration: "
+ + "missing semi colon");
+ }
+ encoding = new String(buf, 0, i);
+ if (source.getEncoding() != null) {
+ // compare the two encoding informations.
+ // For example, I don't accept to have ASCII and after UTF-8.
+ // Is it really good ? That is the question.
+ if (!encoding.equals(source.getEncoding())) {
+ throw new CSSException("invalid encoding information.");
+ }
+ }
+ } // else no charset declaration available
+ }
+ // ok set the real encoding of this source.
+ source.setEncoding(encoding);
+ // set the real reader of this source.
+ source.setCharacterStream(new InputStreamReader(source.getByteStream(),
+ Encoding.getJavaEncoding(encoding)));
+ // reset the stream (leave the charset declaration in the stream).
+ input.reset();
+
+ return new Generic_CharStream(source.getCharacterStream(), 1, 1);
+ }
+
+ private LocatorImpl currentLocator;
+ private Locator getLocator() {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this);
+ }
+ private LocatorImpl getLocator(Token save) {
+ if (currentLocator == null) {
+ currentLocator = new LocatorImpl(this, save);
+ return currentLocator;
+ }
+ return currentLocator.reInit(this, save);
+ }
+
+ private void reportError(Locator l, Exception e) {
+ if (errorHandler != null) {
+ if (e instanceof ParseException) {
+ // construct a clean error message.
+ ParseException pe = (ParseException) e;
+ if (pe.specialConstructor) {
+ StringBuffer errorM = new StringBuffer();
+ if (pe.currentToken != null) {
+ errorM.append("encountered \"")
+ .append(pe.currentToken.next);
+ }
+ errorM.append('"');
+ if (pe.expectedTokenSequences.length != 0) {
+ errorM.append(". Was expecting one of: ");
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ int kind = pe.expectedTokenSequences[i][j];
+ if (kind != S) {
+ errorM.append(pe.tokenImage[kind]);
+ errorM.append(' ');
+ }
+ }
+ }
+ }
+ errorHandler.error(new CSSParseException(errorM.toString(),
+ l, e));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(),
+ l, e));
+ }
+ } else if (e == null) {
+ errorHandler.error(new CSSParseException("error", l, null));
+ } else {
+ errorHandler.error(new CSSParseException(e.getMessage(), l, e));
+ }
+ }
+ }
+
+ private void reportWarningSkipText(Locator l, String text) {
+ if (errorHandler != null && text != null) {
+ errorHandler.warning(new CSSParseException("Skipping: " + text, l));
+ }
+ }
+}
+
+PARSER_END(Parser)
+
+/*
+ * The tokenizer
+ */
+
+<DEFAULT>
+TOKEN :
+{
+ < S : ( [ " ", "\t" , "\n" , "\r", "\f" ] )+ >
+ { image = Parser.SPACE; }
+}
+
+<DEFAULT>
+MORE : /* Comments */
+{
+ < "/*" > : IN_COMMENT
+}
+
+<IN_COMMENT>
+SKIP :
+{
+ < "*/" > : DEFAULT
+}
+
+<IN_COMMENT>
+MORE :
+{
+ < ~[] > : IN_COMMENT
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < CDO : "<!--" >
+ | < CDC : "-->" >
+ | < LBRACE : "{" >
+ | < RBRACE : "}">
+ | < DASHMATCH : "|=" >
+ | < INCLUDES : "~=" >
+ | < EQ : "=" >
+ | < PLUS : "+" >
+ | < MINUS : "-" >
+ | < COMMA : "," >
+ | < SEMICOLON : ";" >
+ | < PRECEDES : ">" >
+ | < DIV : "/" >
+ | < LBRACKET : "[" >
+ | < RBRACKET : "]" >
+ | < ANY : "*" >
+ | < DOT : "." >
+ | < LPARAN : ")" >
+ | < RPARAN : "(">
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < COLON : ":" >
+}
+
+<DEFAULT>
+TOKEN : /* basic tokens */
+{
+ < NONASCII : ["\200"-"\377"] >
+ | < #H : ["0"-"9", "a"-"f"] >
+ | < #UNICODE : "\\" <H> ( <H> )? /* I can't say {1,6} */
+ ( <H> )? ( <H> )?
+ ( <H> )? ( <H> )?
+ ( [ " ", "\t" , "\n" , "\r", "\f" ] )? >
+ | < #ESCAPE : <UNICODE> | ( "\\" [ " "-"~","\200"-"\377" ] ) >
+ | < #NMSTART : [ "a"-"z" ] | <NONASCII> | <ESCAPE> >
+ | < #NMCHAR : ["a"-"z", "0"-"9", "-"] | <NONASCII> | <ESCAPE> >
+ | < #STRINGCHAR : [ "\t"," ","!","#","$","%","&","("-"~" ]
+ | "\\\n" | "\\\r\n" | "\\\r" | "\\\f"
+ | <NONASCII> | <ESCAPE> >
+ | < #D : ["0"-"9"] >
+ | < #NAME : ( <NMCHAR> )+ >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < STRING : ( "\"" ( <STRINGCHAR> | "'" )* "\"" ) |
+ ( "'" ( <STRINGCHAR> | "\"" )* "'" ) >
+ | < IDENT : <NMSTART> ( <NMCHAR> )* >
+ | < NUMBER : ( <D> )+ | ( <D> )* "." ( <D> )+ >
+ | < #_URL : [ "!","#","$","%","&","*"-"~" ] | <NONASCII> | <ESCAPE> >
+ | < URL : "url(" ( <S> )*
+ ( <STRING> | ( <_URL> )* ) ( <S> )* ")" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < PERCENTAGE : <NUMBER> "%" >
+ | < PT : <NUMBER> "pt" >
+ | < MM : <NUMBER> "mm" >
+ | < CM : <NUMBER> "cm" >
+ | < PC : <NUMBER> "pc" >
+ | < IN : <NUMBER> "in" >
+ | < PX : <NUMBER> "px" >
+ | < EMS : <NUMBER> "em" >
+ | < EXS : <NUMBER> "ex" >
+ | < DEG : <NUMBER> "deg" >
+ | < RAD : <NUMBER> "rad" >
+ | < GRAD : <NUMBER> "grad" >
+ | < MS : <NUMBER> "ms" >
+ | < SECOND : <NUMBER> "s" >
+ | < HZ : <NUMBER> "Hz" >
+ | < KHZ : <NUMBER> "kHz" >
+ | < DIMEN : <NUMBER> <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < HASH : "#" <NAME> >
+}
+
+/* RESERVED ATRULE WORDS */
+<DEFAULT>
+TOKEN :
+{
+ < IMPORT_SYM : "@import">
+ | < MEDIA_SYM : "@media" >
+ | < CHARSET_SYM : "@charset" >
+ | < PAGE_SYM : "@page" >
+ | < FONT_FACE_SYM: "@font-face" >
+ | < ATKEYWORD : "@" <IDENT> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < IMPORTANT_SYM : "!" ( <S> )? "important" >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < #RANGE0 : <H> <H> <H> <H> <H> >
+ | < #RANGE1 : <H> <H> <H> <H> <H> ( "?" )? >
+ | < #RANGE2 : <H> <H> <H> <H> ( "?" )? ( "?" )? >
+ | < #RANGE3 : <H> <H> <H> ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE4 : <H> <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE5 : <H> ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE6 : "?" ( "?" )? ( "?" )? ( "?" )? ( "?" )? ( "?" )? >
+ | < #RANGE : <RANGE0> | <RANGE1> | <RANGE2>
+ | <RANGE3> | <RANGE4> | <RANGE5> | <RANGE6> >
+ | < #UNI : <H> ( <H> )? ( <H> )? ( <H> )? ( <H> )? ( <H> )? >
+ | < UNICODERANGE : "U+" <RANGE>
+ | "U+" <UNI> "-" <UNI> >
+}
+
+<DEFAULT>
+TOKEN :
+{
+ < FUNCTION : <IDENT> "(" >
+}
+
+<DEFAULT, IN_COMMENT>
+TOKEN :
+{ /* avoid token manager error */
+ < UNKNOWN : ~[] >
+}
+
+/*
+ * The grammar of CSS2
+ */
+
+/**
+ * The main entry for the parser.
+ *
+ * @exception ParseException exception during the parse
+ */
+void parserUnit() :
+{}
+{
+ try {
+ { documentHandler.startDocument(source); }
+ ( charset() )?
+ ( <S> | ignoreStatement() )*
+ ( importDeclaration() ( ignoreStatement() ( <S> )* )* )*
+ afterImportDeclaration()
+ <EOF>
+ } finally {
+ documentHandler.endDocument(source);
+ }
+}
+
+
+void charset() :
+{ Token n; }
+{
+ try {
+ <CHARSET_SYM> ( <S> )* n=<STRING> ( <S> )* ";"
+ } catch (ParseException e) {
+ reportError(getLocator(e.currentToken.next), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (Exception e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ }
+}
+
+void afterImportDeclaration() :
+{String ret;
+ Locator l;
+}
+{
+ ( ( styleRule() | media() | page() | fontFace()
+ | { l = getLocator(); } ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ reportWarningSkipText(l, ret);
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+ )
+ ( ignoreStatement() ( <S> )* )* )*
+}
+
+void ignoreStatement() :
+{}
+{
+ <CDO> | <CDC> | atRuleDeclaration()
+}
+
+/**
+ * The import statement
+ *
+ * @exception ParseException exception during the parse
+ */
+void importDeclaration() :
+{Token n;
+ String uri;
+ MediaListImpl ml = new MediaListImpl();
+}
+{
+ try {
+ <IMPORT_SYM>
+ ( <S> )* ( n=<STRING> { uri = convertStringIndex(n.image, 1,
+ n.image.length() -1); }
+ | n=<URL>
+ {
+ uri = n.image.substring(4, n.image.length()-1).trim();
+ if ((uri.charAt(0) == '"')
+ || (uri.charAt(0) == '\'')) {
+ uri = uri.substring(1, uri.length()-1);
+ }
+ }
+ )
+ ( <S> )* ( mediaStatement(ml) )? ";"
+ ( <S> )*
+ {
+ if (ml.getLength() == 0) {
+ // see section 6.3 of the CSS2 recommandation.
+ ml.addItem("all");
+ }
+ documentHandler.importStyle(uri, ml, null);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void media() :
+{
+ boolean start = false;
+ String ret;
+ MediaListImpl ml = new MediaListImpl();
+}
+{
+ try {
+ <MEDIA_SYM> ( <S> )*
+ mediaStatement(ml)
+ { start = true; documentHandler.startMedia(ml); }
+ <LBRACE> ( <S> )* ( styleRule() | skipUnknownRule() )* <RBRACE> ( <S> )*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endMedia(ml);
+ }
+ }
+}
+
+void mediaStatement(MediaListImpl ml) :
+{
+ String m;
+}
+{
+ m=medium() ( <COMMA> ( <S> )* { ml.addItem(m); } m=medium() )*
+ { ml.addItem(m); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String medium() : /* tv, projection, screen, ... */
+{Token n;}
+{
+ n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void page() :
+{
+ boolean start = false;
+ Token n = null;
+ String page = null;
+ String pseudo = null;
+}
+{
+ try {
+ <PAGE_SYM> ( <S> )* ( n=<IDENT> ( <S> )* )?
+ ( pseudo=pseudo_page() )?
+ {
+ if (n != null) {
+ page = convertIdent(n.image);
+ }
+ }
+ <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startPage(page, pseudo);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ skipStatement();
+ // reportWarningSkipText(li, skipStatement());
+ } else {
+ skipStatement();
+ }
+ } finally {
+ if (start) {
+ documentHandler.endPage(page, pseudo);
+ }
+ }
+}
+
+String pseudo_page() :
+{ Token n; }
+{
+ ":" n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+void fontFace() :
+{
+ boolean start = false;
+}
+{
+ try {
+ <FONT_FACE_SYM> ( <S> )*
+ <LBRACE> (<S>)*
+ { start = true; documentHandler.startFontFace(); }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endFontFace();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void atRuleDeclaration() :
+{Token n;
+ String ret;
+}
+{
+ n=<ATKEYWORD>
+ {
+ ret=skipStatement();
+ reportWarningSkipText(getLocator(), ret);
+ if ((ret != null) && (ret.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+void skipUnknownRule() :
+{ Token n;}
+{
+ ( n=<ATKEYWORD>
+| n=<CDO>
+| n=<CHARSET_SYM>
+| n=<COMMA>
+| n=<DASHMATCH>
+| n=<FONT_FACE_SYM>
+| n=<FUNCTION>
+| n=<IMPORTANT_SYM>
+| n=<IMPORT_SYM>
+| n=<INCLUDES>
+| n=<LBRACE>
+| n=<MEDIA_SYM>
+| n=<NONASCII>
+| n=<NUMBER>
+| n=<PAGE_SYM>
+| n=<PERCENTAGE>
+| n=<STRING>
+| n=<UNICODERANGE>
+| n=<URL>
+| n=";"
+| n="+"
+| n=">"
+| n="-"
+| n=<UNKNOWN>
+ ) {
+ String ret;
+ Locator loc = getLocator();
+ ret=skipStatement();
+ reportWarningSkipText(loc, ret);
+ if ((ret != null) && (n.image.charAt(0) == '@')) {
+ documentHandler.ignorableAtRule(ret);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+char combinator() :
+{
+char connector = ' ';
+}
+{
+ "+" ( <S> )* { return '+'; }
+ | ">" ( <S> )* { return '>'; }
+| <S> ( ( "+" { connector = '+'; }
+ | ">" { connector = '>'; } )
+ ( <S> )* )? { return connector; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+String property() :
+{Token n; }
+{
+ n=<IDENT> ( <S> )* { return convertIdent(n.image); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void styleRule() :
+{
+ boolean start = false;
+ SelectorList l = null;
+ Token save;
+ Locator loc;
+}
+{
+ try {
+ l=selectorList() { save = token; } <LBRACE> (<S>)*
+ {
+ start = true;
+ documentHandler.startSelector(l);
+ }
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ <RBRACE> (<S>)*
+ } catch (ThrowedParseException e) {
+ if (errorHandler != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.e.currentToken.next.beginLine,
+ e.e.currentToken.next.beginColumn-1);
+ reportError(li, e.e);
+ }
+ } catch (ParseException e) {
+ reportError(getLocator(), e);
+ skipStatement();
+ // reportWarningSkipText(getLocator(), skipStatement());
+ } catch (TokenMgrError e) {
+ reportWarningSkipText(getLocator(), skipStatement());
+ } finally {
+ if (start) {
+ documentHandler.endSelector(l);
+ }
+ }
+}
+
+SelectorList selectorList() :
+{
+ SelectorListImpl selectors = new SelectorListImpl();
+ Selector selector;
+}
+{
+ selector=selector() ( <COMMA> (<S>)* { selectors.addSelector(selector); }
+ selector=selector() )*
+ { selectors.addSelector(selector);
+ return selectors;
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Selector selector() :
+{
+ Selector selector;
+ char comb;
+}
+{
+ try {
+ selector=simple_selector(null, ' ')
+ ( LOOKAHEAD(2) comb=combinator()
+ selector=simple_selector(selector, comb) )* (<S>)*
+ {
+ return selector;
+ }
+ } catch (ParseException e) {
+ /*
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+ reportWarningSkipText(getLocator(), s.toString());
+ */
+ Token t = getToken(1);
+ while ((t.kind != COMMA) && (t.kind != SEMICOLON)
+ && (t.kind != LBRACE) && (t.kind != EOF)) {
+ getNextToken();
+ t = getToken(1);
+ }
+
+ throw new ThrowedParseException(e);
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Selector simple_selector(Selector selector, char comb) :
+{
+ SimpleSelector simple_current = null;
+ Condition cond = null;
+
+ pseudoElt = null;
+}
+{
+ ( simple_current=element_name()
+ ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=hash(cond) ( cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=_class(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=pseudo(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ | cond=attrib(cond) ( cond=hash(cond) | cond=_class(cond)
+ | cond=attrib(cond) | cond=pseudo(cond) )*
+ )
+ {
+ if (simple_current == null) {
+ simple_current = selectorFactory.createElementSelector(null, null);
+ }
+ if (cond != null) {
+ simple_current = selectorFactory.createConditionalSelector(simple_current,
+ cond);
+ }
+ if (selector != null) {
+ switch (comb) {
+ case ' ':
+ selector = selectorFactory.createDescendantSelector(selector,
+ simple_current);
+ break;
+ case '+':
+ selector =
+ selectorFactory.createDirectAdjacentSelector((short) 1,
+ selector,
+ simple_current);
+ break;
+ case '>':
+ selector = selectorFactory.createChildSelector(selector,
+ simple_current);
+ break;
+ default:
+ throw new ParseException("invalid state. send a bug report");
+ }
+ } else {
+ selector= simple_current;
+ }
+ if (pseudoElt != null) {
+ selector = selectorFactory.createChildSelector(selector,
+ selectorFactory.createPseudoElementSelector(null, pseudoElt));
+ }
+ return selector;
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Condition _class(Condition pred) :
+{Token n;
+Condition c;
+}
+{
+ "." n=<IDENT>
+ {
+ c = conditionFactory.createClassCondition(null, n.image);
+ if (pred == null) {
+ return c;
+ } else {
+ return conditionFactory.createAndCondition(pred, c);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+SimpleSelector element_name() :
+{Token n; }
+{
+ n=<IDENT>
+ {
+ return selectorFactory.createElementSelector(null, convertIdent(n.image));
+ }
+ | "*"
+ { return selectorFactory.createElementSelector(null, null); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Condition attrib(Condition pred) :
+{
+ int cases = 0;
+ Token att = null;
+ Token val = null;
+ String attValue = null;
+}
+{
+ "[" ( <S> )* att=<IDENT> ( <S> )*
+ ( ( "=" { cases = 1; }
+ | <INCLUDES> { cases = 2; }
+ | <DASHMATCH> { cases = 3; } ) ( <S> )*
+ ( val=<IDENT> { attValue = val.image; }
+ | val=<STRING> { attValue = convertStringIndex(val.image, 1,
+ val.image.length() -1);}
+ )
+ ( <S> )* )?
+ "]"
+ {
+ String name = convertIdent(att.image);
+ Condition c;
+ switch (cases) {
+ case 0:
+ c = conditionFactory.createAttributeCondition(name, null, false, null);
+ break;
+ case 1:
+ c = conditionFactory.createAttributeCondition(name, null, false,
+ attValue);
+ break;
+ case 2:
+ c = conditionFactory.createOneOfAttributeCondition(name, null, false,
+ attValue);
+ break;
+ case 3:
+ c = conditionFactory.createBeginHyphenAttributeCondition(name, null,
+ false,
+ attValue);
+ break;
+ default:
+ // never reached.
+ c = null;
+ }
+ if (pred == null) {
+ return c;
+ } else {
+ return conditionFactory.createAndCondition(pred, c);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Condition pseudo(Condition pred) :
+{Token n;
+Token language;
+}
+{
+ ":" ( n=<IDENT>
+ {
+ String s = convertIdent(n.image);
+ if (s.equals("first-letter") || s.equals("first-line")) {
+ if (pseudoElt != null) {
+ throw new CSSParseException("duplicate pseudo element definition "
+ + s, getLocator());
+ } else {
+ pseudoElt = s;
+ return pred;
+ }
+ } else {
+ Condition c =
+ conditionFactory.createPseudoClassCondition(null, s);
+ if (pred == null) {
+ return c;
+ } else {
+ return conditionFactory.createAndCondition(pred, c);
+ }
+ }
+ }
+ | ( n=<FUNCTION> ( <S> )* language=<IDENT> ( <S> )* ")"
+ {
+ String f = convertIdent(n.image);
+ if (f.equals("lang(")) {
+ Condition d =
+ conditionFactory.createLangCondition(convertIdent(language.image));
+ if (pred == null) {
+ return d;
+ } else {
+ return conditionFactory.createAndCondition(pred, d);
+ }
+ } else {
+ throw new CSSParseException("invalid pseudo function name "
+ + f, getLocator());
+ }
+ }
+ )
+ )
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+Condition hash(Condition pred) :
+{Token n; }
+{
+ n=<HASH>
+ {
+ Condition d =
+ conditionFactory.createIdCondition(n.image.substring(1));
+ if (pred == null) {
+ return d;
+ } else {
+ return conditionFactory.createAndCondition(pred, d);
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+void declaration() :
+{ boolean important = false;
+ String name;
+ LexicalUnit exp;
+ Token save;
+}
+{
+ try {
+ name=property()
+ { save = token; }
+ ":" ( <S> )* exp=expr() ( important=prio() )?
+ {
+ documentHandler.property(name, exp, important);
+ }
+ } catch (JumpException e) {
+ skipAfterExpression();
+ // reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (NumberFormatException e) {
+ if (errorHandler != null) {
+ errorHandler.error(new CSSParseException("Invalid number "
+ + e.getMessage(),
+ getLocator(),
+ e));
+ }
+ reportWarningSkipText(getLocator(), skipAfterExpression());
+ } catch (ParseException e) {
+ if (errorHandler != null) {
+ if (e.currentToken != null) {
+ LocatorImpl li = new LocatorImpl(this,
+ e.currentToken.next.beginLine,
+ e.currentToken.next.beginColumn-1);
+ reportError(li, e);
+ } else {
+ reportError(getLocator(), e);
+ }
+ skipAfterExpression();
+ /*
+ LocatorImpl loc = (LocatorImpl) getLocator();
+ loc.column--;
+ reportWarningSkipText(loc, skipAfterExpression());
+ */
+ } else {
+ skipAfterExpression();
+ }
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+boolean prio() :
+{}
+{
+ <IMPORTANT_SYM> ( <S> )* { return true; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl operator(LexicalUnitImpl prev) :
+{Token n;}
+{
+n="/" ( <S> )* { return LexicalUnitImpl.createSlash(n.beginLine,
+ n.beginColumn,
+ prev); }
+| n="," ( <S> )* { return LexicalUnitImpl.createComma(n.beginLine,
+ n.beginColumn,
+ prev); }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnit expr() :
+{
+ LexicalUnitImpl first, res;
+ char op;
+}
+{
+ first=term(null) { res = first; }
+ ( ( res=operator(res) )? res=term(res) )*
+ { return first; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+char unaryOperator() :
+{}
+{
+ "-" { return '-'; }
+| "+" { return '+'; }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl term(LexicalUnitImpl prev) :
+{ LexicalUnitImpl result = null;
+ Token n = null;
+ char op = ' ';
+}
+{
+ ( ( ( op=unaryOperator() )?
+ ( n=<NUMBER>
+ { result = LexicalUnitImpl.createNumber(n.beginLine, n.beginColumn,
+ prev, number(op, n, 0)); }
+ | n=<PERCENTAGE>
+ { result = LexicalUnitImpl.createPercentage(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<PT>
+ { result = LexicalUnitImpl.createPT(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<CM>
+ { result = LexicalUnitImpl.createCM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<MM>
+ { result = LexicalUnitImpl.createMM(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PC>
+ { result = LexicalUnitImpl.createPC(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<IN>
+ { result = LexicalUnitImpl.createIN(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<PX>
+ { result = LexicalUnitImpl.createPX(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EMS>
+ { result = LexicalUnitImpl.createEMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<EXS>
+ { result = LexicalUnitImpl.createEXS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<DEG>
+ { result = LexicalUnitImpl.createDEG(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<RAD>
+ { result = LexicalUnitImpl.createRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<GRAD>
+ { result = LexicalUnitImpl.createGRAD(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<SECOND>
+ { result = LexicalUnitImpl.createS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 1)); }
+ | n=<MS>
+ { result = LexicalUnitImpl.createMS(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<HZ>
+ { result = LexicalUnitImpl.createHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 2)); }
+ | n=<KHZ>
+ { result = LexicalUnitImpl.createKHZ(n.beginLine, n.beginColumn,
+ prev, number(op, n, 3)); }
+ | n=<DIMEN>
+ {
+ String s = n.image;
+ int i = 0;
+ while (i < s.length()
+ && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) {
+ i++;
+ }
+ result = LexicalUnitImpl.createDimen(n.beginLine, n.beginColumn, prev,
+ Float.valueOf(s.substring(0, i)).floatValue(),
+ s.substring(i));
+ }
+ | result=function(op, prev) ) )
+ | ( n=<STRING>
+ { result =
+ LexicalUnitImpl.createString(n.beginLine, n.beginColumn, prev,
+ convertStringIndex(n.image, 1,
+ n.image.length() -1));}
+ | n=<IDENT>
+ { String s = convertIdent(n.image);
+ if ("inherit".equals(s)) {
+ result = LexicalUnitImpl.createInherit(n.beginLine, n.beginColumn,
+ prev);
+ } else {
+ result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn,
+ prev, convertIdent(n.image));
+ }
+
+ /* /
+ Auto correction code used in the CSS Validator but must not
+ be used by a conformant CSS2 parser.
+ * Common error :
+ * H1 {
+ * color : black
+ * background : white
+ * }
+ *
+ Token t = getToken(1);
+ Token semicolon = new Token();
+ semicolon.kind = SEMICOLON;
+ semicolon.image = ";";
+ if (t.kind == COLON) {
+ // @@SEEME. (generate a warning?)
+ // @@SEEME if expression is a single ident,
+ generate an error ?
+ rejectToken(semicolon);
+
+ result = prev;
+ }
+ / */
+ }
+ | result=hexcolor(prev)
+ | result=url(prev)
+ | result=unicode(prev)
+ ) ) ( <S> )*
+ {
+ return result;
+ }
+}
+
+/**
+ * Handle all CSS2 functions.
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl function(char operator, LexicalUnitImpl prev) :
+{Token n;
+ LexicalUnit params = null;
+}
+{
+ n=<FUNCTION> ( <S> )* ( params=expr() )? ")"
+ {
+ if (operator != ' ') {
+ throw new CSSParseException("invalid operator before a function.",
+ getLocator());
+ }
+ String f = convertIdent(n.image);
+ LexicalUnitImpl l = (LexicalUnitImpl) params;
+ boolean loop = true;
+ if ("rgb(".equals(f)) {
+ // this is a RGB declaration (e.g. rgb(255, 50%, 0) )
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ if ((l.getLexicalUnitType() != LexicalUnit.SAC_INTEGER)
+ && (l.getLexicalUnitType() != LexicalUnit.SAC_PERCENTAGE)) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ if (loop) {
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ }
+ if ((i == 5) && loop && (l == null)) {
+ return LexicalUnitImpl.createRGBColor(n.beginLine,
+ n.beginColumn,
+ prev, params);
+ } else {
+ if (errorHandler != null) {
+ String errorText;
+ Locator loc;
+ if (i < 5) {
+ if (params == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters.";
+ } else if (l == null) {
+ loc = new LocatorImpl(this, n.beginLine,
+ n.beginColumn-1);
+ errorText = "not enough parameters: "
+ + params.toString();
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "invalid parameter: "
+ + l.toString();
+ }
+ } else {
+ loc = new LocatorImpl(this, l.getLineNumber(),
+ l.getColumnNumber());
+ errorText = "too many parameters: "
+ + l.toString();
+ }
+ errorHandler.error(new CSSParseException(errorText, loc));
+ }
+
+ throw new JumpException();
+ }
+ } else if ("counter".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 3) {
+ switch (i) {
+ case 0:
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 1:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 1) || (i == 3)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounter(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+
+ } else if ("counters(".equals(f)) {
+
+ int i = 0;
+ while (loop && l != null && i < 5) {
+ switch (i) {
+ case 0:
+ case 4:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
+ loop = false;
+ }
+ break;
+ case 2:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_STRING_VALUE) {
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if (((i == 3) || (i == 5)) && loop && (l == null)) {
+ return LexicalUnitImpl.createCounters(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ } else if ("attr(".equals(f)) {
+ if ((l != null)
+ && (l.getNextLexicalUnit() == null)
+ && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) {
+ return LexicalUnitImpl.createAttr(l.getLineNumber(),
+ l.getColumnNumber(),
+ prev, l.getStringValue());
+ }
+ } else if ("rect(".equals(f)) {
+ int i = 0;
+ while (loop && l != null && i < 7) {
+ switch (i) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ switch (l.getLexicalUnitType()) {
+ case LexicalUnit.SAC_INTEGER:
+ if (l.getIntegerValue() != 0) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_IDENT:
+ if (!l.getStringValue().equals("auto")) {
+ loop = false;
+ }
+ break;
+ case LexicalUnit.SAC_EM:
+ case LexicalUnit.SAC_EX:
+ case LexicalUnit.SAC_PIXEL:
+ case LexicalUnit.SAC_CENTIMETER:
+ case LexicalUnit.SAC_MILLIMETER:
+ case LexicalUnit.SAC_INCH:
+ case LexicalUnit.SAC_POINT:
+ case LexicalUnit.SAC_PICA:
+ // nothing
+ break;
+ default:
+ loop = false;
+ }
+ break;
+ case 1:
+ case 3:
+ case 5:
+ if (l.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
+ loop = false;
+ }
+ break;
+ default:
+ throw new ParseException("implementation error");
+ }
+ l = (LexicalUnitImpl) l.getNextLexicalUnit();
+ i ++;
+ }
+ if ((i == 7) && loop && (l == null)) {
+ return LexicalUnitImpl.createRect(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+ }
+ return LexicalUnitImpl.createFunction(n.beginLine, n.beginColumn, prev,
+ f.substring(0,
+ f.length() -1),
+ params);
+ }
+}
+
+LexicalUnitImpl unicode(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<UNICODERANGE>
+ {
+ LexicalUnitImpl params = null;
+ String s = n.image.substring(2);
+ int index = s.indexOf('-');
+ if (index == -1) {
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s, 16));
+ } else {
+ String s1 = s.substring(0, index);
+ String s2 = s.substring(index);
+
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s1, 16));
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, Integer.parseInt(s2, 16));
+ }
+
+ return LexicalUnitImpl.createUnicodeRange(n.beginLine, n.beginColumn,
+ prev, params);
+ }
+}
+
+LexicalUnitImpl url(LexicalUnitImpl prev) :
+{ Token n;
+}
+{
+ n=<URL>
+ {
+ String urlname = n.image.substring(4, n.image.length()-1).trim();
+ if (urlname.charAt(0) == '"'
+ || urlname.charAt(0) == '\'') {
+ urlname = urlname.substring(1, urlname.length()-1);
+ }
+ return LexicalUnitImpl.createURL(n.beginLine, n.beginColumn, prev, urlname);
+ }
+}
+
+/**
+ * @exception ParseException exception during the parse
+ */
+LexicalUnitImpl hexcolor(LexicalUnitImpl prev) :
+{Token n;
+}
+{
+ n=<HASH>
+ {
+ int r;
+ LexicalUnitImpl first, params = null;
+ String s = n.image.substring(1);
+
+ if (s.length() == 3) {
+ String sh = s.substring(0,1);
+ r = Integer.parseInt(sh+sh, 16);
+ first = params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ sh = s.substring(1,2);
+ r = Integer.parseInt(sh+sh, 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ sh = s.substring(2,3);
+ r = Integer.parseInt(sh+sh, 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ } else if (s.length() == 6) {
+ r = Integer.parseInt(s.substring(0,2), 16);
+ first = params = LexicalUnitImpl.createInteger(n.beginLine,
+ n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ r = Integer.parseInt(s.substring(2,4), 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ params = LexicalUnitImpl.createComma(n.beginLine, n.beginColumn,
+ params);
+ r = Integer.parseInt(s.substring(4,6), 16);
+ params = LexicalUnitImpl.createInteger(n.beginLine, n.beginColumn,
+ params, r);
+ } else {
+ first = null;
+ throw new CSSParseException("invalid hexadecimal notation for RGB: " + s,
+ getLocator());
+ }
+ return LexicalUnitImpl.createRGBColor(n.beginLine, n.beginColumn,
+ prev, first);
+ }
+}
+
+JAVACODE
+float number(char operator, Token n, int lengthUnit) {
+ String image = n.image;
+ float f = 0;
+
+ if (lengthUnit != 0) {
+ image = image.substring(0, image.length() - lengthUnit);
+ }
+ f = Float.valueOf(image).floatValue();
+ return (operator == '-')? -f: f;
+}
+
+JAVACODE
+String skipStatement() {
+ StringBuffer s = new StringBuffer();
+ Token tok = getToken(0);
+ if (tok.image != null) {
+ s.append(tok.image);
+ }
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ return null;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ getNextToken();
+ s.append(skip_to_matching_brace());
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == RBRACE) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ } else if (tok.kind == SEMICOLON) {
+ getNextToken();
+ tok = getToken(1);
+ break;
+ }
+ getNextToken();
+ }
+
+ // skip white space
+ while (true) {
+ if (tok.kind != S) {
+ break;
+ }
+ tok = getNextToken();
+ tok = getToken(1);
+ }
+
+ return s.toString().trim();
+}
+
+JAVACODE
+String skip_to_matching_brace() {
+ StringBuffer s = new StringBuffer();
+ Token tok;
+ int nesting = 1;
+ while (true) {
+ tok = getToken(1);
+ if (tok.kind == EOF) {
+ break;
+ }
+ s.append(tok.image);
+ if (tok.kind == LBRACE) {
+ nesting++;
+ } else if (tok.kind == RBRACE) {
+ nesting--;
+ if (nesting == 0) {
+ break;
+ }
+ }
+ getNextToken();
+ }
+ return s.toString();
+}
+
+/*
+ * Here I handle all CSS2 unicode character stuffs.
+ * I convert all \XXXXXX character into a single character.
+ * Don't forget that the parser has recognize the token before.
+ * (So IDENT won't contain newline and stuffs like this).
+ */
+JAVACODE
+String convertStringIndex(String s, int start, int len) {
+ StringBuffer buf = new StringBuffer(len);
+ int index = start;
+
+ while (index < len) {
+ char c = s.charAt(index);
+ if (c == '\\') {
+ if (++index < len) {
+ c = s.charAt(index);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ int numValue = Character.digit(c, 16);
+ int count = 0;
+ int p = 16;
+
+ while (index + 1 < len && count < 6) {
+ c = s.charAt(index+1);
+
+ if (Character.digit(c, 16) != -1) {
+ numValue = (numValue * 16) + Character.digit(c, 16);
+ p *= 16;
+ index++;
+ } else {
+ if (c == ' ') {
+ // skip the latest white space
+ index++;
+ }
+ break;
+ }
+ }
+ buf.append((char) numValue);
+ break;
+ case '\n':
+ case '\f':
+ break;
+ case '\r':
+ if (index + 1 < len) {
+ if (s.charAt(index + 1) == '\n') {
+ index ++;
+ }
+ }
+ break;
+ default:
+ buf.append(c);
+ }
+ } else {
+ throw new CSSParseException("invalid string " + s, getLocator());
+ }
+ } else {
+ buf.append(c);
+ }
+ index++;
+ }
+
+ return buf.toString();
+}
+
+JAVACODE
+String convertIdent(String s) {
+ return convertStringIndex(s, 0, s.length());
+}
+
+JAVACODE
+String convertString(String s) {
+ return convertStringIndex(s, 0, s.length());
+}
+
+/*
+ * @@HACK
+ * I can't insert a token into the tokens flow.
+ * It's jj_consume_token implementation dependant! :-(
+ */
+JAVACODE
+void rejectToken(Token t) {
+ Token fakeToken = new Token();
+ t.next = token;
+ fakeToken.next = t;
+ token = fakeToken;
+}
+
+/**
+ * skip after an expression
+ */
+JAVACODE
+String skipAfterExpression() {
+ Token t = getToken(1);
+ StringBuffer s = new StringBuffer();
+ s.append(getToken(0).image);
+
+ while ((t.kind != RBRACE) && (t.kind != SEMICOLON) && (t.kind != EOF)) {
+ s.append(t.image);
+ getNextToken();
+ t = getToken(1);
+ }
+
+ return s.toString();
+}
+
+
+/**
+ * The following functions are useful for a DOM CSS implementation only and are
+ * not part of the general CSS2 parser.
+ */
+
+void _parseRule() :
+{String ret = null;
+}
+{
+ ( <S> )*
+ ( importDeclaration() | styleRule() | media() | page()
+ | fontFace() | ret=skipStatement()
+ {
+ if ((ret == null) || (ret.length() == 0)) {
+ return;
+ }
+ if (ret.charAt(0) == '@') {
+ documentHandler.ignorableAtRule(ret);
+ } else {
+ throw new CSSParseException("unrecognize rule: " + ret,
+ getLocator());
+ }
+ }
+ )
+}
+
+void _parseImportRule() :
+{
+}
+{
+ ( <S> )* importDeclaration()
+}
+
+void _parseMediaRule() :
+{
+}
+{
+ ( <S> )* media()
+}
+
+void _parseDeclarationBlock() :
+{
+}
+{
+ ( <S> )*
+ ( declaration() )? ( ";" ( <S> )* ( declaration() )? )*
+ }
+
+SelectorList _parseSelectors() :
+{ SelectorList p = null;
+}
+{
+ try {
+ ( <S> )* p = selectorList()
+ { return p; }
+ } catch (ThrowedParseException e) {
+ throw (ParseException) e.e.fillInStackTrace();
+ }
+}
+
+/*
+ * Local Variables:
+ * compile-command: javacc Parser.jj & javac Parser.java
+ * End:
+ */
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserConstants.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,162 @@
+/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */
+package org.w3c.flute.parser;
+
+public interface ParserConstants {
+
+ int EOF = 0;
+ int S = 1;
+ int CDO = 5;
+ int CDC = 6;
+ int LBRACE = 7;
+ int RBRACE = 8;
+ int DASHMATCH = 9;
+ int INCLUDES = 10;
+ int EQ = 11;
+ int PLUS = 12;
+ int MINUS = 13;
+ int COMMA = 14;
+ int SEMICOLON = 15;
+ int PRECEDES = 16;
+ int DIV = 17;
+ int LBRACKET = 18;
+ int RBRACKET = 19;
+ int ANY = 20;
+ int DOT = 21;
+ int LPARAN = 22;
+ int RPARAN = 23;
+ int COLON = 24;
+ int NONASCII = 25;
+ int H = 26;
+ int UNICODE = 27;
+ int ESCAPE = 28;
+ int NMSTART = 29;
+ int NMCHAR = 30;
+ int STRINGCHAR = 31;
+ int D = 32;
+ int NAME = 33;
+ int STRING = 34;
+ int IDENT = 35;
+ int NUMBER = 36;
+ int _URL = 37;
+ int URL = 38;
+ int PERCENTAGE = 39;
+ int PT = 40;
+ int MM = 41;
+ int CM = 42;
+ int PC = 43;
+ int IN = 44;
+ int PX = 45;
+ int EMS = 46;
+ int EXS = 47;
+ int DEG = 48;
+ int RAD = 49;
+ int GRAD = 50;
+ int MS = 51;
+ int SECOND = 52;
+ int HZ = 53;
+ int KHZ = 54;
+ int DIMEN = 55;
+ int HASH = 56;
+ int IMPORT_SYM = 57;
+ int MEDIA_SYM = 58;
+ int CHARSET_SYM = 59;
+ int PAGE_SYM = 60;
+ int FONT_FACE_SYM = 61;
+ int ATKEYWORD = 62;
+ int IMPORTANT_SYM = 63;
+ int RANGE0 = 64;
+ int RANGE1 = 65;
+ int RANGE2 = 66;
+ int RANGE3 = 67;
+ int RANGE4 = 68;
+ int RANGE5 = 69;
+ int RANGE6 = 70;
+ int RANGE = 71;
+ int UNI = 72;
+ int UNICODERANGE = 73;
+ int FUNCTION = 74;
+ int UNKNOWN = 75;
+
+ int DEFAULT = 0;
+ int IN_COMMENT = 1;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "<S>",
+ "\"/*\"",
+ "\"*/\"",
+ "<token of kind 4>",
+ "\"<!--\"",
+ "\"-->\"",
+ "\"{\"",
+ "\"}\"",
+ "\"|=\"",
+ "\"~=\"",
+ "\"=\"",
+ "\"+\"",
+ "\"-\"",
+ "\",\"",
+ "\";\"",
+ "\">\"",
+ "\"/\"",
+ "\"[\"",
+ "\"]\"",
+ "\"*\"",
+ "\".\"",
+ "\")\"",
+ "\"(\"",
+ "\":\"",
+ "<NONASCII>",
+ "<H>",
+ "<UNICODE>",
+ "<ESCAPE>",
+ "<NMSTART>",
+ "<NMCHAR>",
+ "<STRINGCHAR>",
+ "<D>",
+ "<NAME>",
+ "<STRING>",
+ "<IDENT>",
+ "<NUMBER>",
+ "<_URL>",
+ "<URL>",
+ "<PERCENTAGE>",
+ "<PT>",
+ "<MM>",
+ "<CM>",
+ "<PC>",
+ "<IN>",
+ "<PX>",
+ "<EMS>",
+ "<EXS>",
+ "<DEG>",
+ "<RAD>",
+ "<GRAD>",
+ "<MS>",
+ "<SECOND>",
+ "<HZ>",
+ "<KHZ>",
+ "<DIMEN>",
+ "<HASH>",
+ "\"@import\"",
+ "\"@media\"",
+ "\"@charset\"",
+ "\"@page\"",
+ "\"@font-face\"",
+ "<ATKEYWORD>",
+ "<IMPORTANT_SYM>",
+ "<RANGE0>",
+ "<RANGE1>",
+ "<RANGE2>",
+ "<RANGE3>",
+ "<RANGE4>",
+ "<RANGE5>",
+ "<RANGE6>",
+ "<RANGE>",
+ "<UNI>",
+ "<UNICODERANGE>",
+ "<FUNCTION>",
+ "<UNKNOWN>",
+ };
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ParserTokenManager.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,3250 @@
+/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */
+package org.w3c.flute.parser;
+import java.io.*;
+import java.net.*;
+import java.util.Locale;
+import org.w3c.css.sac.ConditionFactory;
+import org.w3c.css.sac.Condition;
+import org.w3c.css.sac.SelectorFactory;
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+import org.w3c.css.sac.SimpleSelector;
+import org.w3c.css.sac.DocumentHandler;
+import org.w3c.css.sac.InputSource;
+import org.w3c.css.sac.ErrorHandler;
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.Locator;
+import org.w3c.css.sac.LexicalUnit;
+import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
+import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
+import org.w3c.flute.util.Encoding;
+
+public class ParserTokenManager implements ParserConstants
+{
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjMoveStringLiteralDfa0_1()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_1(0x8L);
+ default :
+ return 1;
+ }
+}
+private final int jjMoveStringLiteralDfa1_1(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x8L) != 0L)
+ return jjStopAtPos(1, 3);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x200000L) != 0L)
+ return 335;
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ return 48;
+ return -1;
+ case 1:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 1;
+ return 336;
+ }
+ return -1;
+ case 2:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 2;
+ return 336;
+ }
+ return -1;
+ case 3:
+ if ((active0 & 0x3e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 3;
+ return 336;
+ }
+ return -1;
+ case 4:
+ if ((active0 & 0x2e00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 4;
+ return 336;
+ }
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 5:
+ if ((active0 & 0x2a00000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 5;
+ return 336;
+ }
+ if ((active0 & 0x400000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 6:
+ if ((active0 & 0x2800000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 6;
+ return 336;
+ }
+ if ((active0 & 0x200000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 7:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 7;
+ return 336;
+ }
+ if ((active0 & 0x800000000000000L) != 0L)
+ return 336;
+ return -1;
+ case 8:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ {
+ jjmatchedKind = 62;
+ jjmatchedPos = 8;
+ return 336;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 40:
+ return jjStopAtPos(0, 23);
+ case 41:
+ return jjStopAtPos(0, 22);
+ case 42:
+ return jjStopAtPos(0, 20);
+ case 43:
+ return jjStopAtPos(0, 12);
+ case 44:
+ return jjStopAtPos(0, 14);
+ case 45:
+ jjmatchedKind = 13;
+ return jjMoveStringLiteralDfa1_0(0x40L);
+ case 46:
+ return jjStartNfaWithStates_0(0, 21, 335);
+ case 47:
+ jjmatchedKind = 17;
+ return jjMoveStringLiteralDfa1_0(0x4L);
+ case 58:
+ return jjStopAtPos(0, 24);
+ case 59:
+ return jjStopAtPos(0, 15);
+ case 60:
+ return jjMoveStringLiteralDfa1_0(0x20L);
+ case 61:
+ return jjStopAtPos(0, 11);
+ case 62:
+ return jjStopAtPos(0, 16);
+ case 64:
+ return jjMoveStringLiteralDfa1_0(0x3e00000000000000L);
+ case 91:
+ return jjStopAtPos(0, 18);
+ case 93:
+ return jjStopAtPos(0, 19);
+ case 123:
+ return jjStopAtPos(0, 7);
+ case 124:
+ return jjMoveStringLiteralDfa1_0(0x200L);
+ case 125:
+ return jjStopAtPos(0, 8);
+ case 126:
+ return jjMoveStringLiteralDfa1_0(0x400L);
+ default :
+ return jjMoveNfa_0(1, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 33:
+ return jjMoveStringLiteralDfa2_0(active0, 0x20L);
+ case 42:
+ if ((active0 & 0x4L) != 0L)
+ return jjStopAtPos(1, 2);
+ break;
+ case 45:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40L);
+ case 61:
+ if ((active0 & 0x200L) != 0L)
+ return jjStopAtPos(1, 9);
+ else if ((active0 & 0x400L) != 0L)
+ return jjStopAtPos(1, 10);
+ break;
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000000000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0x200000000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20L);
+ case 62:
+ if ((active0 & 0x40L) != 0L)
+ return jjStopAtPos(2, 6);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 45:
+ if ((active0 & 0x20L) != 0L)
+ return jjStopAtPos(3, 5);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa4_0(active0, 0x200000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 60, 336);
+ break;
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000000L);
+ case 65:
+ case 97:
+ if ((active0 & 0x400000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 58, 336);
+ break;
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x200000000000000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000000L);
+ case 84:
+ case 116:
+ if ((active0 & 0x200000000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 57, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+}
+private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000000L);
+ case 84:
+ case 116:
+ if ((active0 & 0x800000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 59, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+}
+private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0);
+}
+private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ if ((active0 & 0x2000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 61, 336);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private final void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 335;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 336:
+ case 49:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 335:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(148, 151);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(145, 147);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(143, 144);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(140, 142);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(135, 139);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(131, 134);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(127, 130);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(124, 126);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(121, 123);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(118, 120);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(115, 117);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 114);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(109, 111);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(106, 108);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(103, 105);
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(101, 102);
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(100);
+ }
+ break;
+ case 1:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAddStates(3, 74);
+ }
+ else if ((0x100003600L & l) != 0L)
+ {
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ }
+ else if (curChar == 46)
+ jjCheckNAddStates(75, 92);
+ else if (curChar == 33)
+ jjCheckNAddTwoStates(67, 76);
+ else if (curChar == 35)
+ jjCheckNAddTwoStates(37, 38);
+ else if (curChar == 39)
+ jjCheckNAddStates(93, 96);
+ else if (curChar == 34)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 0:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 1)
+ kind = 1;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if (curChar == 34)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 3:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 4:
+ if (curChar == 34 && kind > 34)
+ kind = 34;
+ break;
+ case 6:
+ if (curChar == 12)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 8:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 9:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(101, 106);
+ break;
+ case 10:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 11:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(107, 115);
+ break;
+ case 12:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(116, 120);
+ break;
+ case 13:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(121, 126);
+ break;
+ case 14:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(127, 133);
+ break;
+ case 15:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(134, 141);
+ break;
+ case 16:
+ if (curChar == 13)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 17:
+ if (curChar == 10)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 18:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 17;
+ break;
+ case 19:
+ if (curChar == 39)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 20:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 21:
+ if (curChar == 39 && kind > 34)
+ kind = 34;
+ break;
+ case 23:
+ if (curChar == 12)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 25:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 26:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(142, 147);
+ break;
+ case 27:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 28:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(148, 156);
+ break;
+ case 29:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(157, 161);
+ break;
+ case 30:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(162, 167);
+ break;
+ case 31:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(168, 174);
+ break;
+ case 32:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(175, 182);
+ break;
+ case 33:
+ if (curChar == 13)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 34:
+ if (curChar == 10)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 35:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 34;
+ break;
+ case 36:
+ if (curChar == 35)
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 37:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 39:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 40:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(183, 186);
+ break;
+ case 41:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 42:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(187, 193);
+ break;
+ case 43:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(194, 196);
+ break;
+ case 44:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(197, 200);
+ break;
+ case 45:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(201, 205);
+ break;
+ case 46:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(206, 211);
+ break;
+ case 51:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 52:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(212, 215);
+ break;
+ case 53:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 54:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(216, 222);
+ break;
+ case 55:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(223, 225);
+ break;
+ case 56:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(226, 229);
+ break;
+ case 57:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(230, 234);
+ break;
+ case 58:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(235, 240);
+ break;
+ case 60:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(241, 244);
+ break;
+ case 61:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(245, 251);
+ break;
+ case 62:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(252, 254);
+ break;
+ case 63:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(255, 258);
+ break;
+ case 64:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(259, 263);
+ break;
+ case 65:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(264, 269);
+ break;
+ case 66:
+ if (curChar == 33)
+ jjCheckNAddTwoStates(67, 76);
+ break;
+ case 67:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(67, 76);
+ break;
+ case 78:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 80:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 81:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(270, 273);
+ break;
+ case 82:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 83:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(274, 280);
+ break;
+ case 84:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(281, 283);
+ break;
+ case 85:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(284, 287);
+ break;
+ case 86:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(288, 292);
+ break;
+ case 87:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(293, 298);
+ break;
+ case 88:
+ if ((0x3ff200000000000L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 89:
+ if (curChar == 40 && kind > 74)
+ kind = 74;
+ break;
+ case 91:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 92:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(302, 306);
+ break;
+ case 93:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 94:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(307, 314);
+ break;
+ case 95:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(315, 318);
+ break;
+ case 96:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(319, 323);
+ break;
+ case 97:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(324, 329);
+ break;
+ case 98:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(330, 336);
+ break;
+ case 99:
+ if (curChar == 46)
+ jjCheckNAddStates(75, 92);
+ break;
+ case 100:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(100);
+ break;
+ case 101:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(101, 102);
+ break;
+ case 102:
+ if (curChar == 37 && kind > 39)
+ kind = 39;
+ break;
+ case 103:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(103, 105);
+ break;
+ case 106:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(106, 108);
+ break;
+ case 109:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(109, 111);
+ break;
+ case 112:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(112, 114);
+ break;
+ case 115:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(115, 117);
+ break;
+ case 118:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(118, 120);
+ break;
+ case 121:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(121, 123);
+ break;
+ case 124:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(124, 126);
+ break;
+ case 127:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(127, 130);
+ break;
+ case 131:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(131, 134);
+ break;
+ case 135:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(135, 139);
+ break;
+ case 140:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(140, 142);
+ break;
+ case 143:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(143, 144);
+ break;
+ case 145:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(145, 147);
+ break;
+ case 148:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(148, 151);
+ break;
+ case 152:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 2);
+ break;
+ case 154:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 156:
+ if ((0xffffffff00000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 157:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(337, 340);
+ break;
+ case 158:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 159:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(341, 347);
+ break;
+ case 160:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(348, 350);
+ break;
+ case 161:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(351, 354);
+ break;
+ case 162:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(355, 359);
+ break;
+ case 163:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(360, 365);
+ break;
+ case 165:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(366, 369);
+ break;
+ case 166:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(370, 376);
+ break;
+ case 167:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(377, 379);
+ break;
+ case 168:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(380, 383);
+ break;
+ case 169:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(384, 388);
+ break;
+ case 170:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(389, 394);
+ break;
+ case 172:
+ if (curChar == 40)
+ jjCheckNAddStates(395, 400);
+ break;
+ case 173:
+ if ((0xfffffc7a00000000L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 174:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 175:
+ if (curChar == 41 && kind > 38)
+ kind = 38;
+ break;
+ case 177:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 178:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(405, 409);
+ break;
+ case 179:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 180:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(410, 417);
+ break;
+ case 181:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(418, 421);
+ break;
+ case 182:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(422, 426);
+ break;
+ case 183:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(427, 432);
+ break;
+ case 184:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(433, 439);
+ break;
+ case 185:
+ if (curChar == 39)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 186:
+ if ((0xffffff7f00000200L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 187:
+ if (curChar == 39)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 189:
+ if (curChar == 12)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 191:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 192:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(444, 449);
+ break;
+ case 193:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 194:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(450, 458);
+ break;
+ case 195:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(459, 463);
+ break;
+ case 196:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(464, 469);
+ break;
+ case 197:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(470, 476);
+ break;
+ case 198:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(477, 484);
+ break;
+ case 199:
+ if (curChar == 13)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 200:
+ if (curChar == 10)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 201:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 200;
+ break;
+ case 202:
+ if (curChar == 34)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 203:
+ if ((0xfffffffb00000200L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 204:
+ if (curChar == 34)
+ jjCheckNAddTwoStates(174, 175);
+ break;
+ case 206:
+ if (curChar == 12)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 208:
+ if ((0xffffffff00000000L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 209:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(489, 494);
+ break;
+ case 210:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 211:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(495, 503);
+ break;
+ case 212:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(504, 508);
+ break;
+ case 213:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(509, 514);
+ break;
+ case 214:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(515, 521);
+ break;
+ case 215:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(522, 529);
+ break;
+ case 216:
+ if (curChar == 13)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 217:
+ if (curChar == 10)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 218:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 217;
+ break;
+ case 219:
+ if ((0x100003600L & l) != 0L)
+ jjCheckNAddStates(530, 536);
+ break;
+ case 222:
+ if (curChar == 43)
+ jjAddStates(537, 538);
+ break;
+ case 223:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 224;
+ break;
+ case 224:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(539, 542);
+ break;
+ case 225:
+ if (curChar == 63 && kind > 73)
+ kind = 73;
+ break;
+ case 226:
+ case 241:
+ case 245:
+ case 248:
+ case 251:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(225);
+ break;
+ case 227:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 226);
+ break;
+ case 228:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(543, 545);
+ break;
+ case 229:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjAddStates(546, 551);
+ break;
+ case 230:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 231;
+ break;
+ case 231:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 232;
+ break;
+ case 232:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(233);
+ break;
+ case 233:
+ if ((0x3ff000000000000L & l) != 0L && kind > 73)
+ kind = 73;
+ break;
+ case 234:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 235;
+ break;
+ case 235:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 236;
+ break;
+ case 236:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 237;
+ break;
+ case 237:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(225);
+ break;
+ case 238:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 239;
+ break;
+ case 239:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 240;
+ break;
+ case 240:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 241;
+ break;
+ case 242:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 243;
+ break;
+ case 243:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 244;
+ break;
+ case 244:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 245);
+ break;
+ case 246:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 247;
+ break;
+ case 247:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(552, 554);
+ break;
+ case 249:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 248);
+ break;
+ case 250:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(555, 558);
+ break;
+ case 252:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(225, 251);
+ break;
+ case 253:
+ if (curChar != 63)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(559, 561);
+ break;
+ case 254:
+ if (curChar == 43)
+ jjstateSet[jjnewStateCnt++] = 255;
+ break;
+ case 255:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(256, 262);
+ break;
+ case 256:
+ if (curChar == 45)
+ jjstateSet[jjnewStateCnt++] = 257;
+ break;
+ case 257:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 258;
+ break;
+ case 258:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(562, 565);
+ break;
+ case 259:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(233);
+ break;
+ case 260:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(233, 259);
+ break;
+ case 261:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(566, 568);
+ break;
+ case 262:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(569, 573);
+ break;
+ case 263:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAdd(256);
+ break;
+ case 264:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(263, 256);
+ break;
+ case 265:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(574, 576);
+ break;
+ case 266:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(577, 580);
+ break;
+ case 268:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(581, 584);
+ break;
+ case 269:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(585, 591);
+ break;
+ case 270:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(592, 594);
+ break;
+ case 271:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(595, 598);
+ break;
+ case 272:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(599, 603);
+ break;
+ case 273:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(604, 609);
+ break;
+ case 274:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(610, 614);
+ break;
+ case 275:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(615, 622);
+ break;
+ case 276:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(623, 626);
+ break;
+ case 277:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(627, 631);
+ break;
+ case 278:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(632, 637);
+ break;
+ case 279:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(638, 644);
+ break;
+ case 280:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAddStates(3, 74);
+ break;
+ case 281:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 36)
+ kind = 36;
+ jjCheckNAdd(281);
+ break;
+ case 282:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(282, 283);
+ break;
+ case 283:
+ if (curChar == 46)
+ jjCheckNAdd(100);
+ break;
+ case 284:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(284, 102);
+ break;
+ case 285:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(285, 286);
+ break;
+ case 286:
+ if (curChar == 46)
+ jjCheckNAdd(101);
+ break;
+ case 287:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(287, 105);
+ break;
+ case 288:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(288, 289);
+ break;
+ case 289:
+ if (curChar == 46)
+ jjCheckNAdd(103);
+ break;
+ case 290:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(290, 108);
+ break;
+ case 291:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(291, 292);
+ break;
+ case 292:
+ if (curChar == 46)
+ jjCheckNAdd(106);
+ break;
+ case 293:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(293, 111);
+ break;
+ case 294:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(294, 295);
+ break;
+ case 295:
+ if (curChar == 46)
+ jjCheckNAdd(109);
+ break;
+ case 296:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(296, 114);
+ break;
+ case 297:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(297, 298);
+ break;
+ case 298:
+ if (curChar == 46)
+ jjCheckNAdd(112);
+ break;
+ case 299:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(299, 117);
+ break;
+ case 300:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(300, 301);
+ break;
+ case 301:
+ if (curChar == 46)
+ jjCheckNAdd(115);
+ break;
+ case 302:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(302, 120);
+ break;
+ case 303:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(303, 304);
+ break;
+ case 304:
+ if (curChar == 46)
+ jjCheckNAdd(118);
+ break;
+ case 305:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(305, 123);
+ break;
+ case 306:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(306, 307);
+ break;
+ case 307:
+ if (curChar == 46)
+ jjCheckNAdd(121);
+ break;
+ case 308:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(308, 126);
+ break;
+ case 309:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(309, 310);
+ break;
+ case 310:
+ if (curChar == 46)
+ jjCheckNAdd(124);
+ break;
+ case 311:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(311, 130);
+ break;
+ case 312:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(312, 313);
+ break;
+ case 313:
+ if (curChar == 46)
+ jjCheckNAdd(127);
+ break;
+ case 314:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(314, 134);
+ break;
+ case 315:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(315, 316);
+ break;
+ case 316:
+ if (curChar == 46)
+ jjCheckNAdd(131);
+ break;
+ case 317:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(317, 139);
+ break;
+ case 318:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(318, 319);
+ break;
+ case 319:
+ if (curChar == 46)
+ jjCheckNAdd(135);
+ break;
+ case 320:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(320, 142);
+ break;
+ case 321:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(321, 322);
+ break;
+ case 322:
+ if (curChar == 46)
+ jjCheckNAdd(140);
+ break;
+ case 323:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(323, 144);
+ break;
+ case 324:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(324, 325);
+ break;
+ case 325:
+ if (curChar == 46)
+ jjCheckNAdd(143);
+ break;
+ case 326:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(326, 147);
+ break;
+ case 327:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(327, 328);
+ break;
+ case 328:
+ if (curChar == 46)
+ jjCheckNAdd(145);
+ break;
+ case 329:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(329, 151);
+ break;
+ case 330:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(330, 331);
+ break;
+ case 331:
+ if (curChar == 46)
+ jjCheckNAdd(148);
+ break;
+ case 332:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(645, 647);
+ break;
+ case 333:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(333, 334);
+ break;
+ case 334:
+ if (curChar == 46)
+ jjCheckNAdd(152);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 336:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(51, 52);
+ break;
+ case 1:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ }
+ else if (curChar == 92)
+ jjCheckNAddStates(653, 656);
+ else if (curChar == 64)
+ jjAddStates(657, 658);
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(659, 661);
+ break;
+ case 48:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ {
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ }
+ else if (curChar == 92)
+ jjCheckNAddTwoStates(51, 60);
+ break;
+ case 3:
+ case 8:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 5:
+ if (curChar == 92)
+ jjAddStates(662, 665);
+ break;
+ case 7:
+ if (curChar == 92)
+ jjAddStates(666, 667);
+ break;
+ case 9:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(101, 106);
+ break;
+ case 11:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(107, 115);
+ break;
+ case 12:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(116, 120);
+ break;
+ case 13:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(121, 126);
+ break;
+ case 14:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(127, 133);
+ break;
+ case 15:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(134, 141);
+ break;
+ case 20:
+ case 25:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 22:
+ if (curChar == 92)
+ jjAddStates(668, 671);
+ break;
+ case 24:
+ if (curChar == 92)
+ jjAddStates(672, 673);
+ break;
+ case 26:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(142, 147);
+ break;
+ case 28:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(148, 156);
+ break;
+ case 29:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(157, 161);
+ break;
+ case 30:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(162, 167);
+ break;
+ case 31:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(168, 174);
+ break;
+ case 32:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(175, 182);
+ break;
+ case 37:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 38:
+ if (curChar == 92)
+ jjAddStates(674, 675);
+ break;
+ case 39:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 40:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(183, 186);
+ break;
+ case 42:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(187, 193);
+ break;
+ case 43:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(194, 196);
+ break;
+ case 44:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(197, 200);
+ break;
+ case 45:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(201, 205);
+ break;
+ case 46:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(206, 211);
+ break;
+ case 47:
+ if (curChar == 64)
+ jjAddStates(657, 658);
+ break;
+ case 49:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 50:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(51, 52);
+ break;
+ case 51:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 52:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(212, 215);
+ break;
+ case 54:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(216, 222);
+ break;
+ case 55:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(223, 225);
+ break;
+ case 56:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(226, 229);
+ break;
+ case 57:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(230, 234);
+ break;
+ case 58:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(235, 240);
+ break;
+ case 59:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(51, 60);
+ break;
+ case 60:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(241, 244);
+ break;
+ case 61:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(245, 251);
+ break;
+ case 62:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(252, 254);
+ break;
+ case 63:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(255, 258);
+ break;
+ case 64:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(259, 263);
+ break;
+ case 65:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddStates(264, 269);
+ break;
+ case 68:
+ if ((0x10000000100000L & l) != 0L && kind > 63)
+ kind = 63;
+ break;
+ case 69:
+ if ((0x400000004000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 68;
+ break;
+ case 70:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 69;
+ break;
+ case 71:
+ if ((0x10000000100000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 70;
+ break;
+ case 72:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 71;
+ break;
+ case 73:
+ if ((0x800000008000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 72;
+ break;
+ case 74:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 73;
+ break;
+ case 75:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 74;
+ break;
+ case 76:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 75;
+ break;
+ case 77:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ break;
+ case 78:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 79:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(80, 81);
+ break;
+ case 80:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 81:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(270, 273);
+ break;
+ case 83:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(274, 280);
+ break;
+ case 84:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(281, 283);
+ break;
+ case 85:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(284, 287);
+ break;
+ case 86:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(288, 292);
+ break;
+ case 87:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(293, 298);
+ break;
+ case 88:
+ if ((0x7fffffe07fffffeL & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 90:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(91, 92);
+ break;
+ case 91:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 92:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(302, 306);
+ break;
+ case 94:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(307, 314);
+ break;
+ case 95:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(315, 318);
+ break;
+ case 96:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(319, 323);
+ break;
+ case 97:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(324, 329);
+ break;
+ case 98:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(330, 336);
+ break;
+ case 104:
+ if ((0x10000000100000L & l) != 0L && kind > 40)
+ kind = 40;
+ break;
+ case 105:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 104;
+ break;
+ case 107:
+ if ((0x200000002000L & l) != 0L && kind > 41)
+ kind = 41;
+ break;
+ case 108:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 107;
+ break;
+ case 110:
+ if ((0x200000002000L & l) != 0L && kind > 42)
+ kind = 42;
+ break;
+ case 111:
+ if ((0x800000008L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 110;
+ break;
+ case 113:
+ if ((0x800000008L & l) != 0L && kind > 43)
+ kind = 43;
+ break;
+ case 114:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 113;
+ break;
+ case 116:
+ if ((0x400000004000L & l) != 0L && kind > 44)
+ kind = 44;
+ break;
+ case 117:
+ if ((0x20000000200L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 116;
+ break;
+ case 119:
+ if ((0x100000001000000L & l) != 0L && kind > 45)
+ kind = 45;
+ break;
+ case 120:
+ if ((0x1000000010000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 119;
+ break;
+ case 122:
+ if ((0x200000002000L & l) != 0L && kind > 46)
+ kind = 46;
+ break;
+ case 123:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 122;
+ break;
+ case 125:
+ if ((0x100000001000000L & l) != 0L && kind > 47)
+ kind = 47;
+ break;
+ case 126:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 125;
+ break;
+ case 128:
+ if ((0x8000000080L & l) != 0L && kind > 48)
+ kind = 48;
+ break;
+ case 129:
+ if ((0x2000000020L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 128;
+ break;
+ case 130:
+ if ((0x1000000010L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 129;
+ break;
+ case 132:
+ if ((0x1000000010L & l) != 0L && kind > 49)
+ kind = 49;
+ break;
+ case 133:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 132;
+ break;
+ case 134:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 133;
+ break;
+ case 136:
+ if ((0x1000000010L & l) != 0L && kind > 50)
+ kind = 50;
+ break;
+ case 137:
+ if ((0x200000002L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 136;
+ break;
+ case 138:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 137;
+ break;
+ case 139:
+ if ((0x8000000080L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 138;
+ break;
+ case 141:
+ if ((0x8000000080000L & l) != 0L && kind > 51)
+ kind = 51;
+ break;
+ case 142:
+ if ((0x200000002000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 141;
+ break;
+ case 144:
+ if ((0x8000000080000L & l) != 0L && kind > 52)
+ kind = 52;
+ break;
+ case 146:
+ if ((0x400000004000000L & l) != 0L && kind > 53)
+ kind = 53;
+ break;
+ case 147:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 146;
+ break;
+ case 149:
+ if ((0x400000004000000L & l) != 0L && kind > 54)
+ kind = 54;
+ break;
+ case 150:
+ if ((0x10000000100L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 149;
+ break;
+ case 151:
+ if ((0x80000000800L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 150;
+ break;
+ case 153:
+ case 154:
+ if ((0x7fffffe07fffffeL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 155:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(156, 157);
+ break;
+ case 156:
+ if ((0x7fffffffffffffffL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 157:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(337, 340);
+ break;
+ case 159:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(341, 347);
+ break;
+ case 160:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(348, 350);
+ break;
+ case 161:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(351, 354);
+ break;
+ case 162:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(355, 359);
+ break;
+ case 163:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(360, 365);
+ break;
+ case 164:
+ if (curChar == 92)
+ jjCheckNAddTwoStates(156, 165);
+ break;
+ case 165:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(366, 369);
+ break;
+ case 166:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(370, 376);
+ break;
+ case 167:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(377, 379);
+ break;
+ case 168:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(380, 383);
+ break;
+ case 169:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(384, 388);
+ break;
+ case 170:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddStates(389, 394);
+ break;
+ case 171:
+ if ((0x20000000200000L & l) != 0L)
+ jjAddStates(659, 661);
+ break;
+ case 173:
+ case 177:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 176:
+ if (curChar == 92)
+ jjAddStates(676, 677);
+ break;
+ case 178:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(405, 409);
+ break;
+ case 180:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(410, 417);
+ break;
+ case 181:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(418, 421);
+ break;
+ case 182:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(422, 426);
+ break;
+ case 183:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(427, 432);
+ break;
+ case 184:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(433, 439);
+ break;
+ case 186:
+ case 191:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 188:
+ if (curChar == 92)
+ jjAddStates(678, 681);
+ break;
+ case 190:
+ if (curChar == 92)
+ jjAddStates(682, 683);
+ break;
+ case 192:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(444, 449);
+ break;
+ case 194:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(450, 458);
+ break;
+ case 195:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(459, 463);
+ break;
+ case 196:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(464, 469);
+ break;
+ case 197:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(470, 476);
+ break;
+ case 198:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(477, 484);
+ break;
+ case 203:
+ case 208:
+ if ((0x7fffffffffffffffL & l) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ case 205:
+ if (curChar == 92)
+ jjAddStates(684, 687);
+ break;
+ case 207:
+ if (curChar == 92)
+ jjAddStates(688, 689);
+ break;
+ case 209:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(489, 494);
+ break;
+ case 211:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(495, 503);
+ break;
+ case 212:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(504, 508);
+ break;
+ case 213:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(509, 514);
+ break;
+ case 214:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(515, 521);
+ break;
+ case 215:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(522, 529);
+ break;
+ case 220:
+ if ((0x100000001000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 172;
+ break;
+ case 221:
+ if ((0x4000000040000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 220;
+ break;
+ case 229:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjAddStates(546, 551);
+ break;
+ case 230:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 231;
+ break;
+ case 231:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 232;
+ break;
+ case 232:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(233);
+ break;
+ case 233:
+ if ((0x7e0000007eL & l) != 0L && kind > 73)
+ kind = 73;
+ break;
+ case 234:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 235;
+ break;
+ case 235:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 236;
+ break;
+ case 236:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 237;
+ break;
+ case 237:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 225;
+ break;
+ case 238:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 239;
+ break;
+ case 239:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 240;
+ break;
+ case 240:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 241;
+ break;
+ case 242:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 243;
+ break;
+ case 243:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 244;
+ break;
+ case 246:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 247;
+ break;
+ case 255:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(256, 262);
+ break;
+ case 257:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjstateSet[jjnewStateCnt++] = 258;
+ break;
+ case 258:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(562, 565);
+ break;
+ case 259:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAdd(233);
+ break;
+ case 260:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddTwoStates(233, 259);
+ break;
+ case 261:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 73)
+ kind = 73;
+ jjCheckNAddStates(566, 568);
+ break;
+ case 262:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(569, 573);
+ break;
+ case 263:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAdd(256);
+ break;
+ case 264:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(263, 256);
+ break;
+ case 265:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(574, 576);
+ break;
+ case 266:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(577, 580);
+ break;
+ case 267:
+ if (curChar == 92)
+ jjCheckNAddStates(653, 656);
+ break;
+ case 268:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(581, 584);
+ break;
+ case 269:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(585, 591);
+ break;
+ case 270:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(592, 594);
+ break;
+ case 271:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(595, 598);
+ break;
+ case 272:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(599, 603);
+ break;
+ case 273:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(604, 609);
+ break;
+ case 274:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(610, 614);
+ break;
+ case 275:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(615, 622);
+ break;
+ case 276:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(623, 626);
+ break;
+ case 277:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(627, 631);
+ break;
+ case 278:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(632, 637);
+ break;
+ case 279:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(638, 644);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 336:
+ case 49:
+ case 51:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 1:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ {
+ if (kind > 25)
+ kind = 25;
+ }
+ if ((jjbitVec0[i2] & l2) != 0L)
+ {
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ }
+ break;
+ case 48:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 62)
+ kind = 62;
+ jjCheckNAddTwoStates(49, 50);
+ break;
+ case 3:
+ case 8:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(97, 100);
+ break;
+ case 20:
+ case 25:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(93, 96);
+ break;
+ case 37:
+ case 39:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddTwoStates(37, 38);
+ break;
+ case 77:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddStates(648, 652);
+ break;
+ case 78:
+ case 80:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 35)
+ kind = 35;
+ jjCheckNAddTwoStates(78, 79);
+ break;
+ case 88:
+ case 91:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(299, 301);
+ break;
+ case 153:
+ case 154:
+ case 156:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAddTwoStates(154, 155);
+ break;
+ case 173:
+ case 177:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(401, 404);
+ break;
+ case 186:
+ case 191:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(440, 443);
+ break;
+ case 203:
+ case 208:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddStates(485, 488);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 335 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+static final int[] jjnextStates = {
+ 152, 153, 164, 281, 282, 283, 284, 285, 286, 102, 287, 288, 289, 105, 290, 291,
+ 292, 108, 293, 294, 295, 111, 296, 297, 298, 114, 299, 300, 301, 117, 302, 303,
+ 304, 120, 305, 306, 307, 123, 308, 309, 310, 126, 311, 312, 313, 130, 314, 315,
+ 316, 134, 317, 318, 319, 139, 320, 321, 322, 142, 323, 324, 325, 144, 326, 327,
+ 328, 147, 329, 330, 331, 151, 332, 333, 334, 153, 164, 100, 101, 103, 106, 109,
+ 112, 115, 118, 121, 124, 127, 131, 135, 140, 143, 145, 148, 152, 20, 21, 22,
+ 24, 3, 4, 5, 7, 3, 10, 4, 5, 7, 11, 3, 12, 10, 4, 5,
+ 7, 13, 14, 15, 3, 10, 4, 5, 7, 3, 12, 10, 4, 5, 7, 3,
+ 12, 10, 4, 5, 7, 13, 3, 12, 10, 4, 5, 7, 13, 14, 20, 27,
+ 21, 22, 24, 28, 20, 29, 27, 21, 22, 24, 30, 31, 32, 20, 27, 21,
+ 22, 24, 20, 29, 27, 21, 22, 24, 20, 29, 27, 21, 22, 24, 30, 20,
+ 29, 27, 21, 22, 24, 30, 31, 37, 41, 38, 42, 37, 43, 41, 38, 44,
+ 45, 46, 37, 41, 38, 37, 43, 41, 38, 37, 43, 41, 38, 44, 37, 43,
+ 41, 38, 44, 45, 49, 53, 50, 54, 49, 55, 53, 50, 56, 57, 58, 49,
+ 53, 50, 49, 55, 53, 50, 49, 55, 53, 50, 56, 49, 55, 53, 50, 56,
+ 57, 53, 49, 50, 61, 62, 53, 49, 50, 63, 64, 65, 53, 49, 50, 62,
+ 53, 49, 50, 62, 53, 49, 50, 63, 62, 53, 49, 50, 63, 64, 78, 82,
+ 79, 83, 78, 84, 82, 79, 85, 86, 87, 78, 82, 79, 78, 84, 82, 79,
+ 78, 84, 82, 79, 85, 78, 84, 82, 79, 85, 86, 88, 89, 90, 88, 93,
+ 89, 90, 94, 88, 95, 93, 89, 90, 96, 97, 98, 88, 93, 89, 90, 88,
+ 95, 93, 89, 90, 88, 95, 93, 89, 90, 96, 88, 95, 93, 89, 90, 96,
+ 97, 154, 158, 155, 159, 154, 160, 158, 155, 161, 162, 163, 154, 158, 155, 154,
+ 160, 158, 155, 154, 160, 158, 155, 161, 154, 160, 158, 155, 161, 162, 158, 154,
+ 155, 166, 167, 158, 154, 155, 168, 169, 170, 158, 154, 155, 167, 158, 154, 155,
+ 167, 158, 154, 155, 168, 167, 158, 154, 155, 168, 169, 173, 185, 202, 175, 176,
+ 219, 173, 174, 175, 176, 173, 175, 176, 179, 180, 173, 181, 175, 176, 179, 182,
+ 183, 184, 173, 175, 176, 179, 173, 181, 175, 176, 179, 173, 181, 175, 176, 179,
+ 182, 173, 181, 175, 176, 179, 182, 183, 186, 187, 188, 190, 186, 193, 187, 188,
+ 190, 194, 186, 195, 193, 187, 188, 190, 196, 197, 198, 186, 193, 187, 188, 190,
+ 186, 195, 193, 187, 188, 190, 186, 195, 193, 187, 188, 190, 196, 186, 195, 193,
+ 187, 188, 190, 196, 197, 203, 204, 205, 207, 203, 210, 204, 205, 207, 211, 203,
+ 212, 210, 204, 205, 207, 213, 214, 215, 203, 210, 204, 205, 207, 203, 212, 210,
+ 204, 205, 207, 203, 212, 210, 204, 205, 207, 213, 203, 212, 210, 204, 205, 207,
+ 213, 214, 173, 185, 202, 174, 175, 176, 219, 223, 229, 225, 226, 227, 228, 225,
+ 226, 227, 230, 234, 238, 242, 246, 250, 225, 248, 249, 225, 251, 252, 253, 225,
+ 251, 252, 233, 259, 260, 261, 233, 259, 260, 263, 256, 264, 265, 266, 263, 256,
+ 264, 263, 256, 264, 265, 82, 78, 79, 269, 270, 82, 78, 79, 271, 272, 273,
+ 82, 78, 79, 270, 82, 78, 79, 270, 82, 78, 79, 271, 270, 82, 78, 79,
+ 271, 272, 93, 88, 89, 90, 275, 276, 93, 88, 89, 90, 277, 278, 279, 93,
+ 88, 89, 90, 276, 93, 88, 89, 90, 276, 93, 88, 89, 90, 277, 276, 93,
+ 88, 89, 90, 277, 278, 332, 153, 164, 78, 88, 89, 90, 79, 80, 268, 91,
+ 274, 48, 59, 221, 222, 254, 6, 16, 18, 17, 8, 9, 23, 33, 35, 34,
+ 25, 26, 39, 40, 177, 178, 189, 199, 201, 200, 191, 192, 206, 216, 218, 217,
+ 208, 209,
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, "\74\41\55\55", "\55\55\76", "\173", "\175",
+"\174\75", "\176\75", "\75", "\53", "\55", "\54", "\73", "\76", "\57", "\133", "\135",
+"\52", "\56", "\51", "\50", "\72", null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+ "IN_COMMENT",
+};
+public static final int[] jjnewLexState = {
+ -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
+};
+static final long[] jjtoToken = {
+ 0xffffffdc03ffffe3L, 0xe00L,
+};
+static final long[] jjtoSkip = {
+ 0x8L, 0x0L,
+};
+static final long[] jjtoMore = {
+ 0x14L, 0x0L,
+};
+private CharStream input_stream;
+private final int[] jjrounds = new int[335];
+private final int[] jjstateSet = new int[670];
+StringBuffer image;
+int jjimageLen;
+int lengthOfMatch;
+protected char curChar;
+public ParserTokenManager(CharStream stream)
+{
+ input_stream = stream;
+}
+public ParserTokenManager(CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 335; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 2 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ t.image = (im == null) ? input_stream.GetImage() : im;
+ t.beginLine = input_stream.getBeginLine();
+ t.beginColumn = input_stream.getBeginColumn();
+ t.endLine = input_stream.getEndLine();
+ t.endColumn = input_stream.getEndColumn();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+ image = null;
+ jjimageLen = 0;
+
+ for (;;)
+ {
+ switch(curLexState)
+ {
+ case 0:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedPos == 0 && jjmatchedKind > 75)
+ {
+ jjmatchedKind = 75;
+ }
+ break;
+ case 1:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ if (jjmatchedPos == 0 && jjmatchedKind > 4)
+ {
+ jjmatchedKind = 4;
+ }
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ TokenLexicalActions(matchedToken);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ }
+ else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ jjimageLen += jjmatchedPos + 1;
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ curPos = 0;
+ jjmatchedKind = 0x7fffffff;
+ try {
+ curChar = input_stream.readChar();
+ continue;
+ }
+ catch (java.io.IOException e1) { }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+ }
+}
+
+final void TokenLexicalActions(Token matchedToken)
+{
+ switch(jjmatchedKind)
+ {
+ case 1 :
+ if (image == null)
+ image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
+ else
+ image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
+ image = Parser.SPACE;
+ break;
+ default :
+ break;
+ }
+}
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/SelectorListImpl.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: SelectorListImpl.java,v 1.1 2000/08/07 01:16:21 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class SelectorListImpl implements SelectorList {
+
+ Selector[] selectors = new Selector[5];
+ int current;
+
+ public Selector item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public Selector itemSelector(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public int getLength() {
+ return current;
+ }
+
+ void addSelector(Selector selector) {
+ if (current == selectors.length) {
+ Selector[] old = selectors;
+ selectors = new Selector[old.length + old.length];
+ System.arraycopy(old, 0, selectors, 0, old.length);
+ }
+ selectors[current++] = selector;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Selectors.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id: Selectors.java,v 1.1 2000/02/14 16:58:31 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+import org.w3c.css.sac.SelectorList;
+import org.w3c.css.sac.Selector;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class Selectors implements SelectorList {
+
+ Selector[] selectors = new Selector[5];
+ int current;
+
+ public Selector item(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public Selector itemSelector(int index) {
+ if ((index < 0) || (index >= current)) {
+ return null;
+ }
+ return selectors[index];
+ }
+
+ public int getLength() {
+ return current;
+ }
+
+ void addSelector(Selector selector) {
+ if (current == selectors.length) {
+ Selector[] old = selectors;
+ selectors = new Selector[old.length + old.length];
+ System.arraycopy(old, 0, selectors, 0, old.length);
+ }
+ selectors[current++] = selector;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/ThrowedParseException.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,24 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id: ThrowedParseException.java,v 1.1 1999/06/09 15:21:33 plehegar Exp $
+ */
+package org.w3c.flute.parser;
+
+/**
+ * @version $Revision: 1.1 $
+ * @author Philippe Le Hegaret
+ */
+class ThrowedParseException extends RuntimeException {
+ ParseException e;
+
+ /**
+ * Creates a new ThrowedParseException
+ */
+ ThrowedParseException(ParseException e) {
+ this.e = e;
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/Token.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,81 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+package org.w3c.flute.parser;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/TokenMgrError.java 2009-05-19 08:39:00 UTC (rev 1431)
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.w3c.flute.parser;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
1
0
Author: tchemit
Date: 2009-05-18 15:54:21 +0000 (Mon, 18 May 2009)
New Revision: 1430
Modified:
jaxx/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-18 10:53:19 UTC (rev 1429)
+++ jaxx/trunk/pom.xml 2009-05-18 15:54:21 UTC (rev 1430)
@@ -153,8 +153,8 @@
<inceptionYear>2008</inceptionYear>
<!-- attention sur du multi-module l'url de deployement doit correspondre à l'url du site
sinon le plugin site perd les pédales et pour un module A, on dans le menu module A/A/index.html ...-->
- <url>http://lutinbuilder.labs.libre-entreprise.org/nuiton/jaxx</url>
- <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
+ <url>http://maven-site.nuiton.org/jaxx</url>
+ <!--url>http://www.nuiton.org/embedded/jaxx</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
Author: tchemit
Date: 2009-05-18 10:53:19 +0000 (Mon, 18 May 2009)
New Revision: 1429
Modified:
jaxx/trunk/pom.xml
Log:
use mavempom snapshot
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 22:10:39 UTC (rev 1428)
+++ jaxx/trunk/pom.xml 2009-05-18 10:53:19 UTC (rev 1429)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.0.0-alpha-2</version>
+ <version>1.0.0-alpha-3-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
Author: tchemit
Date: 2009-05-17 22:10:39 +0000 (Sun, 17 May 2009)
New Revision: 1428
Modified:
jaxx/trunk/pom.xml
Log:
fix site url for multi-module must be same domain as real deployment otherwise it bugs on the modules menu : link to A/A rather than A/B
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
+++ jaxx/trunk/pom.xml 2009-05-17 22:10:39 UTC (rev 1428)
@@ -151,7 +151,10 @@
<name>${project.artifactId}</name>
<description>Jaxx library parent pom</description>
<inceptionYear>2008</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <!-- attention sur du multi-module l'url de deployement doit correspondre à l'url du site
+ sinon le plugin site perd les pédales et pour un module A, on dans le menu module A/A/index.html ...-->
+ <url>http://lutinbuilder.labs.libre-entreprise.org/nuiton/jaxx</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
r1427 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 17, 2009
by tchemit@users.labs.libre-entreprise.org May 17, 2009
May 17, 2009
Author: tchemit
Date: 2009-05-17 20:50:11 +0000 (Sun, 17 May 2009)
New Revision: 1427
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:50:06 UTC (rev 1426)
+++ jaxx/trunk/pom.xml 2009-05-17 20:50:11 UTC (rev 1427)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-2-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -204,9 +204,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.6.0-alpha-1</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
1
0
Author: tchemit
Date: 2009-05-17 20:50:06 +0000 (Sun, 17 May 2009)
New Revision: 1426
Added:
jaxx/tags/jaxx-1.6.0-alpha-1/
Log:
[maven-scm] copy for tag jaxx-1.6.0-alpha-1
Copied: jaxx/tags/jaxx-1.6.0-alpha-1 (from rev 1425, jaxx/trunk)
1
0
r1425 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 17, 2009
by tchemit@users.labs.libre-entreprise.org May 17, 2009
May 17, 2009
Author: tchemit
Date: 2009-05-17 20:50:01 +0000 (Sun, 17 May 2009)
New Revision: 1425
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.6.0-alpha-1
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
+++ jaxx/trunk/pom.xml 2009-05-17 20:50:01 UTC (rev 1425)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -204,9 +204,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.6.0-alpha-1</url>
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
1
0
Author: tchemit
Date: 2009-05-17 20:47:34 +0000 (Sun, 17 May 2009)
New Revision: 1424
Modified:
jaxx/trunk/pom.xml
Log:
ready for first release
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
+++ jaxx/trunk/pom.xml 2009-05-17 20:47:34 UTC (rev 1424)
@@ -205,7 +205,7 @@
<!-- Source control management. -->
<scm>
<connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/trunk</developerConnection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
<url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
<!-- a utiliser quand on sera sur nuiton -->
1
0
r1423 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 17, 2009
by tchemit@users.labs.libre-entreprise.org May 17, 2009
May 17, 2009
Author: tchemit
Date: 2009-05-17 20:47:18 +0000 (Sun, 17 May 2009)
New Revision: 1423
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] rollback the release of jaxx-1.6.0-alpha-1
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
+++ jaxx/trunk/pom.xml 2009-05-17 20:47:18 UTC (rev 1423)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -204,9 +204,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/tags/jaxx-1.6.0-alpha-1</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.6.0-alpha-1</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
1
0
r1422 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 17, 2009
by tchemit@users.labs.libre-entreprise.org May 17, 2009
May 17, 2009
Author: tchemit
Date: 2009-05-17 20:45:13 +0000 (Sun, 17 May 2009)
New Revision: 1422
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.6.0-alpha-1
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
+++ jaxx/trunk/pom.xml 2009-05-17 20:45:13 UTC (rev 1422)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-alpha-1-SNAPSHOT</version>
+ <version>1.6.0-alpha-1</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -204,9 +204,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.6.0-alpha-1</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/tags/jaxx-1.6.0-alpha-1</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-1.6.0-alpha-1</url>
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
1
0
Author: tchemit
Date: 2009-05-17 20:42:48 +0000 (Sun, 17 May 2009)
New Revision: 1421
Modified:
jaxx/trunk/pom.xml
Log:
ready for first release
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 20:42:05 UTC (rev 1420)
+++ jaxx/trunk/pom.xml 2009-05-17 20:42:48 UTC (rev 1421)
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
- <version>1.1.0-alpha-1-SNAPSHOT</version>
+ <version>1.1.0-alpha-1</version>
</dependency>
<dependency>
1
0
Author: tchemit
Date: 2009-05-17 20:42:05 +0000 (Sun, 17 May 2009)
New Revision: 1420
Modified:
jaxx/trunk/pom.xml
Log:
ready for first release
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
+++ jaxx/trunk/pom.xml 2009-05-17 20:42:05 UTC (rev 1420)
@@ -9,8 +9,8 @@
<parent>
<groupId>org.nuiton</groupId>
- <artifactId>mavenpom</artifactId>
- <version>1.0.0-alpha-1-SNAPSHOT</version>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.0-alpha-2</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -161,6 +161,7 @@
<properties>
+ <!-- pour un muli module on doit fixer l'url sans artifactId dedans -->
<maven.issueManagement.url>http://www.nuiton.org/projects/jaxx/issues</maven.issueManagement.url>
</properties>
@@ -174,15 +175,10 @@
<plugin>
<groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
- <version>1.0.0-alpha-1-SNAPSHOT</version>
+ <version>1.0.0-alpha-1</version>
</plugin>
<!--plugin>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>2.5</version>
- </plugin>
-
- <plugin>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
@@ -211,13 +207,13 @@
<connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
<developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/trunk</developerConnection>
<url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
-
+
<!-- a utiliser quand on sera sur nuiton -->
<!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
il faudra alors remttre ces trois valeurs sur le pom parent du multi-module -->
<!--connection>scm:svn:http://svn.nuiton.org/svn/${project.artifactId}/trunk</connection>
<developerConnection>scm:svn:http://svn.nuiton.org/svn/${project.artifactId}/trunk</developerConnection>
- <url>http://svn.nuiton.org/svn/${project.artifactId}/trunk</url-->
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url-->
</scm>
1
0
r1419 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin src/site
by tchemit@users.labs.libre-entreprise.org May 17, 2009
by tchemit@users.labs.libre-entreprise.org May 17, 2009
May 17, 2009
Author: tchemit
Date: 2009-05-17 16:49:25 +0000 (Sun, 17 May 2009)
New Revision: 1419
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
jaxx/trunk/src/site/site.xml
Log:
premier jet d'un pom parent compatible central
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -46,7 +46,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -52,7 +52,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -65,7 +65,7 @@
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -57,8 +57,6 @@
<packaging>jar</packaging>
<properties>
-
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
<maven.jar.main.class>jaxx.demo.JAXXDemo</maven.jar.main.class>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -64,7 +64,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -46,7 +46,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -52,7 +52,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<build>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -53,7 +53,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<build>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -51,7 +51,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<build>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -51,7 +51,7 @@
<packaging>jar</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<build>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
@@ -128,7 +128,7 @@
<packaging>maven-plugin</packaging>
<properties>
- <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
</properties>
<build>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/pom.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -9,12 +9,12 @@
<parent>
<groupId>org.nuiton</groupId>
- <artifactId>mavenpom</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.0-alpha-1-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-alpha-1-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
@@ -151,6 +151,7 @@
<name>${project.artifactId}</name>
<description>Jaxx library parent pom</description>
<inceptionYear>2008</inceptionYear>
+ <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
@@ -159,10 +160,9 @@
<packaging>pom</packaging>
<properties>
-
- <!-- a supprimer des qu'on pourra deployer les sites sur nuiton -->
- <site.deploy.url>scpexe://labs.libre-entreprise.org/home/groups/buix/htdocs/nuiton</site.deploy.url>
+ <maven.issueManagement.url>http://www.nuiton.org/projects/jaxx/issues</maven.issueManagement.url>
+
</properties>
<build>
@@ -174,10 +174,10 @@
<plugin>
<groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-alpha-1-SNAPSHOT</version>
</plugin>
- <plugin>
+ <!--plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
</plugin>
@@ -191,7 +191,7 @@
<version>1.0.1</version>
</dependency>
</dependencies>
- </plugin>
+ </plugin-->
</plugins>
</pluginManagement>
@@ -206,23 +206,19 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <!-- Maven Environment : Repositories -->
+ <!-- Source control management. -->
+ <scm>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/buix/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+
+ <!-- a utiliser quand on sera sur nuiton -->
+ <!-- ne fonctionnera pas pour les multi-modules a cause de l'expansion de l'artifactId
+ il faudra alors remttre ces trois valeurs sur le pom parent du multi-module -->
+ <!--connection>scm:svn:http://svn.nuiton.org/svn/${project.artifactId}/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/${project.artifactId}/trunk</developerConnection>
+ <url>http://svn.nuiton.org/svn/${project.artifactId}/trunk</url-->
+ </scm>
- <!--Nuiton Repository : pourra etre supprimer lorsqu'on sera sur central -->
- <repositories>
- <repository>
- <id>nuiton-repository</id>
- <name>NuitonRepository</name>
- <url>http://lutinbuilder.labs.libre-entreprise.org/maven2-nuiton</url>
- <snapshots>
- <enabled>true</enabled>
- <checksumPolicy>warn</checksumPolicy>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- <checksumPolicy>warn</checksumPolicy>
- </releases>
- </repository>
- </repositories>
</project>
\ No newline at end of file
Modified: jaxx/trunk/src/site/site.xml
===================================================================
--- jaxx/trunk/src/site/site.xml 2009-05-17 02:54:06 UTC (rev 1418)
+++ jaxx/trunk/src/site/site.xml 2009-05-17 16:49:25 UTC (rev 1419)
@@ -4,9 +4,9 @@
<publishDate format="dd/MM/yyyy"/>
<skin>
- <groupId>org.codelutin</groupId>
- <artifactId>maven-lutin-skin</artifactId>
- <version>0.2.3</version>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-nuiton-skin</artifactId>
+ <version>1.0.0-alpha-1</version>
</skin>
<bannerLeft>
@@ -21,24 +21,22 @@
</bannerRight>
<poweredBy>
- <logo href="http://maven.apache.org" name="Maven"
- img="http://buix.labs.libre-entreprise.org/lutinjaxx/images/logos/maven-feather.…"/>
- <logo href="http://jrst.labs.libre-entreprise.org" name="JRst"
- img="http://buix.labs.libre-entreprise.org/lutinjaxx/images/jrst-logo.png"/>
- <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText"
- img="http://buix.labs.libre-entreprise.org/lutinjaxx/images/restructuredtext-log…"/>
+ <logo href="http://maven.apache.org" name="Maven" img="http://buix.labs.libre-entreprise.org/jaxx/images/logos/maven-feather.png"/>
+ <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="http://buix.labs.libre-entreprise.org/jaxx/images/jrst-logo.png"/>
+ <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="http://buix.labs.libre-entreprise.org/jaxx/images/restructuredtext-logo.png"/>
</poweredBy>
<body>
<links>
<item name="maven-jaxx-plugin" href="http://buix.labs.libre-entreprise.org/jaxx/maven-jaxx-plugin"/>
- <item name="Labs" href="http://labs.libre-entreprise.org/"/>
+ <!--item name="Labs" href="http://labs.libre-entreprise.org/"/>
<item name="Nuiton" href="http://www.nuiton.org"/>
- <item name="${project.organization.name}" href="${project.organization.url}"/>
+ <item name="${project.organization.name}" href="${project.organization.url}"/-->
<item name="original JAXX" href="http://buix.labs.libre-entreprise.org/original-jaxx"/>
</links>
<menu ref="parent"/>
+
<menu name="Utilisateur">
<item name="Accueil" href="index.html"/>
</menu>
1
0
Author: tchemit
Date: 2009-05-17 02:54:06 +0000 (Sun, 17 May 2009)
New Revision: 1418
Modified:
jaxx/trunk/pom.xml
Log:
l'url de depot ne peut pas etre calcule, car si on a pas mavenpom en local, ...
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-16 04:00:24 UTC (rev 1417)
+++ jaxx/trunk/pom.xml 2009-05-17 02:54:06 UTC (rev 1418)
@@ -213,7 +213,7 @@
<repository>
<id>nuiton-repository</id>
<name>NuitonRepository</name>
- <url>${repository.home.url}</url>
+ <url>http://lutinbuilder.labs.libre-entreprise.org/maven2-nuiton</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
1
0
Author: tchemit
Date: 2009-05-16 04:00:24 +0000 (Sat, 16 May 2009)
New Revision: 1417
Modified:
jaxx/trunk/pom.xml
Log:
bump swingx + little improvments
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-16 02:26:41 UTC (rev 1416)
+++ jaxx/trunk/pom.xml 2009-05-16 04:00:24 UTC (rev 1417)
@@ -42,20 +42,20 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
- <version>${lutinutil.version}</version>
+ <version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>maven-helper-plugin</artifactId>
- <version>${lutinpluginutil.version}</version>
+ <version>${helper.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>maven-helper-plugin</artifactId>
- <version>${lutinpluginutil.version}</version>
+ <version>${helper.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
@@ -125,7 +125,7 @@
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
- <version>${swingx.version}</version>
+ <version>0.9.7</version>
</dependency>
<dependency>
@@ -149,7 +149,7 @@
<!-- ************************************************************* -->
<name>${project.artifactId}</name>
- <description>Jaxx lutin library parent pom</description>
+ <description>Jaxx library parent pom</description>
<inceptionYear>2008</inceptionYear>
<!-- ************************************************************* -->
@@ -162,14 +162,6 @@
<!-- a supprimer des qu'on pourra deployer les sites sur nuiton -->
<site.deploy.url>scpexe://labs.libre-entreprise.org/home/groups/buix/htdocs/nuiton</site.deploy.url>
-
- <!-- libs version -->
- <lutinutil.version>1.1.0-SNAPSHOT</lutinutil.version>
- <jaxx.version>${project.version}</jaxx.version>
- <i18n.version>1.0.0-SNAPSHOT</i18n.version>
- <lutinpluginutil.version>1.0.0-alpha-1-SNAPSHOT</lutinpluginutil.version>
-
- <swingx.version>0.9.6</swingx.version>
</properties>
@@ -182,12 +174,12 @@
<plugin>
<groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
- <version>${i18n.version}</version>
+ <version>1.0.0-SNAPSHOT</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
- <version>2.4.3</version>
+ <version>2.5</version>
</plugin>
<plugin>
1
0
Author: tchemit
Date: 2009-05-16 02:26:41 +0000 (Sat, 16 May 2009)
New Revision: 1416
Modified:
jaxx/trunk/src/site/site.xml
Log:
fix site url
Modified: jaxx/trunk/src/site/site.xml
===================================================================
--- jaxx/trunk/src/site/site.xml 2009-05-16 02:26:00 UTC (rev 1415)
+++ jaxx/trunk/src/site/site.xml 2009-05-16 02:26:41 UTC (rev 1416)
@@ -33,6 +33,7 @@
<links>
<item name="maven-jaxx-plugin" href="http://buix.labs.libre-entreprise.org/jaxx/maven-jaxx-plugin"/>
<item name="Labs" href="http://labs.libre-entreprise.org/"/>
+ <item name="Nuiton" href="http://www.nuiton.org"/>
<item name="${project.organization.name}" href="${project.organization.url}"/>
<item name="original JAXX" href="http://buix.labs.libre-entreprise.org/original-jaxx"/>
</links>
1
0
Author: tchemit
Date: 2009-05-16 02:26:00 +0000 (Sat, 16 May 2009)
New Revision: 1415
Modified:
jaxx/trunk/src/site/site.xml
Log:
fix site url
Modified: jaxx/trunk/src/site/site.xml
===================================================================
--- jaxx/trunk/src/site/site.xml 2009-05-16 02:23:46 UTC (rev 1414)
+++ jaxx/trunk/src/site/site.xml 2009-05-16 02:26:00 UTC (rev 1415)
@@ -11,7 +11,7 @@
<bannerLeft>
<name>${project.name}</name>
- <src>http://buix.labs.libre-entreprise.org/jaxx/jaxx.png</src>
+ <src>${site.home.url}/jaxx.png</src>
<href>index.html</href>
</bannerLeft>
@@ -42,13 +42,6 @@
<item name="Accueil" href="index.html"/>
</menu>
- <menu name="Téléchargement">
- <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}"
- name="Télécharger la dernière version"/>
- <item href="${labs.builder.url}/org/codelutin/${project.artifactId}"
- name="Voir toutes les versions"/>
- </menu>
-
<menu name="Développeur">
<item name="A faire" href="Todo.html"/>
</menu>
1
0
Author: tchemit
Date: 2009-05-16 02:23:46 +0000 (Sat, 16 May 2009)
New Revision: 1414
Modified:
jaxx/trunk/src/site/site.xml
Log:
arch...
Modified: jaxx/trunk/src/site/site.xml
===================================================================
--- jaxx/trunk/src/site/site.xml 2009-05-16 02:21:32 UTC (rev 1413)
+++ jaxx/trunk/src/site/site.xml 2009-05-16 02:23:46 UTC (rev 1414)
@@ -4,7 +4,7 @@
<publishDate format="dd/MM/yyyy"/>
<skin>
- <groupId>org.nuiton</groupId>
+ <groupId>org.codelutin</groupId>
<artifactId>maven-lutin-skin</artifactId>
<version>0.2.3</version>
</skin>
1
0
Author: tchemit
Date: 2009-05-16 02:21:32 +0000 (Sat, 16 May 2009)
New Revision: 1413
Modified:
jaxx/trunk/pom.xml
Log:
change temporary site url
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-16 02:18:59 UTC (rev 1412)
+++ jaxx/trunk/pom.xml 2009-05-16 02:21:32 UTC (rev 1413)
@@ -161,7 +161,7 @@
<properties>
<!-- a supprimer des qu'on pourra deployer les sites sur nuiton -->
- <site.deploy.url>scpexe://labs.libre-entreprise.org/home/groups/buix/htdocs</site.deploy.url>
+ <site.deploy.url>scpexe://labs.libre-entreprise.org/home/groups/buix/htdocs/nuiton</site.deploy.url>
<!-- libs version -->
<lutinutil.version>1.1.0-SNAPSHOT</lutinutil.version>
1
0
Author: tchemit
Date: 2009-05-16 02:18:59 +0000 (Sat, 16 May 2009)
New Revision: 1412
Modified:
jaxx/trunk/pom.xml
Log:
arch...
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-16 02:16:38 UTC (rev 1411)
+++ jaxx/trunk/pom.xml 2009-05-16 02:18:59 UTC (rev 1412)
@@ -194,7 +194,7 @@
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
- <groupId>org.nuiton</groupId>
+ <groupId>org.codelutin</groupId>
<artifactId>doxia-module-jrst</artifactId>
<version>1.0.1</version>
</dependency>
1
0
r1411 - in jaxx/trunk: . jaxx-example/src/main/resources maven-jaxx-plugin/src/main/resources maven-jaxx-plugin/src/test/resources/testcases src/site
by tchemit@users.labs.libre-entreprise.org May 16, 2009
by tchemit@users.labs.libre-entreprise.org May 16, 2009
May 16, 2009
Author: tchemit
Date: 2009-05-16 02:16:38 +0000 (Sat, 16 May 2009)
New Revision: 1411
Modified:
jaxx/trunk/jaxx-example/src/main/resources/log4j.properties
jaxx/trunk/maven-jaxx-plugin/src/main/resources/log4j.properties
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClientProperty.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Icon.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml
jaxx/trunk/pom.xml
jaxx/trunk/src/site/site.xml
Log:
migrate to nuiton part 2
Modified: jaxx/trunk/jaxx-example/src/main/resources/log4j.properties
===================================================================
--- jaxx/trunk/jaxx-example/src/main/resources/log4j.properties 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/jaxx-example/src/main/resources/log4j.properties 2009-05-16 02:16:38 UTC (rev 1411)
@@ -7,4 +7,4 @@
log4j.logger.demo=DEBUG
log4j.logger.jaxx=INFO
-log4j.logger.org.codelutin=INFO
+log4j.logger.org.nuiton=INFO
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/resources/log4j.properties
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,5 +5,5 @@
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
-log4j.logger.org.codelutin.i18n=ERROR
+log4j.logger.org.nuiton.i18n=ERROR
#log4j.logger.jaxx=DEBUG
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClientProperty.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClientProperty.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClientProperty.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Icon.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Icon.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Icon.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -5,7 +5,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/pom.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -194,7 +194,7 @@
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>doxia-module-jrst</artifactId>
<version>1.0.1</version>
</dependency>
Modified: jaxx/trunk/src/site/site.xml
===================================================================
--- jaxx/trunk/src/site/site.xml 2009-05-16 02:04:56 UTC (rev 1410)
+++ jaxx/trunk/src/site/site.xml 2009-05-16 02:16:38 UTC (rev 1411)
@@ -4,7 +4,7 @@
<publishDate format="dd/MM/yyyy"/>
<skin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-lutin-skin</artifactId>
<version>0.2.3</version>
</skin>
1
0
May 16, 2009
Author: tchemit
Date: 2009-05-16 02:04:56 +0000 (Sat, 16 May 2009)
New Revision: 1410
Removed:
jaxx/trunk/jaxx-example/targset/
Log:
migrate to nuiton part 2
1
0
r1409 - in jaxx/trunk: jaxx-example jaxx-example/targset jaxx-swing-action/src/main/resources/META-INF/services maven-jaxx-plugin/src/main/resources
by tchemit@users.labs.libre-entreprise.org May 16, 2009
by tchemit@users.labs.libre-entreprise.org May 16, 2009
May 16, 2009
Author: tchemit
Date: 2009-05-16 02:04:24 +0000 (Sat, 16 May 2009)
New Revision: 1409
Added:
jaxx/trunk/jaxx-example/targset/
jaxx/trunk/jaxx-example/targset/site/
Modified:
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-swing-action/src/main/resources/META-INF/services/javax.annotation.processing.Processor
jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultIndex.xml.vm
jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultToc.xml.vm
Log:
migrate to nuiton part 2
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-16 02:03:26 UTC (rev 1408)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-16 02:04:24 UTC (rev 1409)
@@ -212,8 +212,8 @@
<phase>pre-site</phase>
<configuration>
<tasks>
- <mkdir dir="targset/site" />
- <copy todir="targset/site" verbose="${maven.verbose}" failonerror="false" overwrite="false">
+ <mkdir dir="target/site" />
+ <copy todir="target/site" verbose="${maven.verbose}" failonerror="false" overwrite="false">
<fileset dir="${jnlp.build.directory}">
<include name="**" />
</fileset>
Modified: jaxx/trunk/jaxx-swing-action/src/main/resources/META-INF/services/javax.annotation.processing.Processor
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/resources/META-INF/services/javax.annotation.processing.Processor 2009-05-16 02:03:26 UTC (rev 1408)
+++ jaxx/trunk/jaxx-swing-action/src/main/resources/META-INF/services/javax.annotation.processing.Processor 2009-05-16 02:04:24 UTC (rev 1409)
@@ -1 +1 @@
-org.codelutin.jaxx.action.ActionAnnotationProcessing
\ No newline at end of file
+org.nuiton.jaxx.action.ActionAnnotationProcessing
\ No newline at end of file
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultIndex.xml.vm
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultIndex.xml.vm 2009-05-16 02:03:26 UTC (rev 1408)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultIndex.xml.vm 2009-05-16 02:04:24 UTC (rev 1409)
@@ -3,7 +3,7 @@
PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN"
"http://buix.labs.libre-entreprise.org/javahelp/index_1_0.dtd">
-## pour afficher un org.codelutin.jaxx.NodeItem
+## pour afficher un org.nuiton.jaxx.NodeItem
#macro ( renderItem $item $prefix )
#if ( $item.isLeaf() )
$prefix<indexitem target="$item.absoluteTarget" text="$!item.text"/>
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultToc.xml.vm
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultToc.xml.vm 2009-05-16 02:03:26 UTC (rev 1408)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/resources/defaultToc.xml.vm 2009-05-16 02:04:24 UTC (rev 1409)
@@ -3,7 +3,7 @@
PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN"
"http://buix.labs.libre-entreprise.org/javahelp/toc_1_0.dtd">
-## pour afficher un org.codelutin.jaxx.NodeItem
+## pour afficher un org.nuiton.jaxx.NodeItem
#macro ( renderItem $item $prefix )
#if ( $item.isLeaf() )
$prefix<tocitem target="$item.absoluteTarget" text="$!item.text"/>
1
0
r1408 - in jaxx/trunk: jaxx-swing-action/src/main/java/org jaxx-swing-action/src/main/java/org/nuiton jaxx-swing-action/src/main/java/org/nuiton/jaxx/action jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab jaxx-swing-action/src/main/java/org/nuiton/jaxx/util jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config jaxx-swing-action/src/test/java maven-jaxx-plugin/src/main/java/org maven-jaxx-plugin/src/main/java/org/nuiton maven-jaxx-plugin/src/main/java/org/nuiton/jaxx maven-jaxx-plugi
by tchemit@users.labs.libre-entreprise.org May 16, 2009
by tchemit@users.labs.libre-entreprise.org May 16, 2009
May 16, 2009
Author: tchemit
Date: 2009-05-16 02:03:26 +0000 (Sat, 16 May 2009)
New Revision: 1408
Added:
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java
Removed:
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java
jaxx/trunk/jaxx-swing-action/src/test/java/jaxx/
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java
Modified:
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/TemplateGenerator.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1722Test.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1750Test.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1751Test.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerValidatorTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/DecoratorTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/I18nTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/NodeItemTest.java
Log:
migrate to nuiton part 2
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton (from rev 1405, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin)
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,70 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import javax.swing.JComponent;
-
-/**
- * Common abstract class of a resolver of action configuration.
- * <p/>
- * The class implements the logic of research of the configuration annotation.
- *
- * @author chemit
- */
-public abstract class AbstractActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> implements ActionConfigurationResolver<A, C> {
-
- /** the type of configuration's annotation */
- protected final Class<A> annotationImpl;
-
- /** the type of component that can fire an action */
- protected final Class<C> componentImpl;
-
- /**
- * The typed method (on component) to apply configuration on the action and component.
- *
- * @param component the component which fires the action
- * @param action the given action
- * @return the configuration's annotation
- */
- protected abstract A applyConfiguration0(C component, MyAbstractAction action);
-
- protected AbstractActionConfigurationResolver(Class<A> annotationImpl, Class<C> componentImpl) {
- this.annotationImpl = annotationImpl;
- this.componentImpl = componentImpl;
- }
-
- public A resolveConfiguration(MyAbstractAction action) {
- if (action.hasDelegate()) {
- return resolveConfiguration(action.getDelegate());
- }
- return action.getClass().getAnnotation(annotationImpl);
- }
-
- @SuppressWarnings({"unchecked"})
- public A applyConfiguration(JComponent component, MyAbstractAction action) {
- if (component != null && componentImpl.isAssignableFrom(component.getClass()))
- return applyConfiguration0((C) component, action);
-
- return null;
- }
-
- public Class<A> getAnnotationImpl() {
- return annotationImpl;
- }
-
- public Class<C> getComponentImpl() {
- return componentImpl;
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,77 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import javax.swing.JComponent;
+
+/**
+ * Common abstract class of a resolver of action configuration.
+ * <p/>
+ * The class implements the logic of research of the configuration annotation.
+ *
+ * @param <A> type of annotation
+ * @param <C> type of component
+ * @author chemit
+ */
+public abstract class AbstractActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> implements ActionConfigurationResolver<A, C> {
+
+ /** the type of configuration's annotation */
+ protected final Class<A> annotationImpl;
+
+ /** the type of component that can fire an action */
+ protected final Class<C> componentImpl;
+
+ /**
+ * The typed method (on component) to apply configuration on the action and component.
+ *
+ * @param component the component which fires the action
+ * @param action the given action
+ * @return the configuration's annotation
+ */
+ protected abstract A applyConfiguration0(C component, MyAbstractAction action);
+
+ protected AbstractActionConfigurationResolver(Class<A> annotationImpl, Class<C> componentImpl) {
+ this.annotationImpl = annotationImpl;
+ this.componentImpl = componentImpl;
+ }
+
+ @Override
+ public A resolveConfiguration(MyAbstractAction action) {
+ if (action.hasDelegate()) {
+ return resolveConfiguration(action.getDelegate());
+ }
+ return action.getClass().getAnnotation(annotationImpl);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public A applyConfiguration(JComponent component, MyAbstractAction action) {
+ if (component != null && componentImpl.isAssignableFrom(component.getClass())) {
+ return applyConfiguration0((C) component, action);
+ }
+
+ return null;
+ }
+
+ @Override
+ public Class<A> getAnnotationImpl() {
+ return annotationImpl;
+ }
+
+ @Override
+ public Class<C> getComponentImpl() {
+ return componentImpl;
+ }
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,395 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-
-
-package org.codelutin.jaxx.action;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtConstructor;
-import javassist.LoaderClassPath;
-import javassist.NotFoundException;
-import org.codelutin.util.SortedProperties;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedOptions;
-import javax.annotation.processing.SupportedSourceVersion;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.AnnotationValue;
-import javax.lang.model.element.AnnotationValueVisitor;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.SimpleAnnotationValueVisitor6;
-import javax.tools.FileObject;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardLocation;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-
-
-@SupportedAnnotationTypes(value = {"org.codelutin.jaxx.action.*"})
-(a)SupportedSourceVersion(SourceVersion.RELEASE_6)
-@SupportedOptions({"jaxx.verbose"})
-/**
- * Annotation processor to compute actions mapping.
- *
- * @author chemit */
-public class ActionAnnotationProcessing extends AbstractProcessor {
-
- /** the {@link ActionProvider} service declaration relative path */
- protected String providerDeclarationLocation = "META-INF/services/" + ActionProvider.class.getName();
-
- /** the relative path where to store actions mapping, will be complete with the name of base action to use */
- protected String actionsFileLocation = ActionProviderFromProperties.actionsFileLocation;
-
- /** verbose flag (can be activated by passing an annotation parameter to compiler via <code>-Ai18n.verbose</code>) */
- protected boolean verbose;
-
- /** the list of class processed by the processor */
- protected java.util.List<String> processedClass;
-
- /** the map of actions processed, keys are the action commaned and values are fqn of implementations */
- protected Properties actions;
-
- /** Extractor of values of annotations found */
- protected AnnotationValueVisitor<Object, Void> annotationValueExtractor;
-
- /** the type element of the base action to be used by {@link ActionProvider} */
- protected TypeElement baseActionElement;
-
- /** the fqn of the action provider to generate */
- protected String providerFQN;
-
- /** the fqn of the base action class to be used */
- protected String baseFQN;
-
- @Override
- public synchronized void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
- parseOptions();
- printDebug("verbose : " + verbose);
- printDebug("FileLocation : " + actionsFileLocation);
- processedClass = new ArrayList<String>();
- actions = new SortedProperties();
- }
-
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- for (TypeElement annotation : annotations) {
-
- Set<? extends Element> annotatedWith = roundEnv.getElementsAnnotatedWith(annotation);
-
- if (annotation.getQualifiedName().toString().equals(ActionProviderAnnotation.class.getName())) {
- // init provider
- if (annotatedWith.size() != 1) {
- throw new IllegalStateException("can have only one provider defined by the annotation " + ActionProviderAnnotation.class);
- }
-
- baseActionElement = (TypeElement) annotatedWith.iterator().next();
-
- //fixme it is not possible to know if baseActionElement is assigned from MyAbstractAction, since we
- // can NOT garanted at this stage thaht the class was compiled...
-
- baseFQN = baseActionElement.asType().toString();
- int index = baseFQN.lastIndexOf(".") + 1;
- String baseSimpleName = baseFQN.substring(index);
- String packageName = baseFQN.substring(0, index);
-
- providerFQN = packageName + baseSimpleName + "Provider";
- printDebug("providerFQN " + providerFQN);
- actionsFileLocation = String.format(actionsFileLocation, baseSimpleName);
- continue;
- }
-
- for (Element e : annotatedWith) {
- String className = e.toString();
-
- if (processedClass.contains(className)) {
- printWarning("class already processed " + className);
- // do not process class twice
- continue;
- }
-
- boolean wasTreated = registerActionsForClass(annotation.asType(), e);
- if (wasTreated) {
- printDebug("process class " + className);
- processedClass.add(className);
- } else {
- printDebug("class was not processed " + e);
- }
- }
- }
-
- if ((roundEnv.processingOver())) {
- printDebug("round is over " + roundEnv);
- try {
- if (baseActionElement != null) {
- // found the base action class to be compiled, so we have to write provider things...
- writeProviderClass();
- writeProviderServiceDeclaration();
- } else {
-
- // baseActionClass was not compiled at this time, must find it back
- // this means they should have an already mapping file written
-
- actionsFileLocation = findMappingFile();
-
- printInfo("reused actionFilesLocation " + actionsFileLocation);
- }
-
- writeActionMapping();
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- processedClass.clear();
- actions.clear();
- }
- }
-
- return true;
- }
-
- protected String findMappingFile() throws IOException {
- String path = String.format(actionsFileLocation, "dummy_" + System.nanoTime());
-
-
- FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", path);
- File dummyFile = new File(oldFo.toUri().toString()).getParentFile();
- File[] files = dummyFile.listFiles(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- return name.startsWith("jaxx-") && name.endsWith("-actions.properties");
- }
- });
- if (files.length < 1) {
- // this is not normal, should have exactly one file here
- throw new IllegalStateException("no provider name found, you must add on baseaction the annotation " + ActionProviderAnnotation.class);
- }
- File f = files[0];
- int index = f.getAbsolutePath().indexOf("META-INF");
-
- return f.getAbsolutePath().substring(index);
- }
-
- protected boolean registerActionsForClass(TypeMirror annotationType, Element e) {
- boolean doTreate = false;
- for (AnnotationMirror mirror : e.getAnnotationMirrors()) {
- if (!mirror.getAnnotationType().equals(annotationType)) {
- // do not treate other annotations
- continue;
- }
- doTreate = true;
- printDebug("found a annotation to treate : " + mirror + " for action : " + e.toString());
- for (String name : getActionNames(mirror)) {
- actions.put("action." + name, e.toString());
- printDebug("registerActionForClass " + name + " : " + e.toString());
- }
- }
- return doTreate;
- }
-
- protected void parseOptions() {
- java.util.Map options = processingEnv.getOptions();
- verbose = options.containsKey("jaxx.verbose");
- }
-
- protected void writeProviderClass() throws IOException, NotFoundException, CannotCompileException, ClassNotFoundException {
- OutputStream outputStream = null;
- try {
-
- ClassPool pool = ClassPool.getDefault();
-
- pool.appendClassPath(new LoaderClassPath(ActionProviderFromProperties.class.getClassLoader()));
-
- CtClass superClass = pool.get(ActionProviderFromProperties.class.getName());
- CtClass clazz = pool.makeClass(providerFQN);
- // define the base action class in javassist pool to make possible compilation
- pool.makeClass(baseFQN);
- clazz.setSuperclass(superClass);
- // add constructor
- CtConstructor constructor = new CtConstructor(null, clazz);
- constructor.setBody("super( " + baseFQN + ".class);");
- clazz.addConstructor(constructor);
- byte[] byteCode = clazz.toBytecode();
-
- JavaFileObject fo = processingEnv.getFiler().createClassFile(providerFQN);
- printInfo("writing " + fo.toUri());
- outputStream = fo.openOutputStream();
- outputStream.write(byteCode);
-
- } finally {
- if (outputStream != null)
- outputStream.close();
- }
- }
-
- protected void writeProviderServiceDeclaration() throws IOException {
- BufferedWriter w = null;
- try {
- FileObject fo = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", providerDeclarationLocation);
- printInfo("writing " + fo.toUri());
- w = new BufferedWriter(fo.openWriter());
- w.append("# generated by ").append(getClass().getName()).append("\n").toString();
- w.append("#").append(new java.util.Date().toString()).append("\n").toString();
- w.append(providerFQN);
- } finally {
- if (w != null)
- w.close();
- }
- }
-
- protected void writeActionMapping() throws IOException {
- if (actions.isEmpty()) {
- // nothing to write or overwrite
- return;
- }
-
- BufferedWriter w = null;
- try {
- Properties oldProps = loadOldActionMapping();
- if (oldProps != null) {
- oldProps.putAll(actions);
- actions = oldProps;
- }
- // ecriture de toutes les actions trouvees
- FileObject fo = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
- printInfo("writing " + fo.toUri());
- w = new BufferedWriter(fo.openWriter());
- actions.store(w, "generated by " + getClass().getName());
- } finally {
- if (w != null)
- w.close();
- }
- }
-
- protected Properties loadOldActionMapping() throws IOException {
- // reprise sur une ancienne compilation
- FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
- if (!new File(oldFo.toUri().toString()).exists()) {
- return null;
- }
- Properties oldProps = new SortedProperties();
- InputStream inputStream = null;
- try {
- inputStream = oldFo.openInputStream();
- if (inputStream != null) {
- oldProps.load(inputStream);
- }
- oldFo.delete();
- } finally {
- if (inputStream != null) {
- inputStream.close();
- }
- }
-
- return oldProps;
- }
-
- /**
- * Obtain the array of names to be used by the annotation
- *
- * @param element the dictonnary of values found in a annotation
- * @return thee array of names detected in the annotation
- */
- @SuppressWarnings({"unchecked"})
- protected String[] getActionNames(AnnotationMirror element) {
- String[] result = null;
- for (Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : element.getElementValues().entrySet()) {
- ExecutableElement type = entry.getKey();
- String name = type.getSimpleName().toString();
-
- if ("actionCommands".equals(name)) {
- List<String> stringList = (List<String>) entry.getValue().accept(getAnnotationValueExtractor(), null);
- result = stringList.toArray(new String[stringList.size()]);
- // a actionCommands field means
- break;
- }
- if ("actionCommandProvider".equals(name)) {
- TypeMirror t = (TypeMirror) entry.getValue().accept(getAnnotationValueExtractor(), null);
- String classname = t.toString();
- printDebug("actionCommandProvider = " + classname);
- if (classname.equals(ActionNameProvider.class.getName())) {
- continue;
- }
-
- // means there is a runtime names provider
- result = new String[]{":" + classname};
- break;
- }
- if ("actionCommand".equals(name)) {
- result = new String[]{(String) entry.getValue().accept(getAnnotationValueExtractor(), null)};
- }
- }
-
- return result;
- }
-
- protected AnnotationValueVisitor<Object, Void> getAnnotationValueExtractor() {
- if (annotationValueExtractor == null) {
- annotationValueExtractor = new SimpleAnnotationValueVisitor6<Object, Void>() {
-
- @Override
- protected Object defaultAction(Object o, Void aVoid) {
- return o;
- }
-
- @Override
- public Object visitArray(List<? extends AnnotationValue> vals, Void aVoid) {
- List<Object> realVals = new java.util.ArrayList<Object>();
- for (AnnotationValue val : vals) {
- realVals.add(val.accept(this, aVoid));
- }
- return realVals;
- }
-
- public Object visitType(TypeMirror t, Void aVoid) {
- return t;
- }
- };
- }
- return annotationValueExtractor;
- }
-
- protected void printWarning(String msg) {
- System.out.println("[WARN] " + getClass().getName() + " : " + msg);
- }
-
- protected void printInfo(String msg) {
- System.out.println("[INFO] " + getClass().getName() + " : " + msg);
- }
-
- protected void printDebug(String msg) {
- if (verbose) {
- System.out.println("[DEBUG] " + getClass().getName() + " : " + msg);
- }
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,398 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+
+
+package org.nuiton.jaxx.action;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.LoaderClassPath;
+import javassist.NotFoundException;
+import org.nuiton.util.SortedProperties;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedOptions;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.AnnotationValueVisitor;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.SimpleAnnotationValueVisitor6;
+import javax.tools.FileObject;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+
+@SupportedAnnotationTypes(value = {"org.nuiton.jaxx.action.*"})
+(a)SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedOptions({"jaxx.verbose"})
+/**
+ * Annotation processor to compute actions mapping.
+ *
+ * @author chemit */
+public class ActionAnnotationProcessing extends AbstractProcessor {
+
+ /** the {@link ActionProvider} service declaration relative path */
+ protected String providerDeclarationLocation = "META-INF/services/" + ActionProvider.class.getName();
+
+ /** the relative path where to store actions mapping, will be complete with the name of base action to use */
+ protected String actionsFileLocation = ActionProviderFromProperties.actionsFileLocation;
+
+ /** verbose flag (can be activated by passing an annotation parameter to compiler via <code>-Ai18n.verbose</code>) */
+ protected boolean verbose;
+
+ /** the list of class processed by the processor */
+ protected java.util.List<String> processedClass;
+
+ /** the map of actions processed, keys are the action commaned and values are fqn of implementations */
+ protected Properties actions;
+
+ /** Extractor of values of annotations found */
+ protected AnnotationValueVisitor<Object, Void> annotationValueExtractor;
+
+ /** the type element of the base action to be used by {@link ActionProvider} */
+ protected TypeElement baseActionElement;
+
+ /** the fqn of the action provider to generate */
+ protected String providerFQN;
+
+ /** the fqn of the base action class to be used */
+ protected String baseFQN;
+
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ parseOptions();
+ printDebug("verbose : " + verbose);
+ printDebug("FileLocation : " + actionsFileLocation);
+ processedClass = new ArrayList<String>();
+ actions = new SortedProperties();
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (TypeElement annotation : annotations) {
+
+ Set<? extends Element> annotatedWith = roundEnv.getElementsAnnotatedWith(annotation);
+
+ if (annotation.getQualifiedName().toString().equals(ActionProviderAnnotation.class.getName())) {
+ // init provider
+ if (annotatedWith.size() != 1) {
+ throw new IllegalStateException("can have only one provider defined by the annotation " + ActionProviderAnnotation.class);
+ }
+
+ baseActionElement = (TypeElement) annotatedWith.iterator().next();
+
+ //fixme it is not possible to know if baseActionElement is assigned from MyAbstractAction, since we
+ // can NOT garanted at this stage thaht the class was compiled...
+
+ baseFQN = baseActionElement.asType().toString();
+ int index = baseFQN.lastIndexOf(".") + 1;
+ String baseSimpleName = baseFQN.substring(index);
+ String packageName = baseFQN.substring(0, index);
+
+ providerFQN = packageName + baseSimpleName + "Provider";
+ printDebug("providerFQN " + providerFQN);
+ actionsFileLocation = String.format(actionsFileLocation, baseSimpleName);
+ continue;
+ }
+
+ for (Element e : annotatedWith) {
+ String className = e.toString();
+
+ if (processedClass.contains(className)) {
+ printWarning("class already processed " + className);
+ // do not process class twice
+ continue;
+ }
+
+ boolean wasTreated = registerActionsForClass(annotation.asType(), e);
+ if (wasTreated) {
+ printDebug("process class " + className);
+ processedClass.add(className);
+ } else {
+ printDebug("class was not processed " + e);
+ }
+ }
+ }
+
+ if ((roundEnv.processingOver())) {
+ printDebug("round is over " + roundEnv);
+ try {
+ if (baseActionElement != null) {
+ // found the base action class to be compiled, so we have to write provider things...
+ writeProviderClass();
+ writeProviderServiceDeclaration();
+ } else {
+
+ // baseActionClass was not compiled at this time, must find it back
+ // this means they should have an already mapping file written
+
+ actionsFileLocation = findMappingFile();
+
+ printInfo("reused actionFilesLocation " + actionsFileLocation);
+ }
+
+ writeActionMapping();
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ processedClass.clear();
+ actions.clear();
+ }
+ }
+
+ return true;
+ }
+
+ protected String findMappingFile() throws IOException {
+ String path = String.format(actionsFileLocation, "dummy_" + System.nanoTime());
+
+
+ FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", path);
+ File dummyFile = new File(oldFo.toUri().toString()).getParentFile();
+ File[] files = dummyFile.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.startsWith("jaxx-") && name.endsWith("-actions.properties");
+ }
+ });
+ if (files.length < 1) {
+ // this is not normal, should have exactly one file here
+ throw new IllegalStateException("no provider name found, you must add on baseaction the annotation " + ActionProviderAnnotation.class);
+ }
+ File f = files[0];
+ int index = f.getAbsolutePath().indexOf("META-INF");
+
+ return f.getAbsolutePath().substring(index);
+ }
+
+ protected boolean registerActionsForClass(TypeMirror annotationType, Element e) {
+ boolean doTreate = false;
+ for (AnnotationMirror mirror : e.getAnnotationMirrors()) {
+ if (!mirror.getAnnotationType().equals(annotationType)) {
+ // do not treate other annotations
+ continue;
+ }
+ doTreate = true;
+ printDebug("found a annotation to treate : " + mirror + " for action : " + e.toString());
+ for (String name : getActionNames(mirror)) {
+ actions.put("action." + name, e.toString());
+ printDebug("registerActionForClass " + name + " : " + e.toString());
+ }
+ }
+ return doTreate;
+ }
+
+ protected void parseOptions() {
+ java.util.Map options = processingEnv.getOptions();
+ verbose = options.containsKey("jaxx.verbose");
+ }
+
+ protected void writeProviderClass() throws IOException, NotFoundException, CannotCompileException, ClassNotFoundException {
+ OutputStream outputStream = null;
+ try {
+
+ ClassPool pool = ClassPool.getDefault();
+
+ pool.appendClassPath(new LoaderClassPath(ActionProviderFromProperties.class.getClassLoader()));
+
+ CtClass superClass = pool.get(ActionProviderFromProperties.class.getName());
+ CtClass clazz = pool.makeClass(providerFQN);
+ // define the base action class in javassist pool to make possible compilation
+ pool.makeClass(baseFQN);
+ clazz.setSuperclass(superClass);
+ // add constructor
+ CtConstructor constructor = new CtConstructor(null, clazz);
+ constructor.setBody("super( " + baseFQN + ".class);");
+ clazz.addConstructor(constructor);
+ byte[] byteCode = clazz.toBytecode();
+
+ JavaFileObject fo = processingEnv.getFiler().createClassFile(providerFQN);
+ printInfo("writing " + fo.toUri());
+ outputStream = fo.openOutputStream();
+ outputStream.write(byteCode);
+
+ } finally {
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
+
+ protected void writeProviderServiceDeclaration() throws IOException {
+ BufferedWriter w = null;
+ try {
+ FileObject fo = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", providerDeclarationLocation);
+ printInfo("writing " + fo.toUri());
+ w = new BufferedWriter(fo.openWriter());
+ w.append("# generated by ").append(getClass().getName()).append("\n").toString();
+ w.append("#").append(new java.util.Date().toString()).append("\n").toString();
+ w.append(providerFQN);
+ } finally {
+ if (w != null) {
+ w.close();
+ }
+ }
+ }
+
+ protected void writeActionMapping() throws IOException {
+ if (actions.isEmpty()) {
+ // nothing to write or overwrite
+ return;
+ }
+
+ BufferedWriter w = null;
+ try {
+ Properties oldProps = loadOldActionMapping();
+ if (oldProps != null) {
+ oldProps.putAll(actions);
+ actions = oldProps;
+ }
+ // ecriture de toutes les actions trouvees
+ FileObject fo = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
+ printInfo("writing " + fo.toUri());
+ w = new BufferedWriter(fo.openWriter());
+ actions.store(w, "generated by " + getClass().getName());
+ } finally {
+ if (w != null) {
+ w.close();
+ }
+ }
+ }
+
+ protected Properties loadOldActionMapping() throws IOException {
+ // reprise sur une ancienne compilation
+ FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
+ if (!new File(oldFo.toUri().toString()).exists()) {
+ return null;
+ }
+ Properties oldProps = new SortedProperties();
+ InputStream inputStream = null;
+ try {
+ inputStream = oldFo.openInputStream();
+ if (inputStream != null) {
+ oldProps.load(inputStream);
+ }
+ oldFo.delete();
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+
+ return oldProps;
+ }
+
+ /**
+ * Obtain the array of names to be used by the annotation
+ *
+ * @param element the dictonnary of values found in a annotation
+ * @return thee array of names detected in the annotation
+ */
+ @SuppressWarnings({"unchecked"})
+ protected String[] getActionNames(AnnotationMirror element) {
+ String[] result = null;
+ for (Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : element.getElementValues().entrySet()) {
+ ExecutableElement type = entry.getKey();
+ String name = type.getSimpleName().toString();
+
+ if ("actionCommands".equals(name)) {
+ List<String> stringList = (List<String>) entry.getValue().accept(getAnnotationValueExtractor(), null);
+ result = stringList.toArray(new String[stringList.size()]);
+ // a actionCommands field means
+ break;
+ }
+ if ("actionCommandProvider".equals(name)) {
+ TypeMirror t = (TypeMirror) entry.getValue().accept(getAnnotationValueExtractor(), null);
+ String classname = t.toString();
+ printDebug("actionCommandProvider = " + classname);
+ if (classname.equals(ActionNameProvider.class.getName())) {
+ continue;
+ }
+
+ // means there is a runtime names provider
+ result = new String[]{":" + classname};
+ break;
+ }
+ if ("actionCommand".equals(name)) {
+ result = new String[]{(String) entry.getValue().accept(getAnnotationValueExtractor(), null)};
+ }
+ }
+
+ return result;
+ }
+
+ protected AnnotationValueVisitor<Object, Void> getAnnotationValueExtractor() {
+ if (annotationValueExtractor == null) {
+ annotationValueExtractor = new SimpleAnnotationValueVisitor6<Object, Void>() {
+
+ @Override
+ protected Object defaultAction(Object o, Void aVoid) {
+ return o;
+ }
+
+ @Override
+ public Object visitArray(List<? extends AnnotationValue> vals, Void aVoid) {
+ List<Object> realVals = new java.util.ArrayList<Object>();
+ for (AnnotationValue val : vals) {
+ realVals.add(val.accept(this, aVoid));
+ }
+ return realVals;
+ }
+
+ public Object visitType(TypeMirror t, Void aVoid) {
+ return t;
+ }
+ };
+ }
+ return annotationValueExtractor;
+ }
+
+ protected void printWarning(String msg) {
+ System.out.println("[WARN] " + getClass().getName() + " : " + msg);
+ }
+
+ protected void printInfo(String msg) {
+ System.out.println("[INFO] " + getClass().getName() + " : " + msg);
+ }
+
+ protected void printDebug(String msg) {
+ if (verbose) {
+ System.out.println("[DEBUG] " + getClass().getName() + " : " + msg);
+ }
+ }
+}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfig.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ##% */
-package org.codelutin.jaxx.action;
+package org.nuiton.jaxx.action;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -51,10 +51,10 @@
/**
* @return the class to obtain at runtime the array of names to be used in actions mapping.
* <p/>
- * <b>Note : the special value {@link org.codelutin.jaxx.action.ActionNameProvider} is used to says not to used
+ * <b>Note : the special value {@link org.nuiton.jaxx.action.ActionNameProvider} is used to says not to used
* œthis mecanism since we can not set a null value in a annotation</b>
*/
- Class<? extends ActionNameProvider> actionCommandProvider() default org.codelutin.jaxx.action.ActionNameProvider.class;
+ Class<? extends ActionNameProvider> actionCommandProvider() default org.nuiton.jaxx.action.ActionNameProvider.class;
/**
* @return la clef i18n du texte de l'action, si vide ignoré
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,67 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-
-/**
- * Implementation of configuration's resolver for annotation {@link ActionConfig}
- *
- * @author chemit
- */
-public class ActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ActionConfig, AbstractButton> {
-
- public ActionConfigConfigurationResolver() {
- super(ActionConfig.class, AbstractButton.class);
- }
-
- protected ActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
- ActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- //System.out.println("found action with name : " + anno.name());
- action.putValue(Action.NAME, _(anno.name()));
- }
- //if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- //}
- if (!anno.smallIcon().isEmpty()) {
- action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
- }
- if (anno.mnemonic() != '\0') {
- action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
- } else if (component != null) {
- action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
- }
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
-
- if (component == null) {
- action.putValue("hideActionText", anno.hideActionText());
- } else {
- boolean actionText = component.getHideActionText();
- action.putValue("hideActionText", anno.hideActionText() || actionText);
- }
- action.putValue(Action.SELECTED_KEY, anno.selected());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,68 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link ActionConfig}
+ *
+ * @author chemit
+ */
+public class ActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ActionConfig, AbstractButton> {
+
+ public ActionConfigConfigurationResolver() {
+ super(ActionConfig.class, AbstractButton.class);
+ }
+
+ @Override
+ protected ActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
+ ActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ //System.out.println("found action with name : " + anno.name());
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ //if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ //}
+ if (!anno.smallIcon().isEmpty()) {
+ action.putValue(Action.SMALL_ICON, org.nuiton.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
+ }
+ if (anno.mnemonic() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
+ } else if (component != null) {
+ action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
+ }
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+
+ if (component == null) {
+ action.putValue("hideActionText", anno.hideActionText());
+ } else {
+ boolean actionText = component.getHideActionText();
+ action.putValue("hideActionText", anno.hideActionText() || actionText);
+ }
+ action.putValue(Action.SELECTED_KEY, anno.selected());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,52 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import javax.swing.JComponent;
-
-/**
- * The contract to be realized to resolve an {@link MyAbstractAction} configuration.
- * <p/>
- * Configuration is done by a Annotation of type {@link A} placed on the action class.
- * <p/>
- * If the instanciated action box the real action, we should always search on the boxed action.
- * <p/>
- * Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
- * of the component type is given by the {@link C} class.
- *
- * @author chemit
- */
-public interface ActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> {
- /**
- * Search the annotation that configure the given action (or the boxed action).
- *
- * @param action current action
- * @return the configuration of the action
- */
- A resolveConfiguration(MyAbstractAction action);
-
- /**
- * @param component widget that requires the action
- * @param action given action
- * @return the configuration of the action
- */
- A applyConfiguration(JComponent component, MyAbstractAction action);
-
- /** @return the configuration annotation dealed by this resolver */
- Class<A> getAnnotationImpl();
-
- /** @return the class of the component which can fired the action */
- Class<C> getComponentImpl();
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,54 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import javax.swing.JComponent;
+
+/**
+ * The contract to be realized to resolve an {@link MyAbstractAction} configuration.
+ * <p/>
+ * Configuration is done by a Annotation of type {@link A} placed on the action class.
+ * <p/>
+ * If the instanciated action box the real action, we should always search on the boxed action.
+ * <p/>
+ * Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
+ * of the component type is given by the {@link C} class.
+ *
+ * @param <A> type of annotation for config
+ * @param <C> type of component
+ * @author chemit
+ */
+public interface ActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> {
+ /**
+ * Search the annotation that configure the given action (or the boxed action).
+ *
+ * @param action current action
+ * @return the configuration of the action
+ */
+ A resolveConfiguration(MyAbstractAction action);
+
+ /**
+ * @param component widget that requires the action
+ * @param action given action
+ * @return the configuration of the action
+ */
+ A applyConfiguration(JComponent component, MyAbstractAction action);
+
+ /** @return the configuration annotation dealed by this resolver */
+ Class<A> getAnnotationImpl();
+
+ /** @return the class of the component which can fired the action */
+ Class<C> getComponentImpl();
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,149 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import jaxx.runtime.JAXXObject;
-
-import javax.swing.JComponent;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * Action factory using the <code>ActionConfig-like</code> annotations to configure actions.
- * <p/>
- * <p/>
- * An {@link ActionFactory} builds actions always on a same type <code>A</code> and obtain them from some
- * {@link ActionProvider} via methods {@link #newAction(String, JComponent)} and {@link #newAction(String)} .
- * <p/>
- * If the action coming from the provider is not on the same type <code>A</code>, then the action is boxed in a *
- * action <code>A</code> and use the generic mecanism of delegation provided by {@link MyAbstractAction}.
- * <p/>
- * Use after the {@link #loadActions(jaxx.runtime.JAXXObject)} to instanciate actions in ui with id equals a known
- * action...
- * <p/>
- * All actions instanciated are stored in a cache that you can request via method {@link #getActionFromCache(String)},
- * {@link #cacheEntrySet()} and {@link #resetCache()}.
- * <p/>
- * You can also from this factory fires some action via the methods {@link #fireAction(String, Object, JComponent)} ,
- * {@link #fireAction(String, Object)} , {@link #fireAction0(String, Object, MyAbstractAction)}.
- * <p/>
- * Finally, a {@link #dispose()} method is there to shut down all instanciated action when you want to dispose all uis.
- *
- * @author chemit
- * @see ActionProvider
- * @see MyAbstractAction
- */
-public interface ActionFactory<A extends MyAbstractAction> {
-
- /**
- * Method to init the dictionary of knwon action implementations.
- *
- * @return the dictionary of known action implementations
- */
- Map<String, Class<? extends MyAbstractAction>> init();
-
- /** @return the class of the base action of the factory. */
- Class<A> getBaseClass();
-
- /** @return the set of all the action's classes known by the factory. */
- Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet();
-
- /** @return the array of names of all actions known by the factory */
- String[] getActionNames();
-
- /** @return the set of all actions cached in factory indexed by their name */
- Set<Entry<String, A>> cacheEntrySet();
-
- /**
- * @param actionKey the action's key
- * @return the action in cache or <code>null</code> if action is not in cache
- */
- MyAbstractAction getActionFromCache(String actionKey);
-
- /** clear the cache of instanciated actions. */
- void resetCache();
-
- /**
- * @param actionKey the key of an action
- * @return the action with this key from cache, or <code>null</code> if this action is not in cache
- */
-
- //A get(String actionKey);
-
- /**
- * For a given ui, load all actions registred in factory.
- * <p/>
- * The id of the widget in ui is directly mapped to a action key.
- *
- * @param ui the ui to treate
- */
- void loadActions(JAXXObject ui);
-
- /**
- * Obtain an action instance given his key and widget
- *
- * @param actionKey the key of action
- * @param component the component using the action
- * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)}
- */
- A newAction(String actionKey, JComponent component);
-
- /**
- * Obtain an action instance given his key (should call {@link #newAction(String, JComponent)}
- * <p/>
- * This is a convinient method when you want to obtain an action with no attached widget.
- *
- * @param actionKey the key of action
- * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)}
- */
- A newAction(String actionKey);
-
-
- /**
- * Fire an action given his key, his source and tthe widget responsible of action
- *
- * @param actionKey the action's key
- * @param source the object source of action
- * @param component the component doing the action
- */
- void fireAction(String actionKey, Object source, JComponent component);
-
- /**
- * Fire an action given his key and his source, no widget are involved here
- *
- * @param actionKey the action's key
- * @param source the object source of action
- */
- void fireAction(String actionKey, Object source);
-
- /**
- * Fire an action given his action's key, his source and the real action.
- * <p/>
- * This is a convinient method when you need to modified action before fire it.
- *
- * @param actionKey action's key
- * @param source source of action
- * @param action real action
- */
- void fireAction0(String actionKey, Object source, A action);
-
-
- /**
- * dispose all actions in cache using {@link MyAbstractAction#disposeUI()} on each
- * action, then {@link #resetCache()}
- */
- void dispose();
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,150 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import jaxx.runtime.JAXXObject;
+
+import javax.swing.JComponent;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * Action factory using the <code>ActionConfig-like</code> annotations to configure actions.
+ * <p/>
+ * <p/>
+ * An {@link ActionFactory} builds actions always on a same type <code>A</code> and obtain them from some
+ * {@link ActionProvider} via methods {@link #newAction(String, JComponent)} and {@link #newAction(String)} .
+ * <p/>
+ * If the action coming from the provider is not on the same type <code>A</code>, then the action is boxed in a *
+ * action <code>A</code> and use the generic mecanism of delegation provided by {@link MyAbstractAction}.
+ * <p/>
+ * Use after the {@link #loadActions(jaxx.runtime.JAXXObject)} to instanciate actions in ui with id equals a known
+ * action...
+ * <p/>
+ * All actions instanciated are stored in a cache that you can request via method {@link #getActionFromCache(String)},
+ * {@link #cacheEntrySet()} and {@link #resetCache()}.
+ * <p/>
+ * You can also from this factory fires some action via the methods {@link #fireAction(String, Object, JComponent)} ,
+ * {@link #fireAction(String, Object)} , {@link #fireAction0(String, Object, MyAbstractAction)}.
+ * <p/>
+ * Finally, a {@link #dispose()} method is there to shut down all instanciated action when you want to dispose all uis.
+ *
+ * @param <A> type of boxed action
+ * @author chemit
+ * @see ActionProvider
+ * @see MyAbstractAction
+ */
+public interface ActionFactory<A extends MyAbstractAction> {
+
+ /**
+ * Method to init the dictionary of knwon action implementations.
+ *
+ * @return the dictionary of known action implementations
+ */
+ Map<String, Class<? extends MyAbstractAction>> init();
+
+ /** @return the class of the base action of the factory. */
+ Class<A> getBaseClass();
+
+ /** @return the set of all the action's classes known by the factory. */
+ Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet();
+
+ /** @return the array of names of all actions known by the factory */
+ String[] getActionNames();
+
+ /** @return the set of all actions cached in factory indexed by their name */
+ Set<Entry<String, A>> cacheEntrySet();
+
+ /**
+ * @param actionKey the action's key
+ * @return the action in cache or <code>null</code> if action is not in cache
+ */
+ MyAbstractAction getActionFromCache(String actionKey);
+
+ /** clear the cache of instanciated actions. */
+ void resetCache();
+
+ /**
+ * @param actionKey the key of an action
+ * @return the action with this key from cache, or <code>null</code> if this action is not in cache
+ */
+
+ //A get(String actionKey);
+
+ /**
+ * For a given ui, load all actions registred in factory.
+ * <p/>
+ * The id of the widget in ui is directly mapped to a action key.
+ *
+ * @param ui the ui to treate
+ */
+ void loadActions(JAXXObject ui);
+
+ /**
+ * Obtain an action instance given his key and widget
+ *
+ * @param actionKey the key of action
+ * @param component the component using the action
+ * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)}
+ */
+ A newAction(String actionKey, JComponent component);
+
+ /**
+ * Obtain an action instance given his key (should call {@link #newAction(String, JComponent)}
+ * <p/>
+ * This is a convinient method when you want to obtain an action with no attached widget.
+ *
+ * @param actionKey the key of action
+ * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)}
+ */
+ A newAction(String actionKey);
+
+
+ /**
+ * Fire an action given his key, his source and tthe widget responsible of action
+ *
+ * @param actionKey the action's key
+ * @param source the object source of action
+ * @param component the component doing the action
+ */
+ void fireAction(String actionKey, Object source, JComponent component);
+
+ /**
+ * Fire an action given his key and his source, no widget are involved here
+ *
+ * @param actionKey the action's key
+ * @param source the object source of action
+ */
+ void fireAction(String actionKey, Object source);
+
+ /**
+ * Fire an action given his action's key, his source and the real action.
+ * <p/>
+ * This is a convinient method when you need to modified action before fire it.
+ *
+ * @param actionKey action's key
+ * @param source source of action
+ * @param action real action
+ */
+ void fireAction0(String actionKey, Object source, A action);
+
+
+ /**
+ * dispose all actions in cache using {@link MyAbstractAction#disposeUI()} on each
+ * action, then {@link #resetCache()}
+ */
+ void dispose();
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,457 +0,0 @@
-/*
-* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-* ##% */
-package org.codelutin.jaxx.action;
-
-import jaxx.runtime.JAXXObject;
-import jaxx.runtime.swing.JAXXToggleButton;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.Resource;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-import javax.swing.Icon;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import java.awt.event.ActionEvent;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.TreeMap;
-
-/**
- * A simple implementation of {@link ActionFactory} using some {@link ActionProvider} to seek actions.
- * <p/>
- * <p/>
- * An entry is in that form : <code>action.actionName=fqn</code> where
- * <p/>
- * <code>actionName</code> is the key of action used in factory, and
- * <code>fqn</code> is the fully qualified name of the implemented action class.
- * <p/>
- * A special clase is to have for a given entry a key like this : <code>action.:fqn'=fqn</code>, in that case,
- * le fqn' is a classe of type {@link org.codelutin.jaxx.action.ActionNameProvider} which gives us at
- * runtime the names of each entry to put in cache for the givne action fqn.
- *
- * @author chemit
- */
-public class ActionFactoryFromProvider<A extends MyAbstractAction> implements ActionFactory<A> {
-
- protected static Log log = LogFactory.getLog(ActionFactoryFromProvider.class);
-
- public static <A extends MyAbstractAction> ActionFactory<A> newInstance(Class<A> klazz) {
- return new ActionFactoryFromProvider<A>(klazz);
- }
-
- /** class of encapsuling action */
- protected Class<A> baseImpl;
-
- /** dictionary of known actions implementations */
- private Map<String, Class<? extends MyAbstractAction>> impls;
-
- /** dictionary of instanciated actions */
- private Map<String, A> cache;
-
- protected final ActionConfigConfigurationResolver actionConfigInitializer;
- protected final ToggleActionConfigConfigurationResolver toggleActionConfigInitializer;
- protected final SelectActionConfigConfigurationResolver selectActionConfigInitializer;
-
- protected List<AbstractActionConfigurationResolver> configurationResolvers;
-
- protected ActionFactoryFromProvider(Class<A> baseImpl) {
- this.baseImpl = baseImpl;
- this.impls = init();
- this.cache = new TreeMap<String, A>();
- this.configurationResolvers = new java.util.ArrayList<AbstractActionConfigurationResolver>();
-
- this.toggleActionConfigInitializer = registerInitializer(ToggleActionConfigConfigurationResolver.class);
- this.actionConfigInitializer = registerInitializer(ActionConfigConfigurationResolver.class);
- this.selectActionConfigInitializer = registerInitializer(SelectActionConfigConfigurationResolver.class);
- }
-
- public Class<A> getBaseClass() {
- return baseImpl;
- }
-
- public void resetCache() {
- cache.clear();
- }
-
- /*public A get(String actionKey) {
- return cache.get(actionKey);
- }*/
-
- public void loadActions(JAXXObject ui) {
- if (log.isDebugEnabled()) {
- log.debug("for ui " + ui.getClass());
- }
- for (Map.Entry<String, Class<? extends MyAbstractAction>> entry : implsEntrySet()) {
- String actionKey = entry.getKey();
- Object comp = ui.getObjectById(actionKey);
- if (comp == null || !(comp instanceof AbstractButton || comp instanceof JComboBox)) {
- // nothing to do
- continue;
- }
- if (log.isTraceEnabled()) {
- log.trace("detect action " + actionKey);
- }
- if (comp instanceof AbstractButton) {
- AbstractButton component = (AbstractButton) comp;
- A action = newAction(actionKey, component);
-
- component.setAction(action);
-
- if (component instanceof JAXXToggleButton) {
- JAXXToggleButton glueComponent = (JAXXToggleButton) component;
- glueComponent.setIcon((Icon) action.getValue(Action.SMALL_ICON));
- Integer integer = (Integer) action.getValue(Action.MNEMONIC_KEY);
- if (integer != null) {
- glueComponent.setNormalMnemonic(integer);
- }
- glueComponent.setSelectedIcon((Icon) action.getValue(Action.SMALL_ICON + 2));
- integer = (Integer) action.getValue(Action.MNEMONIC_KEY + 2);
- if (integer != null) {
- glueComponent.setGlueMnemonic(integer);
- }
- glueComponent.setGlueText((String) action.getValue(Action.NAME + 2));
- glueComponent.setGlueTooltipText((String) action.getValue(Action.SHORT_DESCRIPTION + 2));
-
- glueComponent.setNormalText((String) action.getValue(Action.NAME));
- glueComponent.setNormalTooltipText((String) action.getValue(Action.SHORT_DESCRIPTION));
- }
-
- Boolean value = (Boolean) action.getValue("hideActionText");
- component.setHideActionText(value != null && value);
- action.setEnabled(true);
- continue;
- }
- // is JComboBox
- JComboBox component = (JComboBox) comp;
- A action = newAction(actionKey, component);
-
- component.setAction(action);
- Integer val = (Integer) action.getValue("selectedIndex");
- if (val != null && val != -1 && val < component.getItemCount() && val != component.getSelectedIndex()) {
- component.setSelectedIndex(val);
- }
- }
- }
-
- /**
- * @param actionKey le nom de l'action tel que définie dans le fichier
- * de mapping (sans le prefix action.)
- * @param component le button où rattacher l'action
- * @return une nouvelle instance de l'action associée à sa clef.
- */
- public A newAction(String actionKey, JComponent component) {
- // try first in cache
- A result = getActionFromCache(actionKey);
- if (result != null) {
- return result;
- }
-
- try {
- result = newActionInstance(actionKey);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("create <" + actionKey + " : " + result + ">");
- }
-
- // recherche de l'annotation de configuration
- ActionConfigurationResolver<?, ?> configurationResolver = resolveActionConfiguration(result);
-
- if (configurationResolver != null) {
- configurationResolver.applyConfiguration(component, result);
- }
-
- try {
-
- if (configurationResolver != null) {
- if (AbstractButton.class.isAssignableFrom(configurationResolver.getComponentImpl())) {
- finalizeNewAction((AbstractButton) component, result, configurationResolver);
- }
-
- if (JComboBox.class.isAssignableFrom(configurationResolver.getComponentImpl())) {
- finalizeNewAction((JComboBox) component, result, configurationResolver);
- }
-
- return result;
- }
-
- if (component == null || component instanceof AbstractButton) {
- finalizeNewAction((AbstractButton) component, result, configurationResolver);
- return result;
- }
-
- if (component instanceof JComboBox) {
- finalizeNewAction((JComboBox) component, result, configurationResolver);
- }
- } finally {
- // save result in cache
- cache.put(actionKey, result);
- }
-
- return result;
- }
-
- public A newAction(String actionKey) {
- return newAction(actionKey, null);
- }
-
- public String[] getActionNames() {
- return impls.keySet().toArray(new String[impls.size()]);
- }
-
- public Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet() {
- return impls.entrySet();
- }
-
- public Set<Entry<String, A>> cacheEntrySet() {
- return cache.entrySet();
- }
-
- public void fireAction(String actionKey, Object source, JComponent component) {
- A action = newAction(actionKey, component);
- fireAction0(actionKey, source, action);
- }
-
- public void fireAction(String actionKey, Object source) {
- fireAction(actionKey, source, null);
- }
-
- /**
- * @param actionKey la clef de l'action
- * @return l'action deja stockee dans le cache d'action, ou <code>null</code> si non trouvée.
- */
- public A getActionFromCache(String actionKey) {
- // on vérifie que l'action existe bien
- checkRegistredAction(actionKey);
-
- A action = null;
- // try in cache
- if (cache.containsKey(actionKey)) {
- // use cached action
- action = cache.get(actionKey);
- if (log.isDebugEnabled()) {
- log.debug("use cache action " + action);
- }
- }
- return action;
- }
-
- public void dispose() {
- if (log.isInfoEnabled()) {
- log.info(this);
- }
- for (String actionKey : getActionNames()) {
- MyAbstractAction action = getActionFromCache(actionKey);
- if (action != null) {
- action.disposeUI();
- }
- }
- resetCache();
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- resetCache();
- impls.clear();
- }
-
- /**
- * @param component le button où rattacher l'action
- * @param action action
- * @param configurationResolver initializer
- */
- protected void finalizeNewAction(AbstractButton component, MyAbstractAction action, ActionConfigurationResolver<?, ?> configurationResolver) {
-
- if (configurationResolver == null) {
- // no configurationResolver matching,
- if (component != null) {
- action.putValue(Action.ACTION_COMMAND_KEY, component.getName());
- action.putValue(Action.SHORT_DESCRIPTION, component.getToolTipText());
- action.putValue(Action.SMALL_ICON, component.getIcon());
- action.putValue(Action.NAME, component.getText());
- action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
- action.putValue("hideActionText", component.getHideActionText());
- if (component instanceof JAXXToggleButton) {
- JAXXToggleButton glueComponent = (JAXXToggleButton) component;
- action.putValue(Action.SHORT_DESCRIPTION, glueComponent.getNormalTooltipText());
- action.putValue(Action.NAME, glueComponent.getNormalText());
- action.putValue(Action.SMALL_ICON, glueComponent.getIcon());
- action.putValue(Action.MNEMONIC_KEY, glueComponent.getNormalMnemonic());
- action.putValue(Action.SHORT_DESCRIPTION + 2, glueComponent.getGlueTooltipText());
- action.putValue(Action.NAME + 2, glueComponent.getGlueText());
- action.putValue(Action.SMALL_ICON + 2, glueComponent.getSelectedIcon());
- action.putValue(Action.MNEMONIC_KEY + 2, glueComponent.getGlueMnemonic());
- }
- }
-
- }
-
- String text = (String) action.getValue(Action.NAME);
- Integer mnemo = (Integer) action.getValue(Action.MNEMONIC_KEY);
- if (mnemo != null && mnemo != '\0') {
- int pos = text.indexOf((char) mnemo.intValue());
- if (pos == -1) {
- pos = text.indexOf(Character.toLowerCase((char) mnemo.intValue()));
- }
- action.putValue(Action.DISPLAYED_MNEMONIC_INDEX_KEY, pos);
- }
-
- }
-
- /**
- * @param component le select box où rattacher l'action
- * @param action action
- * @param configurationResolver initializer
- */
- protected void finalizeNewAction(JComboBox component, MyAbstractAction action, ActionConfigurationResolver<?, ?> configurationResolver) {
-
- if (configurationResolver == null) {
- action.putValue(Action.ACTION_COMMAND_KEY, component.getName());
- action.putValue(Action.SHORT_DESCRIPTION, component.getToolTipText());
- //result.putValue("selectedIndex", component.getSelectedIndex());
- }
-
- }
-
- protected ActionConfigurationResolver resolveActionConfiguration(MyAbstractAction action) {
- for (ActionConfigurationResolver resolver : configurationResolvers) {
- if (resolver.resolveConfiguration(action) != null) {
- return resolver;
- }
- }
- return null;
- }
-
- protected <I extends AbstractActionConfigurationResolver> I registerInitializer(Class<I> initizalizer) {
- try {
- I instance = initizalizer.newInstance();
- configurationResolvers.add(instance);
- return instance;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void fireAction0(String actionKey, Object source, A action) {
- if (action == null) {
- log.warn("could not find action " + actionKey);
- return;
- }
- ActionEvent event = new ActionEvent(source, ActionEvent.ACTION_FIRST, actionKey);
- action.actionPerformed(event);
- }
-
- protected void checkRegistredAction(String actionKey) {
- if (!impls.containsKey(actionKey)) {
- throw new IllegalStateException("can not find a registered action for key " + actionKey);
- }
- }
-
-
- @SuppressWarnings({"unchecked"})
- protected A newActionInstance(String actionKey) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
- Class<? extends MyAbstractAction> klazz = impls.get(actionKey);
- MyAbstractAction result;
- result = klazz.getConstructor(String.class).newInstance(actionKey);
- result.putValue(Action.ACTION_COMMAND_KEY, actionKey);
- if (!getBaseClass().isAssignableFrom(klazz)) {
- // the instanciated action must be boxed in the base Action of the factory
- result = getBaseClass().getConstructor(MyAbstractAction.class).newInstance(result);
- }
- return (A) result;
- }
-
-
- public Map<String, Class<? extends MyAbstractAction>> init() {
- if (log.isDebugEnabled()) {
- log.debug("start loading " + this);
- }
- URLClassLoader newCL = fixClassLoader(getClass());
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (newCL != null) {
- // replace current cl by our fiexed cl
- Thread.currentThread().setContextClassLoader(newCL);
- }
- // obtain a ServiceLoader on ActionProvider
- ServiceLoader<ActionProvider> loader = ServiceLoader.load(ActionProvider.class);
- Map<String, Class<? extends MyAbstractAction>> cache = new TreeMap<String, Class<? extends MyAbstractAction>>();
-
- for (ActionProvider<?> actionProvider : loader) {
- if (log.isDebugEnabled()) {
- log.debug("found " + actionProvider);
- }
- cache.putAll(actionProvider.getClasses());
- }
- if (newCL != null) {
- // to avoid side effects, push back old cl
- Thread.currentThread().setContextClassLoader(cl);
- }
- return cache;
- }
-
- /**
- * Fix the class loader when application is launched from a java -jar
- * The ServiceLoader seems not to find services from jar manifest...
- * <p/>
- * Our solution is to get all jar from the jar manifest and create a URLClassLoader, this is not perfect but works.
- * <p/>
- * TODO Put this nice code in a ServiceLoaderUtil in lutinutil...
- *
- * @param klass class to use to obtain classloader
- * @return the fixed classloader
- */
- public static URLClassLoader fixClassLoader(Class klass) {
- ClassLoader l = klass.getClassLoader();
- URLClassLoader cl;
- if (!(l instanceof URLClassLoader)) {
- log.warn("using cl is not a URL classloader " + l);
- cl = new URLClassLoader(new URL[0], l);
- } else {
- cl = (URLClassLoader) l;
- }
- if (cl.getURLs().length == 1) {
- // come from a java -jar, must expand all jar to make possible ServiceLoader to work
- try {
- //todo put this in lutinutil ServiceLoaderUtil
- URL[] urls = Resource.getClassPathURLsFromJarManifest(cl.getURLs()[0]);
- URLClassLoader newCL = new URLClassLoader(urls);
- if (log.isTraceEnabled()) {
- for (URL url : newCL.getURLs()) {
- log.trace(url);
- }
- }
- return newCL;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return null;
- }
-
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,470 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* ##% */
+package org.nuiton.jaxx.action;
+
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.swing.JAXXToggleButton;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.Resource;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import java.awt.event.ActionEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * A simple implementation of {@link ActionFactory} using some {@link ActionProvider} to seek actions.
+ * <p/>
+ * <p/>
+ * An entry is in that form : <code>action.actionName=fqn</code> where
+ * <p/>
+ * <code>actionName</code> is the key of action used in factory, and
+ * <code>fqn</code> is the fully qualified name of the implemented action class.
+ * <p/>
+ * A special clase is to have for a given entry a key like this : <code>action.:fqn'=fqn</code>, in that case,
+ * le fqn' is a classe of type {@link org.nuiton.jaxx.action.ActionNameProvider} which gives us at
+ * runtime the names of each entry to put in cache for the givne action fqn.
+ *
+ * @param <A> the type of action
+ * @author chemit
+ */
+public class ActionFactoryFromProvider<A extends MyAbstractAction> implements ActionFactory<A> {
+
+ protected static Log log = LogFactory.getLog(ActionFactoryFromProvider.class);
+
+ public static <A extends MyAbstractAction> ActionFactory<A> newInstance(Class<A> klazz) {
+ return new ActionFactoryFromProvider<A>(klazz);
+ }
+
+ /** class of encapsuling action */
+ protected Class<A> baseImpl;
+
+ /** dictionary of known actions implementations */
+ private Map<String, Class<? extends MyAbstractAction>> impls;
+
+ /** dictionary of instanciated actions */
+ private Map<String, A> cache;
+
+ protected final ActionConfigConfigurationResolver actionConfigInitializer;
+ protected final ToggleActionConfigConfigurationResolver toggleActionConfigInitializer;
+ protected final SelectActionConfigConfigurationResolver selectActionConfigInitializer;
+
+ protected List<AbstractActionConfigurationResolver> configurationResolvers;
+
+ protected ActionFactoryFromProvider(Class<A> baseImpl) {
+ this.baseImpl = baseImpl;
+ this.impls = init();
+ this.cache = new TreeMap<String, A>();
+ this.configurationResolvers = new java.util.ArrayList<AbstractActionConfigurationResolver>();
+
+ this.toggleActionConfigInitializer = registerInitializer(ToggleActionConfigConfigurationResolver.class);
+ this.actionConfigInitializer = registerInitializer(ActionConfigConfigurationResolver.class);
+ this.selectActionConfigInitializer = registerInitializer(SelectActionConfigConfigurationResolver.class);
+ }
+
+ @Override
+ public Class<A> getBaseClass() {
+ return baseImpl;
+ }
+
+ @Override
+ public void resetCache() {
+ cache.clear();
+ }
+
+ /*public A get(String actionKey) {
+ return cache.get(actionKey);
+ }*/
+
+ @Override
+ public void loadActions(JAXXObject ui) {
+ if (log.isDebugEnabled()) {
+ log.debug("for ui " + ui.getClass());
+ }
+ for (Map.Entry<String, Class<? extends MyAbstractAction>> entry : implsEntrySet()) {
+ String actionKey = entry.getKey();
+ Object comp = ui.getObjectById(actionKey);
+ if (comp == null || !(comp instanceof AbstractButton || comp instanceof JComboBox)) {
+ // nothing to do
+ continue;
+ }
+ if (log.isTraceEnabled()) {
+ log.trace("detect action " + actionKey);
+ }
+ if (comp instanceof AbstractButton) {
+ AbstractButton component = (AbstractButton) comp;
+ A action = newAction(actionKey, component);
+
+ component.setAction(action);
+
+ if (component instanceof JAXXToggleButton) {
+ JAXXToggleButton glueComponent = (JAXXToggleButton) component;
+ glueComponent.setIcon((Icon) action.getValue(Action.SMALL_ICON));
+ Integer integer = (Integer) action.getValue(Action.MNEMONIC_KEY);
+ if (integer != null) {
+ glueComponent.setNormalMnemonic(integer);
+ }
+ glueComponent.setSelectedIcon((Icon) action.getValue(Action.SMALL_ICON + 2));
+ integer = (Integer) action.getValue(Action.MNEMONIC_KEY + 2);
+ if (integer != null) {
+ glueComponent.setGlueMnemonic(integer);
+ }
+ glueComponent.setGlueText((String) action.getValue(Action.NAME + 2));
+ glueComponent.setGlueTooltipText((String) action.getValue(Action.SHORT_DESCRIPTION + 2));
+
+ glueComponent.setNormalText((String) action.getValue(Action.NAME));
+ glueComponent.setNormalTooltipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ }
+
+ Boolean value = (Boolean) action.getValue("hideActionText");
+ component.setHideActionText(value != null && value);
+ action.setEnabled(true);
+ continue;
+ }
+ // is JComboBox
+ JComboBox component = (JComboBox) comp;
+ A action = newAction(actionKey, component);
+
+ component.setAction(action);
+ Integer val = (Integer) action.getValue("selectedIndex");
+ if (val != null && val != -1 && val < component.getItemCount() && val != component.getSelectedIndex()) {
+ component.setSelectedIndex(val);
+ }
+ }
+ }
+
+ /**
+ * @param actionKey le nom de l'action tel que définie dans le fichier
+ * de mapping (sans le prefix action.)
+ * @param component le button où rattacher l'action
+ * @return une nouvelle instance de l'action associée à sa clef.
+ */
+ @Override
+ public A newAction(String actionKey, JComponent component) {
+ // try first in cache
+ A result = getActionFromCache(actionKey);
+ if (result != null) {
+ return result;
+ }
+
+ try {
+ result = newActionInstance(actionKey);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("create <" + actionKey + " : " + result + ">");
+ }
+
+ // recherche de l'annotation de configuration
+ ActionConfigurationResolver<?, ?> configurationResolver = resolveActionConfiguration(result);
+
+ if (configurationResolver != null) {
+ configurationResolver.applyConfiguration(component, result);
+ }
+
+ try {
+
+ if (configurationResolver != null) {
+ if (AbstractButton.class.isAssignableFrom(configurationResolver.getComponentImpl())) {
+ finalizeNewAction((AbstractButton) component, result, configurationResolver);
+ }
+
+ if (JComboBox.class.isAssignableFrom(configurationResolver.getComponentImpl())) {
+ finalizeNewAction((JComboBox) component, result, configurationResolver);
+ }
+
+ return result;
+ }
+
+ if (component == null || component instanceof AbstractButton) {
+ finalizeNewAction((AbstractButton) component, result, configurationResolver);
+ return result;
+ }
+
+ if (component instanceof JComboBox) {
+ finalizeNewAction((JComboBox) component, result, configurationResolver);
+ }
+ } finally {
+ // save result in cache
+ cache.put(actionKey, result);
+ }
+
+ return result;
+ }
+
+ @Override
+ public A newAction(String actionKey) {
+ return newAction(actionKey, null);
+ }
+
+ @Override
+ public String[] getActionNames() {
+ return impls.keySet().toArray(new String[impls.size()]);
+ }
+
+ @Override
+ public Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet() {
+ return impls.entrySet();
+ }
+
+ @Override
+ public Set<Entry<String, A>> cacheEntrySet() {
+ return cache.entrySet();
+ }
+
+ @Override
+ public void fireAction(String actionKey, Object source, JComponent component) {
+ A action = newAction(actionKey, component);
+ fireAction0(actionKey, source, action);
+ }
+
+ @Override
+ public void fireAction(String actionKey, Object source) {
+ fireAction(actionKey, source, null);
+ }
+
+ /**
+ * @param actionKey la clef de l'action
+ * @return l'action deja stockee dans le cache d'action, ou <code>null</code> si non trouvée.
+ */
+ @Override
+ public A getActionFromCache(String actionKey) {
+ // on vérifie que l'action existe bien
+ checkRegistredAction(actionKey);
+
+ A action = null;
+ // try in cache
+ if (cache.containsKey(actionKey)) {
+ // use cached action
+ action = cache.get(actionKey);
+ if (log.isDebugEnabled()) {
+ log.debug("use cache action " + action);
+ }
+ }
+ return action;
+ }
+
+ @Override
+ public void dispose() {
+ if (log.isInfoEnabled()) {
+ log.info(this);
+ }
+ for (String actionKey : getActionNames()) {
+ MyAbstractAction action = getActionFromCache(actionKey);
+ if (action != null) {
+ action.disposeUI();
+ }
+ }
+ resetCache();
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ resetCache();
+ impls.clear();
+ }
+
+ /**
+ * @param component le button où rattacher l'action
+ * @param action action
+ * @param configurationResolver initializer
+ */
+ protected void finalizeNewAction(AbstractButton component, MyAbstractAction action, ActionConfigurationResolver<?, ?> configurationResolver) {
+
+ if (configurationResolver == null) {
+ // no configurationResolver matching,
+ if (component != null) {
+ action.putValue(Action.ACTION_COMMAND_KEY, component.getName());
+ action.putValue(Action.SHORT_DESCRIPTION, component.getToolTipText());
+ action.putValue(Action.SMALL_ICON, component.getIcon());
+ action.putValue(Action.NAME, component.getText());
+ action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
+ action.putValue("hideActionText", component.getHideActionText());
+ if (component instanceof JAXXToggleButton) {
+ JAXXToggleButton glueComponent = (JAXXToggleButton) component;
+ action.putValue(Action.SHORT_DESCRIPTION, glueComponent.getNormalTooltipText());
+ action.putValue(Action.NAME, glueComponent.getNormalText());
+ action.putValue(Action.SMALL_ICON, glueComponent.getIcon());
+ action.putValue(Action.MNEMONIC_KEY, glueComponent.getNormalMnemonic());
+ action.putValue(Action.SHORT_DESCRIPTION + 2, glueComponent.getGlueTooltipText());
+ action.putValue(Action.NAME + 2, glueComponent.getGlueText());
+ action.putValue(Action.SMALL_ICON + 2, glueComponent.getSelectedIcon());
+ action.putValue(Action.MNEMONIC_KEY + 2, glueComponent.getGlueMnemonic());
+ }
+ }
+
+ }
+
+ String text = (String) action.getValue(Action.NAME);
+ Integer mnemo = (Integer) action.getValue(Action.MNEMONIC_KEY);
+ if (mnemo != null && mnemo != '\0') {
+ int pos = text.indexOf((char) mnemo.intValue());
+ if (pos == -1) {
+ pos = text.indexOf(Character.toLowerCase((char) mnemo.intValue()));
+ }
+ action.putValue(Action.DISPLAYED_MNEMONIC_INDEX_KEY, pos);
+ }
+
+ }
+
+ /**
+ * @param component le select box où rattacher l'action
+ * @param action action
+ * @param configurationResolver initializer
+ */
+ protected void finalizeNewAction(JComboBox component, MyAbstractAction action, ActionConfigurationResolver<?, ?> configurationResolver) {
+
+ if (configurationResolver == null) {
+ action.putValue(Action.ACTION_COMMAND_KEY, component.getName());
+ action.putValue(Action.SHORT_DESCRIPTION, component.getToolTipText());
+ //result.putValue("selectedIndex", component.getSelectedIndex());
+ }
+
+ }
+
+ protected ActionConfigurationResolver resolveActionConfiguration(MyAbstractAction action) {
+ for (ActionConfigurationResolver resolver : configurationResolvers) {
+ if (resolver.resolveConfiguration(action) != null) {
+ return resolver;
+ }
+ }
+ return null;
+ }
+
+ protected <I extends AbstractActionConfigurationResolver> I registerInitializer(Class<I> initizalizer) {
+ try {
+ I instance = initizalizer.newInstance();
+ configurationResolvers.add(instance);
+ return instance;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void fireAction0(String actionKey, Object source, A action) {
+ if (action == null) {
+ log.warn("could not find action " + actionKey);
+ return;
+ }
+ ActionEvent event = new ActionEvent(source, ActionEvent.ACTION_FIRST, actionKey);
+ action.actionPerformed(event);
+ }
+
+ protected void checkRegistredAction(String actionKey) {
+ if (!impls.containsKey(actionKey)) {
+ throw new IllegalStateException("can not find a registered action for key " + actionKey);
+ }
+ }
+
+
+ @SuppressWarnings({"unchecked"})
+ protected A newActionInstance(String actionKey) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+ Class<? extends MyAbstractAction> klazz = impls.get(actionKey);
+ MyAbstractAction result;
+ result = klazz.getConstructor(String.class).newInstance(actionKey);
+ result.putValue(Action.ACTION_COMMAND_KEY, actionKey);
+ if (!getBaseClass().isAssignableFrom(klazz)) {
+ // the instanciated action must be boxed in the base Action of the factory
+ result = getBaseClass().getConstructor(MyAbstractAction.class).newInstance(result);
+ }
+ return (A) result;
+ }
+
+
+ public Map<String, Class<? extends MyAbstractAction>> init() {
+ if (log.isDebugEnabled()) {
+ log.debug("start loading " + this);
+ }
+ URLClassLoader newCL = fixClassLoader(getClass());
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (newCL != null) {
+ // replace current cl by our fiexed cl
+ Thread.currentThread().setContextClassLoader(newCL);
+ }
+ // obtain a ServiceLoader on ActionProvider
+ ServiceLoader<ActionProvider> loader = ServiceLoader.load(ActionProvider.class);
+ Map<String, Class<? extends MyAbstractAction>> cache = new TreeMap<String, Class<? extends MyAbstractAction>>();
+
+ for (ActionProvider<?> actionProvider : loader) {
+ if (log.isDebugEnabled()) {
+ log.debug("found " + actionProvider);
+ }
+ cache.putAll(actionProvider.getClasses());
+ }
+ if (newCL != null) {
+ // to avoid side effects, push back old cl
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ return cache;
+ }
+
+ /**
+ * Fix the class loader when application is launched from a java -jar
+ * The ServiceLoader seems not to find services from jar manifest...
+ * <p/>
+ * Our solution is to get all jar from the jar manifest and create a URLClassLoader, this is not perfect but works.
+ * <p/>
+ * TODO Put this nice code in a ServiceLoaderUtil in lutinutil...
+ *
+ * @param klass class to use to obtain classloader
+ * @return the fixed classloader
+ */
+ public static URLClassLoader fixClassLoader(Class<?> klass) {
+ ClassLoader l = klass.getClassLoader();
+ URLClassLoader cl;
+ if (!(l instanceof URLClassLoader)) {
+ log.warn("using cl is not a URL classloader " + l);
+ cl = new URLClassLoader(new URL[0], l);
+ } else {
+ cl = (URLClassLoader) l;
+ }
+ if (cl.getURLs().length == 1) {
+ // come from a java -jar, must expand all jar to make possible ServiceLoader to work
+ try {
+ //todo put this in lutinutil ServiceLoaderUtil
+ URL[] urls = Resource.getClassPathURLsFromJarManifest(cl.getURLs()[0]);
+ URLClassLoader newCL = new URLClassLoader(urls);
+ if (log.isTraceEnabled()) {
+ for (URL url : newCL.getURLs()) {
+ log.trace(url);
+ }
+ }
+ return newCL;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionNameProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -12,7 +12,7 @@
* - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
-package org.codelutin.jaxx.action;
+package org.nuiton.jaxx.action;
/**
* Contrat pour obtenir les noms d'une action de maniere dynamique.
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,35 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-/**
- * Contract to be realized by a provider of Actions.
- * <p/>
- * A provider of actions is based on a certain type of {@link MyAbstractAction} (<code>A</code>) with an accessor
- * {@link #getBaseClass()} and deliver some implementations of such actions indexed by their logical names via the
- * method {#link #getClasses()}.
- *
- * @author chemit
- * @see MyAbstractAction
- */
-public interface ActionProvider<A extends MyAbstractAction> {
-
- /** @return the base classe of provided actions */
- Class<A> getBaseClass();
-
- /** @return the provided actions classes */
- java.util.Map<String, Class<? extends A>> getClasses();
-
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,36 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+/**
+ * Contract to be realized by a provider of Actions.
+ * <p/>
+ * A provider of actions is based on a certain type of {@link MyAbstractAction} (<code>A</code>) with an accessor
+ * {@link #getBaseClass()} and deliver some implementations of such actions indexed by their logical names via the
+ * method {#link #getClasses()}.
+ *
+ * @param <A> type of action boxed
+ * @author chemit
+ * @see MyAbstractAction
+ */
+public interface ActionProvider<A extends MyAbstractAction> {
+
+ /** @return the base classe of provided actions */
+ Class<A> getBaseClass();
+
+ /** @return the provided actions classes */
+ java.util.Map<String, Class<? extends A>> getClasses();
+
+}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -12,7 +12,7 @@
* - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
-package org.codelutin.jaxx.action;
+package org.nuiton.jaxx.action;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,135 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-/** @author chemit */
-public class ActionProviderFromProperties<A extends MyAbstractAction> implements ActionProvider<A> {
-
- /** default prefix for an entryin mapping file. */
- protected static final String ACTION_KEY_PREFIX = "action.";
-
- protected static final String actionsFileLocation = "META-INF/jaxx-%1$s-actions.properties";
-
- protected String propertiesPath;
-
- protected static Log log = LogFactory.getLog(ActionProviderFromProperties.class);
-
- protected Class<A> baseClass;
-
- protected Map<String, Class<? extends A>> actions;
-
-
- protected ActionProviderFromProperties(Class<A> baseClass) {
-
- this.baseClass = baseClass;
- this.propertiesPath = "/" + String.format(actionsFileLocation, baseClass.getSimpleName());
- this.actions = initCache();
- }
-
- public Class<A> getBaseClass() {
- return baseClass;
- }
-
- public Map<String, Class<? extends A>> getClasses() {
- return actions;
- }
-
- @Override
- public String toString() {
- return super.toString() + "<baseClass:" + baseClass.getSimpleName() + ">";
- }
-
- protected void clearCache() {
- if (actions != null) {
- actions.clear();
- actions = null;
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- clearCache();
- }
-
- @SuppressWarnings({"unchecked"})
- protected Map<String, Class<? extends A>> initCache() {
-
- InputStream inputStream = null;
-
- Properties properties = new Properties();
-
- try {
- inputStream = getClass().getResourceAsStream(propertiesPath);
- if (inputStream == null) {
- //throw new NullPointerException("could not find action file " + propertiesPath);
- // actually, there is nothing to load, this is not an error
- } else {
- log.info("load " + propertiesPath);
- properties.load(inputStream);
- }
- } catch (IOException e) {
- String message = _("jaxx.error.load.actions.file", e.getMessage());
- log.warn(message);
- throw new RuntimeException(message);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- log.warn(_("jaxx.error.close.actions.file", e.getMessage()));
- //throw new RuntimeException(_("jaxx.error.load.actions.file", e.getMessage()));
- }
- }
- }
-
- Map<String, Class<? extends A>> cache = new TreeMap<String, Class<? extends A>>();
- int prefix = ACTION_KEY_PREFIX.length();
- for (Map.Entry<Object, Object> entry : properties.entrySet()) {
- String key = entry.getKey() + "";
- String qfn = entry.getValue() + "";
- try {
- Class<? extends A> implCass;
- implCass = (Class<? extends A>) Class.forName(qfn);
- String actionKey = key.substring(prefix);
- if (actionKey.startsWith(":")) {
- // this is a RuntimeActionNameProvider
- Class<ActionNameProvider> klazz = (Class<ActionNameProvider>) Class.forName(actionKey.substring(1));
- for (String s : klazz.newInstance().getActionCommands()) {
- log.debug("found action <" + s + " : " + implCass + ">");
- cache.put(s, implCass);
- }
- continue;
- }
- log.debug("found action <" + actionKey + " : " + implCass + ">");
- cache.put(actionKey, implCass);
- } catch (Exception e) {
- throw new RuntimeException(_("jaxx.error.load.actions.class", key, qfn), e);
- }
- }
-
- return cache;
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,135 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n._;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+/** @author chemit */
+public class ActionProviderFromProperties<A extends MyAbstractAction> implements ActionProvider<A> {
+
+ /** default prefix for an entryin mapping file. */
+ protected static final String ACTION_KEY_PREFIX = "action.";
+
+ protected static final String actionsFileLocation = "META-INF/jaxx-%1$s-actions.properties";
+
+ protected String propertiesPath;
+
+ protected static Log log = LogFactory.getLog(ActionProviderFromProperties.class);
+
+ protected Class<A> baseClass;
+
+ protected Map<String, Class<? extends A>> actions;
+
+
+ protected ActionProviderFromProperties(Class<A> baseClass) {
+
+ this.baseClass = baseClass;
+ this.propertiesPath = "/" + String.format(actionsFileLocation, baseClass.getSimpleName());
+ this.actions = initCache();
+ }
+
+ public Class<A> getBaseClass() {
+ return baseClass;
+ }
+
+ public Map<String, Class<? extends A>> getClasses() {
+ return actions;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<baseClass:" + baseClass.getSimpleName() + ">";
+ }
+
+ protected void clearCache() {
+ if (actions != null) {
+ actions.clear();
+ actions = null;
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ clearCache();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected Map<String, Class<? extends A>> initCache() {
+
+ InputStream inputStream = null;
+
+ Properties properties = new Properties();
+
+ try {
+ inputStream = getClass().getResourceAsStream(propertiesPath);
+ if (inputStream == null) {
+ //throw new NullPointerException("could not find action file " + propertiesPath);
+ // actually, there is nothing to load, this is not an error
+ } else {
+ log.info("load " + propertiesPath);
+ properties.load(inputStream);
+ }
+ } catch (IOException e) {
+ String message = _("jaxx.error.load.actions.file", e.getMessage());
+ log.warn(message);
+ throw new RuntimeException(message);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ log.warn(_("jaxx.error.close.actions.file", e.getMessage()));
+ //throw new RuntimeException(_("jaxx.error.load.actions.file", e.getMessage()));
+ }
+ }
+ }
+
+ Map<String, Class<? extends A>> cache = new TreeMap<String, Class<? extends A>>();
+ int prefix = ACTION_KEY_PREFIX.length();
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ String key = entry.getKey() + "";
+ String qfn = entry.getValue() + "";
+ try {
+ Class<? extends A> implCass;
+ implCass = (Class<? extends A>) Class.forName(qfn);
+ String actionKey = key.substring(prefix);
+ if (actionKey.startsWith(":")) {
+ // this is a RuntimeActionNameProvider
+ Class<ActionNameProvider> klazz = (Class<ActionNameProvider>) Class.forName(actionKey.substring(1));
+ for (String s : klazz.newInstance().getActionCommands()) {
+ log.debug("found action <" + s + " : " + implCass + ">");
+ cache.put(s, implCass);
+ }
+ continue;
+ }
+ log.debug("found action <" + actionKey + " : " + implCass + ">");
+ cache.put(actionKey, implCass);
+ } catch (Exception e) {
+ throw new RuntimeException(_("jaxx.error.load.actions.class", key, qfn), e);
+ }
+ }
+
+ return cache;
+ }
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,259 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import jaxx.runtime.JAXXObject;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JComponent;
-import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeListener;
-
-/**
- * Action de base à utiliser pour encapsuler toutes les actions du système.
- * <p/>
- * Ces actions seront chargées par des {@link ActionProvider} et des {@link ActionFactory}.
- *
- * @author chemit
- */
-public abstract class MyAbstractAction extends AbstractAction {
-
- protected static org.apache.commons.logging.Log log = LogFactory.getLog(MyAbstractAction.class);
-
- private static final long serialVersionUID = -810023044364620841L;
-
- protected ActionEvent e;
-
- protected MyAbstractAction delegate;
-
- protected abstract String getPrefix();
-
- protected MyAbstractAction(String name) {
- super(name);
- }
-
- protected MyAbstractAction(MyAbstractAction delegate) {
- super((String) delegate.getValue(Action.NAME));
- this.delegate = delegate;
- }
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (hasDelegate()) {
- // delegate to real action
- delegate.actionPerformed(e);
- return;
- }
- log.debug("------------------------------------------------------------");
- log.debug("event : " + e);
- log.debug("source : " + e.getSource());
- this.e = e;
- try {
- boolean accepted = beforeAction(e);
- log.debug("action : " + this);
- if (accepted) {
- log.info(getActionName() + " (treate:" + accepted + ") : " + this);
- } else {
- log.debug(getActionName() + " (treate:" + accepted + ") : " + this);
- }
- if (accepted) {
- doAction(e);
- setStatus(_("jaxx.action.done", getName()));
- updateUI();
- }
- } catch (Exception e1) {
- showError(e1);
- } finally {
- this.e = null;
- // always clear action after use : actions are staless
- clear();
- }
- }
-
- public String getI18nToolTipText() {
- if (hasDelegate()) {
- return delegate.getI18nToolTipText();
- }
- return getPrefix() + ".action." + getActionName() + ".tooltip";
- }
-
- public void updateUI() {
- if (hasDelegate()) {
- delegate.updateUI();
- }
- // nothing by default
- }
-
- public void disposeUI() {
- if (hasDelegate()) {
- delegate.disposeUI();
- }
- // nothing by default
- }
-
- public MyAbstractAction getDelegate() {
- return delegate;
- }
-
- public boolean hasDelegate() {
- return delegate != null;
- }
-
- protected String getName() {
- return (String) getValue(NAME);
- }
-
- protected String getActionName() {
- return (String) getValue(ACTION_COMMAND_KEY);
- }
-
- protected void setStatus(String status) {
- // do nothing from here
- if (log.isDebugEnabled()) {
- log.debug(status);
- }
- }
-
- protected boolean beforeAction(ActionEvent evt) throws Exception {
- boolean enabled = isEnabled();
- if (enabled && hasDelegate()) {
- return delegate.beforeAction(evt);
- }
- return enabled;
- }
-
- protected void doAction(ActionEvent evt) throws Exception {
- if (hasDelegate()) {
- delegate.doAction(evt);
- }
- // nothing by default
- }
-
- protected JComponent getUIObject(String name, JAXXObject container) {
- if (container == null) {
- return null;
- }
- return (JComponent) container.getObjectById(name);
- }
-
- protected void clear() {
- if (hasDelegate()) {
- delegate.clear();
- }
- // nothing by default
- }
-
- protected void showError(Exception e) {
- log.error(e);
- }
-
- // -----------------------------------------------------------------------------
- // --- super class delegate methods -------------------------------------------
- // -----------------------------------------------------------------------------
-
- @Override
- public Object getValue(String key) {
- if (hasDelegate()) {
- return delegate.getValue(key);
- }
- return super.getValue(key);
- }
-
- @Override
- public void putValue(String key, Object newValue) {
- if (hasDelegate()) {
- delegate.putValue(key, newValue);
- }
- super.putValue(key, newValue);
- }
-
- @Override
- public boolean isEnabled() {
- if (hasDelegate()) {
- return delegate.isEnabled();
- }
- return super.isEnabled();
- }
-
- @Override
- public void setEnabled(boolean newValue) {
- if (hasDelegate()) {
- delegate.setEnabled(newValue);
- }
- super.setEnabled(newValue);
- }
-
- @Override
- public Object[] getKeys() {
- if (hasDelegate()) {
- return getKeys();
- }
- return super.getKeys();
- }
-
- @Override
- protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (hasDelegate()) {
- delegate.firePropertyChange(propertyName, oldValue, newValue);
- }
- super.firePropertyChange(propertyName, oldValue, newValue);
- }
-
- @Override
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (hasDelegate()) {
- delegate.addPropertyChangeListener(listener);
- }
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- if (hasDelegate()) {
- delegate.removePropertyChangeListener(listener);
- }
- super.removePropertyChangeListener(listener);
- }
-
- @Override
- public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
- if (hasDelegate()) {
- return delegate.getPropertyChangeListeners();
- }
- return super.getPropertyChangeListeners();
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- if (hasDelegate()) {
- return clone();
- }
- return super.clone();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- if (hasDelegate()) {
- sb.append("[delegate: ").append(delegate.toString()).append("]");
- } else {
- sb.append("<key:").append(getActionName()).append(">");
- }
- return sb.toString();
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,260 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import jaxx.runtime.JAXXObject;
+import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * Action de base à utiliser pour encapsuler toutes les actions du système.
+ * <p/>
+ * Ces actions seront chargées par des {@link ActionProvider} et des {@link ActionFactory}.
+ *
+ * @author chemit
+ */
+public abstract class MyAbstractAction extends AbstractAction {
+
+ protected static org.apache.commons.logging.Log log = LogFactory.getLog(MyAbstractAction.class);
+
+ private static final long serialVersionUID = -810023044364620841L;
+
+ protected ActionEvent e;
+
+ protected MyAbstractAction delegate;
+
+ protected abstract String getPrefix();
+
+ protected MyAbstractAction(String name) {
+ super(name);
+ }
+
+ protected MyAbstractAction(MyAbstractAction delegate) {
+ super((String) delegate.getValue(Action.NAME));
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ if (hasDelegate()) {
+ // delegate to real action
+ delegate.actionPerformed(e);
+ return;
+ }
+ log.debug("------------------------------------------------------------");
+ log.debug("event : " + e);
+ log.debug("source : " + e.getSource());
+ this.e = e;
+ try {
+ boolean accepted = beforeAction(e);
+ log.debug("action : " + this);
+ if (accepted) {
+ log.info(getActionName() + " (treate:" + accepted + ") : " + this);
+ } else {
+ log.debug(getActionName() + " (treate:" + accepted + ") : " + this);
+ }
+ if (accepted) {
+ doAction(e);
+ setStatus(_("jaxx.action.done", getName()));
+ updateUI();
+ }
+ } catch (Exception e1) {
+ showError(e1);
+ } finally {
+ this.e = null;
+ // always clear action after use : actions are staless
+ clear();
+ }
+ }
+
+ public String getI18nToolTipText() {
+ if (hasDelegate()) {
+ return delegate.getI18nToolTipText();
+ }
+ return getPrefix() + ".action." + getActionName() + ".tooltip";
+ }
+
+ public void updateUI() {
+ if (hasDelegate()) {
+ delegate.updateUI();
+ }
+ // nothing by default
+ }
+
+ public void disposeUI() {
+ if (hasDelegate()) {
+ delegate.disposeUI();
+ }
+ // nothing by default
+ }
+
+ public MyAbstractAction getDelegate() {
+ return delegate;
+ }
+
+ public boolean hasDelegate() {
+ return delegate != null;
+ }
+
+ protected String getName() {
+ return (String) getValue(NAME);
+ }
+
+ protected String getActionName() {
+ return (String) getValue(ACTION_COMMAND_KEY);
+ }
+
+ protected void setStatus(String status) {
+ // do nothing from here
+ if (log.isDebugEnabled()) {
+ log.debug(status);
+ }
+ }
+
+ protected boolean beforeAction(ActionEvent evt) throws Exception {
+ boolean canContinue = isEnabled();
+ if (canContinue && hasDelegate()) {
+ return delegate.beforeAction(evt);
+ }
+ return canContinue;
+ }
+
+ protected void doAction(ActionEvent evt) throws Exception {
+ if (hasDelegate()) {
+ delegate.doAction(evt);
+ }
+ // nothing by default
+ }
+
+ protected JComponent getUIObject(String name, JAXXObject container) {
+ if (container == null) {
+ return null;
+ }
+ return (JComponent) container.getObjectById(name);
+ }
+
+ protected void clear() {
+ if (hasDelegate()) {
+ delegate.clear();
+ }
+ // nothing by default
+ }
+
+ protected void showError(Exception e) {
+ log.error(e);
+ }
+
+ // -----------------------------------------------------------------------------
+ // --- super class delegate methods -------------------------------------------
+ // -----------------------------------------------------------------------------
+
+ @Override
+ public Object getValue(String key) {
+ if (hasDelegate()) {
+ return delegate.getValue(key);
+ }
+ return super.getValue(key);
+ }
+
+ @Override
+ public void putValue(String key, Object newValue) {
+ if (hasDelegate()) {
+ delegate.putValue(key, newValue);
+ }
+ super.putValue(key, newValue);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (hasDelegate()) {
+ return delegate.isEnabled();
+ }
+ return super.isEnabled();
+ }
+
+ @Override
+ public void setEnabled(boolean newValue) {
+ if (hasDelegate()) {
+ delegate.setEnabled(newValue);
+ }
+ super.setEnabled(newValue);
+ }
+
+ @Override
+ public Object[] getKeys() {
+ if (hasDelegate()) {
+ return getKeys();
+ }
+ return super.getKeys();
+ }
+
+ @Override
+ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ if (hasDelegate()) {
+ delegate.firePropertyChange(propertyName, oldValue, newValue);
+ }
+ super.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ @Override
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (hasDelegate()) {
+ delegate.addPropertyChangeListener(listener);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (hasDelegate()) {
+ delegate.removePropertyChangeListener(listener);
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
+ if (hasDelegate()) {
+ return delegate.getPropertyChangeListeners();
+ }
+ return super.getPropertyChangeListeners();
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ if (hasDelegate()) {
+ return clone();
+ }
+ return super.clone();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(super.toString());
+ if (hasDelegate()) {
+ sb.append("[delegate: ").append(delegate.toString()).append("]");
+ } else {
+ sb.append("<key:").append(getActionName()).append(">");
+ }
+ return sb.toString();
+ }
+}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfig.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ##% */
-package org.codelutin.jaxx.action;
+package org.nuiton.jaxx.action;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -51,10 +51,10 @@
/**
* @return the class to obtain at runtime the array of names to be used in actions mapping.
* <p/>
- * <b>Note : the special value {@link org.codelutin.jaxx.action.ActionNameProvider} is used to says not to used
+ * <b>Note : the special value {@link org.nuiton.jaxx.action.ActionNameProvider} is used to says not to used
* œthis mecanism since we can not set a null value in a annotation</b>
*/
- Class<? extends ActionNameProvider> actionCommandProvider() default org.codelutin.jaxx.action.ActionNameProvider.class;
+ Class<? extends ActionNameProvider> actionCommandProvider() default org.nuiton.jaxx.action.ActionNameProvider.class;
/**
* @return la clef i18n du texte de l'action, si vide ignoré
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,53 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.Action;
-import javax.swing.JComboBox;
-
-/**
- * Implementation of configuration's resolver for annotation {@link SelectActionConfig}
- *
- * @author chemit
- */
-public class SelectActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<SelectActionConfig, JComboBox> {
-
- public SelectActionConfigConfigurationResolver() {
- super(SelectActionConfig.class, JComboBox.class);
- }
-
- protected SelectActionConfig applyConfiguration0(JComboBox component, MyAbstractAction action) {
- SelectActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- action.putValue(Action.NAME, _(anno.name()));
- }
- if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- } else {
- action.putValue(Action.SHORT_DESCRIPTION, _(component.getToolTipText()));
- }
- action.putValue("selectedIndex", anno.selectedIndex());
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,54 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.Action;
+import javax.swing.JComboBox;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link SelectActionConfig}
+ *
+ * @author chemit
+ */
+public class SelectActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<SelectActionConfig, JComboBox> {
+
+ public SelectActionConfigConfigurationResolver() {
+ super(SelectActionConfig.class, JComboBox.class);
+ }
+
+ @Override
+ protected SelectActionConfig applyConfiguration0(JComboBox component, MyAbstractAction action) {
+ SelectActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ } else {
+ action.putValue(Action.SHORT_DESCRIPTION, _(component.getToolTipText()));
+ }
+ action.putValue("selectedIndex", anno.selectedIndex());
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfig.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ##% */
-package org.codelutin.jaxx.action;
+package org.nuiton.jaxx.action;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -49,10 +49,10 @@
/**
* @return the class to obtain at runtime the array of names to be used in actions mapping.
* <p/>
- * <b>Note : the special value {@link org.codelutin.jaxx.action.ActionNameProvider} is used to says not to used
+ * <b>Note : the special value {@link org.nuiton.jaxx.action.ActionNameProvider} is used to says not to used
* œthis mecanism since we can not set a null value in a annotation</b>
*/
- Class<? extends ActionNameProvider> actionCommandProvider() default org.codelutin.jaxx.action.ActionNameProvider.class;
+ Class<? extends ActionNameProvider> actionCommandProvider() default org.nuiton.jaxx.action.ActionNameProvider.class;
/**
* @return la clef i18n du texte de l'action, si vide ignoré
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,79 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.action;
-
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-
-/**
- * Implementation of configuration's resolver for annotation {@link ToggleActionConfig}
- *
- * @author chemit
- */
-public class ToggleActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ToggleActionConfig, AbstractButton> {
-
- public ToggleActionConfigConfigurationResolver() {
- super(ToggleActionConfig.class, AbstractButton.class);
- }
-
- protected ToggleActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
- ToggleActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- //System.out.println("found action with name : " + anno.name());
- action.putValue(Action.NAME, _(anno.name()));
- }
- if (!anno.name2().isEmpty()) {
- //System.out.println("found action with name2 : " + anno.name2());
- action.putValue(Action.NAME + "2", _(anno.name2()));
- }
-
- if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- }
- if (!anno.shortDescription2().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION + "2", _(anno.shortDescription2()));
- }
-
- if (!anno.smallIcon().isEmpty()) {
- action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
- }
- if (!anno.smallIcon2().isEmpty()) {
- action.putValue(Action.SMALL_ICON + "2", org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon2()));
- }
-
- if (anno.mnemonic() != '\0') {
- action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
- } else if (component != null) {
- action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
- }
- if (anno.mnemonic2() != '\0') {
- action.putValue(Action.MNEMONIC_KEY + "2", anno.mnemonic2());
- }
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
-
-
- action.putValue("hideActionText", anno.hideActionText());
- action.putValue(Action.SELECTED_KEY, anno.selected());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,79 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.action;
+
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link ToggleActionConfig}
+ *
+ * @author chemit
+ */
+public class ToggleActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ToggleActionConfig, AbstractButton> {
+
+ public ToggleActionConfigConfigurationResolver() {
+ super(ToggleActionConfig.class, AbstractButton.class);
+ }
+
+ protected ToggleActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
+ ToggleActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ //System.out.println("found action with name : " + anno.name());
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ if (!anno.name2().isEmpty()) {
+ //System.out.println("found action with name2 : " + anno.name2());
+ action.putValue(Action.NAME + "2", _(anno.name2()));
+ }
+
+ if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ }
+ if (!anno.shortDescription2().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION + "2", _(anno.shortDescription2()));
+ }
+
+ if (!anno.smallIcon().isEmpty()) {
+ action.putValue(Action.SMALL_ICON, org.nuiton.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
+ }
+ if (!anno.smallIcon2().isEmpty()) {
+ action.putValue(Action.SMALL_ICON + "2", org.nuiton.jaxx.util.UIHelper.createImageIcon(anno.smallIcon2()));
+ }
+
+ if (anno.mnemonic() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
+ } else if (component != null) {
+ action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
+ }
+ if (anno.mnemonic2() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY + "2", anno.mnemonic2());
+ }
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+
+
+ action.putValue("hideActionText", anno.hideActionText());
+ action.putValue(Action.SELECTED_KEY, anno.selected());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/tab/TabContentConfig.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ##% */
-package org.codelutin.jaxx.tab;
+package org.nuiton.jaxx.tab;
import jaxx.runtime.swing.JAXXTab;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/tab/TabFactory.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* \#\#% */
-package org.codelutin.jaxx.tab;
+package org.nuiton.jaxx.tab;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.swing.JAXXTab;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/tab/TabModel.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ##% */
-package org.codelutin.jaxx.tab;
+package org.nuiton.jaxx.tab;
import java.io.Serializable;
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,53 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/** @author chemit */
-public abstract class AbstractUIAction<H extends DialogUIHandler<?, ?>> extends javax.swing.AbstractAction {
-
- protected static Log log = LogFactory.getLog(AbstractUIAction.class);
-
- protected transient DialogUI<? extends H> ui;
-
- private static final long serialVersionUID = 1L;
-
- protected AbstractUIAction(String name, javax.swing.Icon icon, DialogUI<? extends H> ui) {
- super(name, icon);
- this.ui = ui;
- }
-
- protected H getHandler() {
- checkInit();
- return ui.getHandler();
- }
-
- protected void setUi(DialogUI<? extends H> ui) {
- this.ui = ui;
- }
-
- public DialogUI<? extends H> getUi() {
- return ui;
- }
-
- protected void checkInit() throws IllegalStateException {
- /*if (ui == null) {
- throw new IllegalStateException("no handler, nor ui referenced in " + this);
- } */
- }
-
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,55 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @param <H> type of handler
+ * @author chemit */
+public abstract class AbstractUIAction<H extends DialogUIHandler<?, ?>> extends javax.swing.AbstractAction {
+
+ protected static Log log = LogFactory.getLog(AbstractUIAction.class);
+
+ protected transient DialogUI<? extends H> ui;
+
+ private static final long serialVersionUID = 1L;
+
+ protected AbstractUIAction(String name, javax.swing.Icon icon, DialogUI<? extends H> ui) {
+ super(name, icon);
+ this.ui = ui;
+ }
+
+ protected H getHandler() {
+ checkInit();
+ return ui.getHandler();
+ }
+
+ protected void setUi(DialogUI<? extends H> ui) {
+ this.ui = ui;
+ }
+
+ public DialogUI<? extends H> getUi() {
+ return ui;
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ /*if (ui == null) {
+ throw new IllegalStateException("no handler, nor ui referenced in " + this);
+ } */
+ }
+
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,129 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.ImageIcon;
-import javax.swing.JDialog;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.lang.reflect.Constructor;
-
-/**
- * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
- * <p/>
- * TODO : make jaxx authorized implementing interface for root tag :)
- *
- * @author chemit
- */
-public abstract class DialogUI<H extends DialogUIHandler> extends JDialog implements WindowListener {
-
- protected static Log log = LogFactory.getLog(DialogUI.class);
-
- public javax.swing.AbstractAction newAction(Class<?> actionClass, Object... params) {
- Constructor<?> constructor = null;
- for (Constructor<?> cons : actionClass.getConstructors()) {
- Class<?>[] prototype = cons.getParameterTypes();
- if (prototype.length > 0 && DialogUI.class.isAssignableFrom(prototype[0])) {
- // use this constructor
- constructor = cons;
- break;
- }
- }
- if (constructor == null) {
- throw new IllegalStateException("could not find a matching constructor for " + actionClass);
- }
-
- // wrap params
- Object[] parameters = new Object[1 + params.length];
- parameters[0] = this;
- System.arraycopy(params, 0, parameters, 1, params.length);
- try {
- AbstractAction action = (AbstractAction) constructor.newInstance(parameters);
- if (log.isInfoEnabled()) {
- log.info(action);
- }
- return action;
- } catch (Exception e) {
- throw new IllegalStateException("could not init the action " + actionClass + " for reason : " + e.getMessage());
- }
- }
-
- private H handler;
-
- public abstract AbstractButton getHelp();
-
- public abstract Object getObjectById(java.lang.String s);
-
- protected DialogUI() {
- UIHelper.setQuitAction(this);
- addWindowListener(this);
- //TODO will be handled by jaxx with javax.help...
- //getHelp().setAction(newAction(HelpAction.class));
- }
-
- public H getHandler() {
- return handler;
- }
-
- public void setHandler(H handler) {
- this.handler = handler;
- }
-
- protected ImageIcon createActionIcon(String name) {
- return UIHelper.createActionIcon(name);
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener l) {
- super.addWindowListener(l);
- if (log.isDebugEnabled()) {
- log.debug("after added (" + getWindowListeners().length + ") : " + l);
- }
- }
-
- @Override
- public synchronized void removeWindowListener(WindowListener l) {
- super.removeWindowListener(l);
- if (log.isDebugEnabled()) {
- log.debug("after removed (" + getWindowListeners().length + ") : " + l);
- }
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,137 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.lang.reflect.Constructor;
+
+/**
+ * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @param <H> type of handler
+ * @author chemit
+ */
+public abstract class DialogUI<H extends DialogUIHandler<?,?>> extends JDialog implements WindowListener {
+
+ protected static Log log = LogFactory.getLog(DialogUI.class);
+
+ public javax.swing.AbstractAction newAction(Class<?> actionClass, Object... params) {
+ Constructor<?> constructor = null;
+ for (Constructor<?> cons : actionClass.getConstructors()) {
+ Class<?>[] prototype = cons.getParameterTypes();
+ if (prototype.length > 0 && DialogUI.class.isAssignableFrom(prototype[0])) {
+ // use this constructor
+ constructor = cons;
+ break;
+ }
+ }
+ if (constructor == null) {
+ throw new IllegalStateException("could not find a matching constructor for " + actionClass);
+ }
+
+ // wrap params
+ Object[] parameters = new Object[1 + params.length];
+ parameters[0] = this;
+ System.arraycopy(params, 0, parameters, 1, params.length);
+ try {
+ AbstractAction action = (AbstractAction) constructor.newInstance(parameters);
+ if (log.isInfoEnabled()) {
+ log.info(action);
+ }
+ return action;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not init the action " + actionClass + " for reason : " + e.getMessage());
+ }
+ }
+
+ private H handler;
+
+ public abstract AbstractButton getHelp();
+
+ public abstract Object getObjectById(java.lang.String s);
+
+ protected DialogUI() {
+ UIHelper.setQuitAction(this);
+ addWindowListener(this);
+ //TODO will be handled by jaxx with javax.help...
+ //getHelp().setAction(newAction(HelpAction.class));
+ }
+
+ public H getHandler() {
+ return handler;
+ }
+
+ public void setHandler(H handler) {
+ this.handler = handler;
+ }
+
+ protected ImageIcon createActionIcon(String name) {
+ return UIHelper.createActionIcon(name);
+ }
+
+ @Override
+ public void windowOpened(WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ }
+
+ @Override
+ public void windowIconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowActivated(WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeactivated(WindowEvent e) {
+ }
+
+ @Override
+ public synchronized void addWindowListener(WindowListener l) {
+ super.addWindowListener(l);
+ if (log.isDebugEnabled()) {
+ log.debug("after added (" + getWindowListeners().length + ") : " + l);
+ }
+ }
+
+ @Override
+ public synchronized void removeWindowListener(WindowListener l) {
+ super.removeWindowListener(l);
+ if (log.isDebugEnabled()) {
+ log.debug("after removed (" + getWindowListeners().length + ") : " + l);
+ }
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,235 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import static org.codelutin.i18n.I18n._;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.ImageIcon;
-import java.lang.reflect.Constructor;
-
-/**
- * Definition of an ui, with his model, handler and ui class definitions.
- * <p/>
- * The class contains also a shared instace of concrete ui.
- *
- * @author chemit
- */
-public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
-
- static protected final Log log = LogFactory.getLog(DialogUIDef.class);
-
- public static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> DialogUIDef<M, U, H> newDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass, String showActionLibelle, String showActionTip, String uiTitle) {
- DialogUIDef<M, U, H> result;
- result = new DialogUIDef<M, U, H>(handlerClass, uiClass, modelClass, showActionLibelle, showActionTip, uiTitle);
- return result;
- }
-
- /**
- * model class
- */
- private final Class<M> modelClass;
-
- /**
- * handler class
- */
- private final Class<H> handlerClass;
-
- /**
- * abstract ui class
- */
- private final Class<U> uiClass;
-
- /**
- * concrete lookup ui class
- */
- private Class<? extends U> uiImplClass;
-
- /**
- * shared instance of ui
- */
- protected U uiInstance;
-
- /**
- * unique name of ui def
- */
- protected final String name;
-
- protected final String uiTitle;
- protected final String showActionLibelle;
- protected final String showActionTip;
-
- protected ImageIcon showUIActionIcon;
-
-
- private static final long serialVersionUID = 1L;
-
- private DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass,
- String showActionLibelle, String showActionTip, String uiTitle) {
- this.handlerClass = handlerClass;
- this.uiClass = uiClass;
- this.modelClass = modelClass;
- this.showActionLibelle = showActionLibelle;
- this.name = uiClass.getSimpleName().toLowerCase();
- this.showActionTip = showActionTip;
- this.uiTitle = uiTitle;
- }
-
- public Class<U> getUiClass() {
- return uiClass;
- }
-
- public Class<H> getHandlerClass() {
- return handlerClass;
- }
-
- public Class<M> getModelClass() {
- return modelClass;
- }
-
- public Class<? extends U> getUiImplClass() {
- return uiImplClass;
- }
-
- public String getUiTitle() {
- return _(uiTitle);
- }
-
- public String getShowActionLibelle() {
- return _(showActionLibelle);
- }
-
- public String getShowActionTip() {
- return _(showActionTip);
- }
-
- public ImageIcon getShowUIActionIcon() {
- if (showUIActionIcon == null) {
- showUIActionIcon = UIHelper.createActionIcon("show-" + name);
- }
- return showUIActionIcon;
- }
-
- @SuppressWarnings({"unchecked"})
- public void setUiImplClass(Class<?> uiImplClass) {
- this.uiImplClass = (Class<? extends U>) uiImplClass;
- }
-
- @Override
- public boolean equals(Object o) {
- return this == o || o instanceof DialogUIDef && uiClass.equals(((DialogUIDef) o).uiClass);
- }
-
- @Override
- public int hashCode() {
- return uiClass.hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(super.toString()).append('<');
- sb.append(printClass("handler", handlerClass, true));
- sb.append(printClass("model", modelClass, true));
- sb.append(printClass("ui", uiClass, true));
- sb.append(printClass("uiImpl", uiImplClass, false));
- return sb.toString();
- }
-
- protected U getUiInstance() {
- // no lazy instanciation, to control ui instanciation...
- /*if (uiInstance == null) {
- if (uiImplClass == null) {
- throw new IllegalStateException("no concrete ui impl found in " + this);
- }
- synchronized (this) {
- try {
- uiInstance = uiImplClass.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this,e);
- }
- }
- }*/
- return uiInstance;
- }
-
- protected void setUiInstance(U uiInstance) {
- this.uiInstance = uiInstance;
- }
-
- protected U newUI() {
- if (uiImplClass == null) {
- throw new IllegalStateException("no concrete ui impl found in " + this);
- }
- try {
- U result = uiImplClass.newInstance();
- log.info(result);
- return result;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected M newModel() {
- if (modelClass == null) {
- throw new IllegalStateException("no model impl found in " + this);
- }
- try {
- M model = modelClass.newInstance();
- log.info(model);
- return model;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected H newHandler(U ui, M model, Object... params) {
- if (handlerClass == null) {
- throw new IllegalStateException("no handler impl found in " + this);
- }
- try {
- Class[] prototype = getHandlerPrototype(params);
- Object[] parameters = getHandlerParameters(ui, model, params);
- H result = handlerClass.getConstructor(prototype).newInstance(parameters);
- log.info(result);
- return result;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected Object[] getHandlerParameters(U ui, M model, Object[] params) {
- Object[] result = new Object[2 + params.length];
- result[0] = ui;
- result[1] = model;
- System.arraycopy(params, 0, result, 2, params.length);
- return result;
- }
-
- protected Class[] getHandlerPrototype(Object[] params) {
- int length = params.length;
- for (Constructor<?> constructor : handlerClass.getConstructors()) {
- Class<?>[] prototype = constructor.getParameterTypes();
- if (prototype.length == 2 + length && prototype[0] == uiClass && prototype[1] == modelClass) {
- return prototype;
- }
- }
- throw new IllegalStateException("could not find a matching constructor in " + handlerClass);
- }
-
- protected String printClass(String s, Class<?> aClass, boolean notLast) {
- return s + ':' + (aClass == null ? null : aClass.getSimpleName()) + (notLast ? ", " : ">");
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,238 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import static org.nuiton.i18n.I18n._;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.ImageIcon;
+import java.lang.reflect.Constructor;
+
+/**
+ * Definition of an ui, with his model, handler and ui class definitions.
+ * <p/>
+ * The class contains also a shared instace of concrete ui.
+ *
+ * @param <M> type of model
+ * @param <U> type of ui
+ * @param <H> type of handler
+ * @author chemit
+ */
+public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
+
+ static protected final Log log = LogFactory.getLog(DialogUIDef.class);
+
+ public static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> DialogUIDef<M, U, H> newDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass, String showActionLibelle, String showActionTip, String uiTitle) {
+ DialogUIDef<M, U, H> result;
+ result = new DialogUIDef<M, U, H>(handlerClass, uiClass, modelClass, showActionLibelle, showActionTip, uiTitle);
+ return result;
+ }
+
+ /**
+ * model class
+ */
+ private final Class<M> modelClass;
+
+ /**
+ * handler class
+ */
+ private final Class<H> handlerClass;
+
+ /**
+ * abstract ui class
+ */
+ private final Class<U> uiClass;
+
+ /**
+ * concrete lookup ui class
+ */
+ private Class<? extends U> uiImplClass;
+
+ /**
+ * shared instance of ui
+ */
+ protected U uiInstance;
+
+ /**
+ * unique name of ui def
+ */
+ protected final String name;
+
+ protected final String uiTitle;
+ protected final String showActionLibelle;
+ protected final String showActionTip;
+
+ protected ImageIcon showUIActionIcon;
+
+
+ private static final long serialVersionUID = 1L;
+
+ private DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass,
+ String showActionLibelle, String showActionTip, String uiTitle) {
+ this.handlerClass = handlerClass;
+ this.uiClass = uiClass;
+ this.modelClass = modelClass;
+ this.showActionLibelle = showActionLibelle;
+ this.name = uiClass.getSimpleName().toLowerCase();
+ this.showActionTip = showActionTip;
+ this.uiTitle = uiTitle;
+ }
+
+ public Class<U> getUiClass() {
+ return uiClass;
+ }
+
+ public Class<H> getHandlerClass() {
+ return handlerClass;
+ }
+
+ public Class<M> getModelClass() {
+ return modelClass;
+ }
+
+ public Class<? extends U> getUiImplClass() {
+ return uiImplClass;
+ }
+
+ public String getUiTitle() {
+ return _(uiTitle);
+ }
+
+ public String getShowActionLibelle() {
+ return _(showActionLibelle);
+ }
+
+ public String getShowActionTip() {
+ return _(showActionTip);
+ }
+
+ public ImageIcon getShowUIActionIcon() {
+ if (showUIActionIcon == null) {
+ showUIActionIcon = UIHelper.createActionIcon("show-" + name);
+ }
+ return showUIActionIcon;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void setUiImplClass(Class<?> uiImplClass) {
+ this.uiImplClass = (Class<? extends U>) uiImplClass;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return this == o || o instanceof DialogUIDef<?,?,?> && uiClass.equals(((DialogUIDef<?,?,?>) o).uiClass);
+ }
+
+ @Override
+ public int hashCode() {
+ return uiClass.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(super.toString()).append('<');
+ sb.append(printClass("handler", handlerClass, true));
+ sb.append(printClass("model", modelClass, true));
+ sb.append(printClass("ui", uiClass, true));
+ sb.append(printClass("uiImpl", uiImplClass, false));
+ return sb.toString();
+ }
+
+ protected U getUiInstance() {
+ // no lazy instanciation, to control ui instanciation...
+ /*if (uiInstance == null) {
+ if (uiImplClass == null) {
+ throw new IllegalStateException("no concrete ui impl found in " + this);
+ }
+ synchronized (this) {
+ try {
+ uiInstance = uiImplClass.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this,e);
+ }
+ }
+ }*/
+ return uiInstance;
+ }
+
+ protected void setUiInstance(U uiInstance) {
+ this.uiInstance = uiInstance;
+ }
+
+ protected U newUI() {
+ if (uiImplClass == null) {
+ throw new IllegalStateException("no concrete ui impl found in " + this);
+ }
+ try {
+ U result = uiImplClass.newInstance();
+ log.info(result);
+ return result;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected M newModel() {
+ if (modelClass == null) {
+ throw new IllegalStateException("no model impl found in " + this);
+ }
+ try {
+ M model = modelClass.newInstance();
+ log.info(model);
+ return model;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected H newHandler(U ui, M model, Object... params) {
+ if (handlerClass == null) {
+ throw new IllegalStateException("no handler impl found in " + this);
+ }
+ try {
+ Class<?>[] prototype = getHandlerPrototype(params);
+ Object[] parameters = getHandlerParameters(ui, model, params);
+ H result = handlerClass.getConstructor(prototype).newInstance(parameters);
+ log.info(result);
+ return result;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected Object[] getHandlerParameters(U ui, M model, Object[] params) {
+ Object[] result = new Object[2 + params.length];
+ result[0] = ui;
+ result[1] = model;
+ System.arraycopy(params, 0, result, 2, params.length);
+ return result;
+ }
+
+ protected Class<?>[] getHandlerPrototype(Object[] params) {
+ int length = params.length;
+ for (Constructor<?> constructor : handlerClass.getConstructors()) {
+ Class<?>[] prototype = constructor.getParameterTypes();
+ if (prototype.length == 2 + length && prototype[0] == uiClass && prototype[1] == modelClass) {
+ return prototype;
+ }
+ }
+ throw new IllegalStateException("could not find a matching constructor in " + handlerClass);
+ }
+
+ protected String printClass(String s, Class<?> aClass, boolean notLast) {
+ return s + ':' + (aClass == null ? null : aClass.getSimpleName()) + (notLast ? ", " : ">");
+ }
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,70 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.awt.event.WindowListener;
-import java.beans.PropertyChangeListener;
-
-/**
- * DialogUI handler
- *
- * @author chemit
- */
-public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler>> implements PropertyChangeListener {
-
- protected static Log log = LogFactory.getLog(DialogUIHandler.class);
-
- /** ui handled */
- private U ui;
-
- /** model handled */
- private M model;
-
- protected DialogUIHandler(U ui, M model) {
- this.ui = ui;
- this.model = model;
- }
-
- public U getUi() {
- return ui;
- }
-
- public M getModel() {
- return model;
- }
-
- public void init() {
- if (model == null) {
- throw new IllegalStateException("no model was defined for " + this);
- }
- model.addPropertyChangeListener(this);
- }
-
- public void dispose() {
- model.dispose();
- for (WindowListener windowListener : getUi().getWindowListeners()) {
- getUi().removeWindowListener(windowListener);
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- dispose();
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,72 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.event.WindowListener;
+import java.beans.PropertyChangeListener;
+
+/**
+ * DialogUI handler
+ *
+ * @param <M> type of model
+ * @param <U> type of ui
+ * @author chemit
+ */
+public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler<?,?>>> implements PropertyChangeListener {
+
+ protected static Log log = LogFactory.getLog(DialogUIHandler.class);
+
+ /** ui handled */
+ private U ui;
+
+ /** model handled */
+ private M model;
+
+ protected DialogUIHandler(U ui, M model) {
+ this.ui = ui;
+ this.model = model;
+ }
+
+ public U getUi() {
+ return ui;
+ }
+
+ public M getModel() {
+ return model;
+ }
+
+ public void init() {
+ if (model == null) {
+ throw new IllegalStateException("no model was defined for " + this);
+ }
+ model.addPropertyChangeListener(this);
+ }
+
+ public void dispose() {
+ model.dispose();
+ for (WindowListener windowListener : getUi().getWindowListeners()) {
+ getUi().removeWindowListener(windowListener);
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ dispose();
+ }
+}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -12,7 +12,7 @@
* - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
-package org.codelutin.jaxx.util;
+package org.nuiton.jaxx.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,84 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-/**
- * A windowListenr for ui managed by {@link org.codelutin.jaxx.util.UIFactory}.
- * <p/>
- * To be used when all ui from factory are closed, via {@link #allWindowsClosed(java.awt.event.WindowEvent)} method.
- *
- * @author chemit
- */
-public abstract class FactoryWindowListener extends WindowAdapter {
-
- /**
- * method to be invoked when all ui registred in factory are really disposed.
- *
- * @param e event
- */
- public abstract void allWindowsClosed(WindowEvent e);
-
- /** underlying factory of ui */
- private UIFactory factory;
-
- /** flag to make sure {@link #allWindowsClosed(java.awt.event.WindowEvent)} is called only once. */
- private boolean wasClosed;
-
- @Override
- public void windowClosed(WindowEvent e) {
- if (UIFactory.log.isDebugEnabled()) {
- UIFactory.log.debug(this + " : " + e);
- }
- if (e.getWindow().isVisible()) {
- // only deal with real closed and none visible windows...
- return;
- }
- for (DialogUIDef def : factory.getDefs()) {
- DialogUI ui = def.uiInstance;
- if (ui != null && ui.isVisible()) {
- // at least one ui visible, do not close all
- return;
- }
- }
-
- if (wasClosed) {
- // make sure to process only once
- return;
- }
- if (UIFactory.log.isInfoEnabled()) {
- UIFactory.log.info("closing factory listener " + this);
- }
-
- synchronized (this) {
- try {
- allWindowsClosed(e);
- } finally {
- wasClosed = true;
- factory.removeFactoryWindowListener(this);
- }
- }
- }
-
- protected UIFactory getFactory() {
- return factory;
- }
-
- protected void setFactory(UIFactory factory) {
- this.factory = factory;
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,84 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+/**
+ * A windowListenr for ui managed by {@link org.nuiton.jaxx.util.UIFactory}.
+ * <p/>
+ * To be used when all ui from factory are closed, via {@link #allWindowsClosed(java.awt.event.WindowEvent)} method.
+ *
+ * @author chemit
+ */
+public abstract class FactoryWindowListener extends WindowAdapter {
+
+ /**
+ * method to be invoked when all ui registred in factory are really disposed.
+ *
+ * @param e event
+ */
+ public abstract void allWindowsClosed(WindowEvent e);
+
+ /** underlying factory of ui */
+ private UIFactory factory;
+
+ /** flag to make sure {@link #allWindowsClosed(java.awt.event.WindowEvent)} is called only once. */
+ private boolean wasClosed;
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ if (UIFactory.log.isDebugEnabled()) {
+ UIFactory.log.debug(this + " : " + e);
+ }
+ if (e.getWindow().isVisible()) {
+ // only deal with real closed and none visible windows...
+ return;
+ }
+ for (DialogUIDef<?,?,?> def : factory.getDefs()) {
+ DialogUI<?> ui = def.uiInstance;
+ if (ui != null && ui.isVisible()) {
+ // at least one ui visible, do not close all
+ return;
+ }
+ }
+
+ if (wasClosed) {
+ // make sure to process only once
+ return;
+ }
+ if (UIFactory.log.isInfoEnabled()) {
+ UIFactory.log.info("closing factory listener " + this);
+ }
+
+ synchronized (this) {
+ try {
+ allWindowsClosed(e);
+ } finally {
+ wasClosed = true;
+ factory.removeFactoryWindowListener(this);
+ }
+ }
+ }
+
+ protected UIFactory getFactory() {
+ return factory;
+ }
+
+ protected void setFactory(UIFactory factory) {
+ this.factory = factory;
+ }
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,29 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-/** @author chemit */
-public interface FormElement<U extends DialogUI> {
-
- String name();
-
- int ordinal();
-
- Object getValue(U ui);
-
- void setValue(U ui, String value);
-
- javax.swing.JLabel getLabel(U ui);
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,31 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+/**
+ * @param <U> type of dialog
+ * @author chemit */
+public interface FormElement<U extends DialogUI<?>> {
+
+ String name();
+
+ int ordinal();
+
+ Object getValue(U ui);
+
+ void setValue(U ui, String value);
+
+ javax.swing.JLabel getLabel(U ui);
+}
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,135 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends javax.swing.AbstractAction {
-
- protected static Log log = LogFactory.getLog(AbstractUIAction.class);
-
- protected transient DialogUI<?> ui;
-
- private static final long serialVersionUID = 1L;
-
- protected DialogUIDef<M, U, H> uiDef;
-
- protected transient UIFactory factory;
-
- protected String position;
-
- protected boolean undecorated = true;
-
- protected U initUI(ActionEvent e) {
- return getFactory().getUI(uiDef);
- }
-
- public ShowUIAction(DialogUI<?> ui, DialogUIDef<M, U, H> uiDef, UIFactory factory, boolean showText) {
- super(uiDef.getShowActionLibelle(), uiDef.getShowUIActionIcon());
- this.ui = ui;
- this.uiDef = uiDef;
- String name = (String) getValue(NAME);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
- putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
- if (!showText) {
- putValue(NAME, null);
- }
- putValue(SHORT_DESCRIPTION, uiDef.getShowActionTip());
- this.factory = factory;
- }
-
- public DialogUI<?> getUi() {
- return ui;
- }
-
- public DialogUIDef<M, U, H> getUiDef() {
- return uiDef;
- }
-
- public UIFactory getFactory() {
- return factory;
- }
-
- public void setUiDef(DialogUIDef<M, U, H> uiDef) {
- this.uiDef = uiDef;
- }
-
- public void setPosition(String position) {
- this.position = position;
- }
-
- public void setUndecorated(boolean undecorated) {
- this.undecorated = undecorated;
- }
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- checkInit();
- U ui = initUI(e);
- ui.setTitle(uiDef.getUiTitle());
- log.info(ui.getTitle());
- //TODO ui.setUndecorated(undecorated);
- setPosition(this.getUi(), ui, position);
-
- ui.setVisible(true);
- }
-
- protected void setPosition(javax.swing.JDialog parentUI, javax.swing.JDialog ui, String position) {
- if (position == null || parentUI == null) {
- return;
- }
- Point parentLocation = parentUI.getLocationOnScreen();
- Dimension parentSize = parentUI.getSize();
-
- if (position.equals("bottom-left")) {
- int top = (int) (parentLocation.getY() + parentSize.getHeight());
- int left = (int) (parentLocation.getX());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals("top-left")) {
- int top = (int) (parentLocation.getY());
- int left = (int) (parentLocation.getX());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals("top-right")) {
- int top = (int) (parentLocation.getY());
- int left = (int) (parentLocation.getX() + parentSize.getWidth());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals(("center"))) {
- //TODO
- }
- }
-
- protected void checkInit() throws IllegalStateException {
- if (factory == null) {
- throw new IllegalStateException("no factory found in " + this);
- }
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,140 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+
+/**
+ * @param <M> type of model
+ * @param <U> type of ui
+ * @param <H> type of handler
+ * @author chemit */
+public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends javax.swing.AbstractAction {
+
+ protected static Log log = LogFactory.getLog(AbstractUIAction.class);
+
+ protected transient DialogUI<?> ui;
+
+ private static final long serialVersionUID = 1L;
+
+ protected DialogUIDef<M, U, H> uiDef;
+
+ protected transient UIFactory factory;
+
+ protected String position;
+
+ protected boolean undecorated = true;
+
+ protected U initUI(ActionEvent e) {
+ return getFactory().getUI(uiDef);
+ }
+
+ public ShowUIAction(DialogUI<?> ui, DialogUIDef<M, U, H> uiDef, UIFactory factory, boolean showText) {
+ super(uiDef.getShowActionLibelle(), uiDef.getShowUIActionIcon());
+ this.ui = ui;
+ this.uiDef = uiDef;
+ String name = (String) getValue(NAME);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
+ putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
+ if (!showText) {
+ putValue(NAME, null);
+ }
+ putValue(SHORT_DESCRIPTION, uiDef.getShowActionTip());
+ this.factory = factory;
+ }
+
+ public DialogUI<?> getUi() {
+ return ui;
+ }
+
+ public DialogUIDef<M, U, H> getUiDef() {
+ return uiDef;
+ }
+
+ public UIFactory getFactory() {
+ return factory;
+ }
+
+ public void setUiDef(DialogUIDef<M, U, H> uiDef) {
+ this.uiDef = uiDef;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public void setUndecorated(boolean undecorated) {
+ this.undecorated = undecorated;
+ }
+
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ checkInit();
+ U gui = initUI(e);
+ gui.setTitle(uiDef.getUiTitle());
+ log.info(gui.getTitle());
+ //TODO ui.setUndecorated(undecorated);
+ setPosition(this.getUi(), gui, position);
+
+ gui.setVisible(true);
+ }
+
+ protected void setPosition(javax.swing.JDialog parentUI, javax.swing.JDialog ui, String position) {
+ if (position == null || parentUI == null) {
+ return;
+ }
+ Point parentLocation = parentUI.getLocationOnScreen();
+ Dimension parentSize = parentUI.getSize();
+
+ if (position.equals("bottom-left")) {
+ int top = (int) (parentLocation.getY() + parentSize.getHeight());
+ int left = (int) (parentLocation.getX());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals("top-left")) {
+ int top = (int) (parentLocation.getY());
+ int left = (int) (parentLocation.getX());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals("top-right")) {
+ int top = (int) (parentLocation.getY());
+ int left = (int) (parentLocation.getX() + parentSize.getWidth());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals(("center"))) {
+ //TODO
+ }
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ if (factory == null) {
+ throw new IllegalStateException("no factory found in " + this);
+ }
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,184 +0,0 @@
-/**
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.StringUtil;
-
-import javax.swing.event.EventListenerList;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ServiceLoader;
-
-/**
- * Factory for UI, using a cache and a provider to find ui implementations.
- *
- * @author chemit
- */
-public class UIFactory {
-
- static protected final Log log = LogFactory.getLog(UIFactory.class);
-
- private final String applicationName;
-
- private final DialogUIDef[] defs;
-
- private final EventListenerList listeners;
-
- public UIFactory(String applicationName, DialogUIDef[] defs, FactoryWindowListener... listeners) {
- this.applicationName = applicationName;
- this.listeners = new EventListenerList();
- for (FactoryWindowListener listener : listeners) {
- listener.setFactory(this);
- addFactoryWindowListener(listener);
- }
- this.defs = defs;
- long t0 = System.nanoTime();
- if (log.isDebugEnabled()) {
- log.debug("start at " + new java.util.Date());
- }
- try {
- init();
- } catch (Exception e) {
- log.error(e);
- throw new RuntimeException(e);
- } finally {
- if (log.isDebugEnabled()) {
- log.info("end in " + StringUtil.convertTime(t0, System.nanoTime()));
- }
- }
- }
-
- public void addFactoryWindowListener(FactoryWindowListener l) {
- listeners.add(FactoryWindowListener.class, l);
- if (log.isDebugEnabled()) {
- log.debug("after added (" + listeners.getListenerCount() + ") : " + l);
- }
- }
-
- public void removeFactoryWindowListener(FactoryWindowListener l) {
- listeners.remove(FactoryWindowListener.class, l);
- for (DialogUIDef def : getDefs()) {
- if (def.uiInstance != null) {
- def.uiInstance.removeWindowListener(l);
- }
- }
- if (log.isDebugEnabled()) {
- log.debug(" after removed (" + listeners.getListenerCount() + ") : " + l);
- }
- if (listeners.getListenerCount(FactoryWindowListener.class) == 0) {
- // close for real factory
- close();
- }
- }
-
- public void close() {
- log.info(this + " at " + new java.util.Date());
- for (DialogUIDef<?, ?, ?> def : defs) {
- DialogUI<?> ui = def.uiInstance;
- if (ui != null) {
- ui.getHandler().dispose();
- def.uiInstance = null;
- }
- }
- if (listeners.getListenerCount(FactoryWindowListener.class) > 0) {
- log.warn("some listeners where not properly removed, force deletion...");
- for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
- removeFactoryWindowListener(listener);
- }
- }
-
- }
-
- protected void init() {
-
- UIProvider[] providers = detectProviders();
-
- for (DialogUIDef<?, ?, ?> def : defs) {
- initDef(providers, def);
- if (def.getUiImplClass() == null) {
- throw new IllegalStateException("could not find implementation for ui def " + def);
- }
- }
- }
-
- protected void initDef(UIProvider[] providers, DialogUIDef<?, ?, ?> def) {
- for (UIProvider provider : providers) {
- Class<?> uiImplClass = provider.findUIImplementation(def);
- if (uiImplClass != null) {
- if (log.isDebugEnabled()) {
- log.debug("init done for " + def);
- }
- // ui implementation was found
- break;
- }
- }
- }
-
- protected UIProvider[] detectProviders() {
- long t0 = System.nanoTime();
- List<UIProvider> providers = new ArrayList<UIProvider>();
- for (UIProvider provider : ServiceLoader.load(UIProvider.class)) {
- if (applicationName.equals(provider.getApplicationName())) {
- if (log.isDebugEnabled()) {
- log.debug("provider detected [" + provider + ']');
- }
- providers.add(provider);
- }
- }
- log.info("found " + providers.size() + " ui provider(s) in " + StringUtil.convertTime(t0, System.nanoTime()) + " : " + providers);
- return providers.toArray(new UIProvider[providers.size()]);
- }
-
- protected DialogUIDef[] getDefs() {
- return defs;
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- close();
- }
-
- public <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
- U ui = uiType.uiInstance;
- if (ui == null) {
- try {
- ui = uiType.newUI();
- M model = uiType.newModel();
- H handler = uiType.newHandler(ui, model, params);
- registerUI(uiType, ui, handler);
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui handler " + uiType + " for reason : " + e.getMessage(), e);
- }
- }
- return ui;
- }
-
- protected <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> void registerUI(DialogUIDef<M, U, H> uiType, U ui, H handler) {
- ui.setHandler(handler);
- handler.init();
- uiType.setUiInstance(ui);
- for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
- if (log.isDebugEnabled()) {
- log.debug("----- addFactoryWindowListener " + listener + " to " + ui);
- }
- ui.addWindowListener(listener);
- }
- }
-
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,184 @@
+/**
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.StringUtil;
+
+import javax.swing.event.EventListenerList;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ServiceLoader;
+
+/**
+ * Factory for UI, using a cache and a provider to find ui implementations.
+ *
+ * @author chemit
+ */
+public class UIFactory {
+
+ static protected final Log log = LogFactory.getLog(UIFactory.class);
+
+ private final String applicationName;
+
+ private final DialogUIDef<?,?,?>[] defs;
+
+ private final EventListenerList listeners;
+
+ public UIFactory(String applicationName, DialogUIDef<?,?,?>[] defs, FactoryWindowListener... listeners) {
+ this.applicationName = applicationName;
+ this.listeners = new EventListenerList();
+ for (FactoryWindowListener listener : listeners) {
+ listener.setFactory(this);
+ addFactoryWindowListener(listener);
+ }
+ this.defs = defs;
+ long t0 = System.nanoTime();
+ if (log.isDebugEnabled()) {
+ log.debug("start at " + new java.util.Date());
+ }
+ try {
+ init();
+ } catch (Exception e) {
+ log.error(e);
+ throw new RuntimeException(e);
+ } finally {
+ if (log.isDebugEnabled()) {
+ log.info("end in " + StringUtil.convertTime(t0, System.nanoTime()));
+ }
+ }
+ }
+
+ public void addFactoryWindowListener(FactoryWindowListener l) {
+ listeners.add(FactoryWindowListener.class, l);
+ if (log.isDebugEnabled()) {
+ log.debug("after added (" + listeners.getListenerCount() + ") : " + l);
+ }
+ }
+
+ public void removeFactoryWindowListener(FactoryWindowListener l) {
+ listeners.remove(FactoryWindowListener.class, l);
+ for (DialogUIDef<?,?,?> def : getDefs()) {
+ if (def.uiInstance != null) {
+ def.uiInstance.removeWindowListener(l);
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(" after removed (" + listeners.getListenerCount() + ") : " + l);
+ }
+ if (listeners.getListenerCount(FactoryWindowListener.class) == 0) {
+ // close for real factory
+ close();
+ }
+ }
+
+ public void close() {
+ log.info(this + " at " + new java.util.Date());
+ for (DialogUIDef<?, ?, ?> def : defs) {
+ DialogUI<?> ui = def.uiInstance;
+ if (ui != null) {
+ ui.getHandler().dispose();
+ def.uiInstance = null;
+ }
+ }
+ if (listeners.getListenerCount(FactoryWindowListener.class) > 0) {
+ log.warn("some listeners where not properly removed, force deletion...");
+ for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
+ removeFactoryWindowListener(listener);
+ }
+ }
+
+ }
+
+ protected void init() {
+
+ UIProvider[] providers = detectProviders();
+
+ for (DialogUIDef<?, ?, ?> def : defs) {
+ initDef(providers, def);
+ if (def.getUiImplClass() == null) {
+ throw new IllegalStateException("could not find implementation for ui def " + def);
+ }
+ }
+ }
+
+ protected void initDef(UIProvider[] providers, DialogUIDef<?, ?, ?> def) {
+ for (UIProvider provider : providers) {
+ Class<?> uiImplClass = provider.findUIImplementation(def);
+ if (uiImplClass != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("init done for " + def);
+ }
+ // ui implementation was found
+ break;
+ }
+ }
+ }
+
+ protected UIProvider[] detectProviders() {
+ long t0 = System.nanoTime();
+ List<UIProvider> providers = new ArrayList<UIProvider>();
+ for (UIProvider provider : ServiceLoader.load(UIProvider.class)) {
+ if (applicationName.equals(provider.getApplicationName())) {
+ if (log.isDebugEnabled()) {
+ log.debug("provider detected [" + provider + ']');
+ }
+ providers.add(provider);
+ }
+ }
+ log.info("found " + providers.size() + " ui provider(s) in " + StringUtil.convertTime(t0, System.nanoTime()) + " : " + providers);
+ return providers.toArray(new UIProvider[providers.size()]);
+ }
+
+ protected DialogUIDef<?,?,?>[] getDefs() {
+ return defs;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ close();
+ }
+
+ public <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
+ U ui = uiType.uiInstance;
+ if (ui == null) {
+ try {
+ ui = uiType.newUI();
+ M model = uiType.newModel();
+ H handler = uiType.newHandler(ui, model, params);
+ registerUI(uiType, ui, handler);
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui handler " + uiType + " for reason : " + e.getMessage(), e);
+ }
+ }
+ return ui;
+ }
+
+ protected <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> void registerUI(DialogUIDef<M, U, H> uiType, U ui, H handler) {
+ ui.setHandler(handler);
+ handler.init();
+ uiType.setUiInstance(ui);
+ for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
+ if (log.isDebugEnabled()) {
+ log.debug("----- addFactoryWindowListener " + listener + " to " + ui);
+ }
+ ui.addWindowListener(listener);
+ }
+ }
+
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,70 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-* ##% */
-package org.codelutin.jaxx.util;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JRootPane;
-import javax.swing.KeyStroke;
-import java.awt.event.ActionEvent;
-
-/**
- * Ui helper class.
- *
- * @author tony
- */
-public class UIHelper {
-
- public static ImageIcon createImageIcon(String path) {
- java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path);
- if (imgURL != null) {
- return new ImageIcon(imgURL);
- } else {
- throw new IllegalArgumentException("could not find icon " + path);
- }
- }
-
- /**
- * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key.
- *
- * @param ui ui
- */
- public static void setQuitAction(final JDialog ui) {
- JRootPane rootPane = ui.getRootPane();
-
- Action quitAction = new AbstractAction("quit") {
- private static final long serialVersionUID = -869095664995763057L;
-
- public void actionPerformed(ActionEvent e) {
- ui.dispose();
- }
- };
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
- rootPane.getActionMap().put("quit", quitAction);
- ui.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
- }
-
- public static ImageIcon createActionIcon(String name) {
- return createImageIcon("action-" + name + ".png");
- }
-
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,71 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* ##% */
+package org.nuiton.jaxx.util;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import java.awt.event.ActionEvent;
+
+/**
+ * Ui helper class.
+ *
+ * @author tony
+ */
+public class UIHelper {
+
+ public static ImageIcon createImageIcon(String path) {
+ java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path);
+ if (imgURL != null) {
+ return new ImageIcon(imgURL);
+ } else {
+ throw new IllegalArgumentException("could not find icon " + path);
+ }
+ }
+
+ /**
+ * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key.
+ *
+ * @param ui ui
+ */
+ public static void setQuitAction(final JDialog ui) {
+ JRootPane rootPane = ui.getRootPane();
+
+ Action quitAction = new AbstractAction("quit") {
+ private static final long serialVersionUID = -869095664995763057L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ui.dispose();
+ }
+ };
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
+ rootPane.getActionMap().put("quit", quitAction);
+ ui.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ }
+
+ public static ImageIcon createActionIcon(String name) {
+ return createImageIcon("action-" + name + ".png");
+ }
+
+}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -12,7 +12,7 @@
* - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
-package org.codelutin.jaxx.util;
+package org.nuiton.jaxx.util;
/** @author chemit */
public abstract class UIProvider {
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,43 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class CancelAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.cancel");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.cancel.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
-
- }
-
- public void actionPerformed(ActionEvent e) {
- getUi().dispose();
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,43 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util.config;
+
+import org.nuiton.jaxx.util.AbstractUIAction;
+import org.nuiton.jaxx.util.DialogUI;
+import org.nuiton.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class CancelAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
+ if (showLabel) {
+ String text = org.nuiton.i18n.I18n._("lutinui.config.cancel");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.cancel.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getUi().dispose();
+ }
+}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -12,9 +12,9 @@
* - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
-package org.codelutin.jaxx.util.config;
+package org.nuiton.jaxx.util.config;
-import org.codelutin.jaxx.util.DialogUI;
+import org.nuiton.jaxx.util.DialogUI;
import javax.swing.AbstractButton;
import javax.swing.JCheckBox;
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,156 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.DialogUIHandler;
-import org.codelutin.util.ConverterUtil;
-import org.codelutin.util.config.Config;
-import org.codelutin.util.config.Property;
-
-import javax.swing.JComponent;
-import java.awt.Color;
-import java.beans.PropertyChangeEvent;
-import java.util.EnumMap;
-import java.util.EnumSet;
-
-/**
- * DialogUI handler
- *
- * @author chemit
- */
-public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E, ?>, U extends DialogConfigUI<E, ?>> extends DialogUIHandler<M, U> {
-
- protected DialogConfigUIHandler(U ui, M model) {
- super(ui, model);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
-
- if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI();
- // revalidate form
- doCheckAll();
- return;
- }
-
- if (DialogConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean modified = newValue != null && newValue;
- getUi().getReset().setEnabled(modified);
- getUi().getOk().setEnabled(modified && getModel().isConfigValid());
- return;
- }
-
- if (DialogConfigUIModel.UNVALID_PROPERTY_CHANGED.equals(action)) {
- updateUI();
- return;
- }
-
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
-
- public void doCheck(E key) {
- Object uiValue = getUi().getElementValue(key);
- DialogConfigUIModel<E, ?> model = getModel();
- Object currentValue = model.getCurrent().getProperty(key);
- if (currentValue == null) {
- currentValue = "";
- } else {
- currentValue = String.valueOf(currentValue);
- }
-
- model.validateProperty(key, uiValue);
- model.changeModifiedState(key, uiValue, currentValue);
- }
-
- public void doCheckAll() {
- DialogConfigUIModel<E, ?> model = getModel();
- EnumSet<E> unvalids = EnumSet.noneOf(model.klass);
- for (E e : model.getCheckedKeysSet()) {
- Object uiValue = getUi().getElementValue(e);
- if (!model.isValid(e, uiValue)) {
- unvalids.add(e);
- }
- }
- model.setUnvalids(unvalids);
- unvalids.clear();
- }
-
- protected boolean prepareSave() {
- DialogConfigUI<E, ?> ui = getUi();
- DialogConfigUIModel<E, ?> model = getModel();
-
- Config<E> current = model.getCurrent();
-
- if (!model.isConfigValid()) {
- log.warn("do not save a unvalid config : " + model.getUnvalids());
- return false;
- }
-
- if (!model.isModified()) {
- log.warn("nothing to save");
- return false;
- }
- EnumSet<E> toTreate = model.getCheckedKeysSet();
- // transfert checkable values from ui to model
- for (E key : model.getModifieds()) {
- if (!toTreate.contains(key)) {
- continue;
- }
- Object value = ui.getElementValue(key);
- Class<?> type = ((Property) key).getType();
- Object newValue = ConverterUtil.convert(type, value);
- current.setProperty(key, newValue);
- }
-
- return true;
- }
-
- protected void populateUI() {
- U ui = getUi();
- EnumMap<E, Object> map = getModel().getCurrent().getProperties();
- for (E e : getModel().getCheckedKeysSet()) {
- Object value = map.get(e);
- populateUI(ui, e, value);
- }
- }
-
- protected void populateUI(U ui, E key, Object value) {
- ui.setElementValue(key, value);
- }
-
- protected void updateUI() {
- EnumSet<E> unvalids = getModel().getUnvalids();
- for (E key : unvalids) {
- setLabelColor(key, false);
- }
- for (E key : EnumSet.complementOf(unvalids)) {
- setLabelColor(key, true);
- }
- }
-
- protected void setLabelColor(E key, boolean valid) {
- JComponent component = getUi().getElementLabel(key);
- if (component != null && component.isVisible()) {
- component.setForeground(valid ? Color.black : Color.red);
- }
- }
-
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,156 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util.config;
+
+import org.nuiton.jaxx.util.DialogUIHandler;
+import org.nuiton.util.ConverterUtil;
+import org.nuiton.util.config.Config;
+import org.nuiton.util.config.Property;
+
+import javax.swing.JComponent;
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.util.EnumMap;
+import java.util.EnumSet;
+
+/**
+ * DialogUI handler
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E, ?>, U extends DialogConfigUI<E, ?>> extends DialogUIHandler<M, U> {
+
+ protected DialogConfigUIHandler(U ui, M model) {
+ super(ui, model);
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+
+ if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ // update ui with model values,
+ populateUI();
+ // revalidate form
+ doCheckAll();
+ return;
+ }
+
+ if (DialogConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean modified = newValue != null && newValue;
+ getUi().getReset().setEnabled(modified);
+ getUi().getOk().setEnabled(modified && getModel().isConfigValid());
+ return;
+ }
+
+ if (DialogConfigUIModel.UNVALID_PROPERTY_CHANGED.equals(action)) {
+ updateUI();
+ return;
+ }
+
+ throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
+ }
+
+ public void doCheck(E key) {
+ Object uiValue = getUi().getElementValue(key);
+ DialogConfigUIModel<E, ?> model = getModel();
+ Object currentValue = model.getCurrent().getProperty(key);
+ if (currentValue == null) {
+ currentValue = "";
+ } else {
+ currentValue = String.valueOf(currentValue);
+ }
+
+ model.validateProperty(key, uiValue);
+ model.changeModifiedState(key, uiValue, currentValue);
+ }
+
+ public void doCheckAll() {
+ DialogConfigUIModel<E, ?> model = getModel();
+ EnumSet<E> unvalids = EnumSet.noneOf(model.klass);
+ for (E e : model.getCheckedKeysSet()) {
+ Object uiValue = getUi().getElementValue(e);
+ if (!model.isValid(e, uiValue)) {
+ unvalids.add(e);
+ }
+ }
+ model.setUnvalids(unvalids);
+ unvalids.clear();
+ }
+
+ protected boolean prepareSave() {
+ DialogConfigUI<E, ?> ui = getUi();
+ DialogConfigUIModel<E, ?> model = getModel();
+
+ Config<E> current = model.getCurrent();
+
+ if (!model.isConfigValid()) {
+ log.warn("do not save a unvalid config : " + model.getUnvalids());
+ return false;
+ }
+
+ if (!model.isModified()) {
+ log.warn("nothing to save");
+ return false;
+ }
+ EnumSet<E> toTreate = model.getCheckedKeysSet();
+ // transfert checkable values from ui to model
+ for (E key : model.getModifieds()) {
+ if (!toTreate.contains(key)) {
+ continue;
+ }
+ Object value = ui.getElementValue(key);
+ Class<?> type = ((Property) key).getType();
+ Object newValue = ConverterUtil.convert(type, value);
+ current.setProperty(key, newValue);
+ }
+
+ return true;
+ }
+
+ protected void populateUI() {
+ U ui = getUi();
+ EnumMap<E, Object> map = getModel().getCurrent().getProperties();
+ for (E e : getModel().getCheckedKeysSet()) {
+ Object value = map.get(e);
+ populateUI(ui, e, value);
+ }
+ }
+
+ protected void populateUI(U ui, E key, Object value) {
+ ui.setElementValue(key, value);
+ }
+
+ protected void updateUI() {
+ EnumSet<E> unvalids = getModel().getUnvalids();
+ for (E key : unvalids) {
+ setLabelColor(key, false);
+ }
+ for (E key : EnumSet.complementOf(unvalids)) {
+ setLabelColor(key, true);
+ }
+ }
+
+ protected void setLabelColor(E key, boolean valid) {
+ JComponent component = getUi().getElementLabel(key);
+ if (component != null && component.isVisible()) {
+ component.setForeground(valid ? Color.black : Color.red);
+ }
+ }
+
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,220 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.DialogUIModel;
-import org.codelutin.util.config.Config;
-
-import java.util.EnumSet;
-
-/**
- * Abstract config ui model.
- *
- * @author chemit
- */
-public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
-
- public static final String CONFIG_PROPERTY_CHANGED = "config";
- public static final String MODIFIED_PROPERTY_CHANGED = "modify";
- public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
-
- /** @return a empty config */
- protected abstract C newConfig();
-
- /**
- * @param key property key
- * @param value value to validate
- * @return <code>true</code> if given value is valid for property, <code>false>/code> otherwise
- */
- protected abstract boolean isValid(E key, Object value);
-
- /**
- * object used to init model and save model, this is an external object.
- * <p/>
- * The object must have bean read-write properties for each value of E
- */
- protected Object src;
-
- /** current config used in model */
- protected C current;
-
- /** set of modified properties */
- protected EnumSet<E> modifieds;
-
- /** set of unvalid properties */
- protected EnumSet<E> unvalids;
-
- /** enum class */
- protected Class<E> klass;
-
- /** set of key not to check */
- protected EnumSet<E> uncheckedKeys;
-
- /** set of all keys checkable */
- protected EnumSet<E> checkedKeysSet;
-
- protected DialogConfigUIModel(Class<E> klass) {
- this.klass = klass;
- this.current = newConfig();
- this.modifieds = EnumSet.noneOf(klass);
- this.unvalids = EnumSet.noneOf(klass);
- }
-
- public EnumSet<E> getCheckedKeysSet() {
- if (checkedKeysSet == null) {
- if (uncheckedKeys != null) {
- checkedKeysSet = EnumSet.complementOf(uncheckedKeys);
- } else {
- checkedKeysSet = EnumSet.allOf(klass);
- }
- }
- return checkedKeysSet;
- }
-
- public Object getSrc() {
- return src;
- }
-
- public C getCurrent() {
- return current;
- }
-
- public EnumSet<E> getUnivserse() {
- return getCurrent().getUniverse();
- }
-
- public EnumSet<E> getModifieds() {
- return modifieds;
- }
-
- public EnumSet<E> getUnvalids() {
- return unvalids;
- }
-
- public boolean isModified() {
- return !modifieds.isEmpty();
- }
-
- public boolean isConfigValid() {
- return unvalids.isEmpty();
- }
-
- public void populate(Object src) {
- this.src = src;
- this.current = newConfig();
- if (src != null) {
- this.current.copyFrom(src);
- }
- this.modifieds.clear();
- this.unvalids.clear();
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
- }
-
- public void reset() {
- populate(src);
- }
-
- public void setModified(boolean modified) {
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void setUnvalid(boolean unvalid) {
- firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
- }
-
- public void addModified(E key) {
- if (!modifieds.contains(key)) {
- modifieds.add(key);
- log.debug(key);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(E key) {
-
- if (modifieds.contains(key)) {
- modifieds.remove(key);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(EnumSet<E> keys) {
- for (E key : keys) {
- if (modifieds.contains(key)) {
- modifieds.remove(key);
- }
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void setUnvalids(EnumSet<E> keys) {
- for (E key : keys) {
- if (!unvalids.contains(key)) {
- unvalids.add(key);
- }
- }
- for (E key : EnumSet.complementOf(keys)) {
- if (unvalids.contains(key)) {
- unvalids.remove(key);
- }
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
-
- public void addUnvalid(E key) {
- if (!unvalids.contains(key)) {
- unvalids.add(key);
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
- public void removeUnvalid(E key) {
- if (unvalids.contains(key)) {
- unvalids.remove(key);
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
- public void save() {
- current.copyTo(src, modifieds);
- modifieds.clear();
- // redisplay config
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
- }
-
- public void changeModifiedState(E key, Object uiValue, Object currentValue) {
- if (uiValue!=null && uiValue.equals(currentValue)) {
- removeModified(key);
- } else {
- addModified(key);
- }
- }
-
- public void clear(E key) {
- log.info(key);
- modifieds.remove(key);
- unvalids.remove(key);
- }
-
- protected void validateProperty(E key, Object uiValue) {
- if (isValid(key, uiValue)) {
- removeUnvalid(key);
- } else {
- addUnvalid(key);
- }
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,220 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util.config;
+
+import org.nuiton.jaxx.util.DialogUIModel;
+import org.nuiton.util.config.Config;
+
+import java.util.EnumSet;
+
+/**
+ * Abstract config ui model.
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
+
+ public static final String CONFIG_PROPERTY_CHANGED = "config";
+ public static final String MODIFIED_PROPERTY_CHANGED = "modify";
+ public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
+
+ /** @return a empty config */
+ protected abstract C newConfig();
+
+ /**
+ * @param key property key
+ * @param value value to validate
+ * @return <code>true</code> if given value is valid for property, <code>false>/code> otherwise
+ */
+ protected abstract boolean isValid(E key, Object value);
+
+ /**
+ * object used to init model and save model, this is an external object.
+ * <p/>
+ * The object must have bean read-write properties for each value of E
+ */
+ protected Object src;
+
+ /** current config used in model */
+ protected C current;
+
+ /** set of modified properties */
+ protected EnumSet<E> modifieds;
+
+ /** set of unvalid properties */
+ protected EnumSet<E> unvalids;
+
+ /** enum class */
+ protected Class<E> klass;
+
+ /** set of key not to check */
+ protected EnumSet<E> uncheckedKeys;
+
+ /** set of all keys checkable */
+ protected EnumSet<E> checkedKeysSet;
+
+ protected DialogConfigUIModel(Class<E> klass) {
+ this.klass = klass;
+ this.current = newConfig();
+ this.modifieds = EnumSet.noneOf(klass);
+ this.unvalids = EnumSet.noneOf(klass);
+ }
+
+ public EnumSet<E> getCheckedKeysSet() {
+ if (checkedKeysSet == null) {
+ if (uncheckedKeys != null) {
+ checkedKeysSet = EnumSet.complementOf(uncheckedKeys);
+ } else {
+ checkedKeysSet = EnumSet.allOf(klass);
+ }
+ }
+ return checkedKeysSet;
+ }
+
+ public Object getSrc() {
+ return src;
+ }
+
+ public C getCurrent() {
+ return current;
+ }
+
+ public EnumSet<E> getUnivserse() {
+ return getCurrent().getUniverse();
+ }
+
+ public EnumSet<E> getModifieds() {
+ return modifieds;
+ }
+
+ public EnumSet<E> getUnvalids() {
+ return unvalids;
+ }
+
+ public boolean isModified() {
+ return !modifieds.isEmpty();
+ }
+
+ public boolean isConfigValid() {
+ return unvalids.isEmpty();
+ }
+
+ public void populate(Object src) {
+ this.src = src;
+ this.current = newConfig();
+ if (src != null) {
+ this.current.copyFrom(src);
+ }
+ this.modifieds.clear();
+ this.unvalids.clear();
+ setModified(false);
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void reset() {
+ populate(src);
+ }
+
+ public void setModified(boolean modified) {
+ firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
+ }
+
+ public void setUnvalid(boolean unvalid) {
+ firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
+ }
+
+ public void addModified(E key) {
+ if (!modifieds.contains(key)) {
+ modifieds.add(key);
+ log.debug(key);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(E key) {
+
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(EnumSet<E> keys) {
+ for (E key : keys) {
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
+ }
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void setUnvalids(EnumSet<E> keys) {
+ for (E key : keys) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
+ }
+ }
+ for (E key : EnumSet.complementOf(keys)) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
+ }
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+
+ public void addUnvalid(E key) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+ public void removeUnvalid(E key) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+ public void save() {
+ current.copyTo(src, modifieds);
+ modifieds.clear();
+ // redisplay config
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void changeModifiedState(E key, Object uiValue, Object currentValue) {
+ if (uiValue!=null && uiValue.equals(currentValue)) {
+ removeModified(key);
+ } else {
+ addModified(key);
+ }
+ }
+
+ public void clear(E key) {
+ log.info(key);
+ modifieds.remove(key);
+ unvalids.remove(key);
+ }
+
+ protected void validateProperty(E key, Object uiValue) {
+ if (isValid(key, uiValue)) {
+ removeUnvalid(key);
+ } else {
+ addUnvalid(key);
+ }
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,43 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class ResetAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.reset");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.reset.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
-
- }
-
- public void actionPerformed(ActionEvent e) {
- getHandler().getModel().reset();
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,43 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util.config;
+
+import org.nuiton.jaxx.util.AbstractUIAction;
+import org.nuiton.jaxx.util.DialogUI;
+import org.nuiton.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ResetAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
+ if (showLabel) {
+ String text = org.nuiton.i18n.I18n._("lutinui.config.reset");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.reset.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getHandler().getModel().reset();
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,50 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class SaveAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("save-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.save");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.save.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
- }
-
- public void actionPerformed(ActionEvent e) {
-
- if (getHandler().prepareSave()) {
-
- // save model to src
- getHandler().getModel().save();
-
- // close ui
- getUi().dispose();
- }
- }
-}
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java (from rev 1406, jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,50 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.nuiton.jaxx.util.config;
+
+import org.nuiton.jaxx.util.AbstractUIAction;
+import org.nuiton.jaxx.util.DialogUI;
+import org.nuiton.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class SaveAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("save-config"), dialogUI);
+ if (showLabel) {
+ String text = org.nuiton.i18n.I18n._("lutinui.config.save");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.save.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (getHandler().prepareSave()) {
+
+ // save model to src
+ getHandler().getModel().save();
+
+ // close ui
+ getUi().dispose();
+ }
+ }
+}
Copied: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton (from rev 1405, jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin)
Property changes on: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,170 +0,0 @@
-/* *##%
- * Copyright (C) 2007
- * JaxxPlugin, Code Lutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-package org.codelutin.jaxx;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-
-import java.io.File;
-
-/**
- * Abract Jaxx Mojo.
- *
- * @author chemit
- *
- * @since 1.3
- */
-public abstract class AbstractJaxxMojo extends AbstractMojo {
-
- /**
- * Dépendance du projet.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
- */
- protected MavenProject project;
- /**
- * Repertoire de destination des fichiers java a generer.
- *
- * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java"
- */
- protected File outJava;
- /**
- * verbose flag
- *
- * @parameter expression="${jaxx.verbose}" default-value="false"
- *
- * @since 1.3
- */
- protected boolean verbose;
- /**
- * to make compiler i18nable, says add the {@link org.codelutin.i18n.I18n#_(String, Object[])} method
- * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes.
- *
- * @parameter expression="${jaxx.i18nable}" default-value="true"
- * @see jaxx.compiler.I18nHelper
- */
- protected boolean i18nable;
- /**
- * The store of helpIds generated by {@link JaxxGeneratorMojo}.
- * <p/>
- *
- * @parameter expression="${jaxx.helpIdStore}" default-value="target/helpIds.properties"
- * @required
- *
- * @since 1.3
- */
- protected File helpIdStore;
- /**
- * The name of the helpset to generate.
- *
- * @parameter expression="${jaxx.helpSetName}" default-value="${project.artifactId}"
- * @required
- *
- * @since 1.3
- */
- protected String helpSetName;
- /**
- * The prefix to add to i18n key for any help i18n key.
- *
- * @parameter expression="${jaxx.helpsetI18nPrefix}" default-value="${jaxx.helpSetName}.help."
- * @required
- *
- * @since 1.3
- */
- protected String helpsetI18nPrefix;
- /**
- * The suffix to add to i18n key for an help Id.
- *
- * @parameter expression="${jaxx.helpsetTitleI18nSuffix}" default-value=".title"
- * @required
- *
- * @since 1.3
- */
- protected String helpsetTitleI18nSuffix;
- /**
- * The suffix to add to i18n key for an toc Id.
- *
- * @parameter expression="${jaxx.helpsetTocI18nSuffix}" default-value=".toc"
- * @required
- *
- * @since 1.3
- */
- protected String helpsetTocI18nSuffix;
- /**
- * The suffix to add to i18n key for an toc Id.
- *
- * @parameter expression="${jaxx.helpsetIndexI18nSuffix}" default-value=".index"
- * @required
- *
- * @since 1.3
- */
- protected String helpsetIndexI18nSuffix;
- protected boolean skip = true;
- protected ClassLoader cl;
-
- public abstract void init() throws Exception;
-
- public abstract void doAction() throws Exception;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
-
- try {
- init();
- } catch (Exception e) {
- if (e instanceof MojoFailureException) {
- throw (MojoFailureException) e;
- }
- if (e instanceof MojoExecutionException) {
- throw (MojoExecutionException) e;
- }
- throw new MojoExecutionException("error in init : " + e.getMessage(), e);
- }
-
- if (skip) {
- if (verbose) {
- getLog().info("jaxx - skip!");
- }
- return;
- }
-
- try {
-
- doAction();
-
- } catch (Exception e) {
- //getLog().error(e);
- Throwable e2 = e;
- while (e2.getCause() != null) {
- e2 = e.getCause();
- }
- getLog().error(e2);
-
- throw new MojoExecutionException(e2.getMessage(), e2);
- } finally {
- System.gc();
- }
-
- }
-
-}
\ No newline at end of file
Copied: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java (from rev 1406, jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java)
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/AbstractJaxxMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,170 @@
+/* *##%
+ * Copyright (C) 2007
+ * JaxxPlugin, Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+package org.nuiton.jaxx;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+
+/**
+ * Abract Jaxx Mojo.
+ *
+ * @author chemit
+ *
+ * @since 1.3
+ */
+public abstract class AbstractJaxxMojo extends AbstractMojo {
+
+ /**
+ * Dépendance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+ /**
+ * Repertoire de destination des fichiers java a generer.
+ *
+ * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java"
+ */
+ protected File outJava;
+ /**
+ * verbose flag
+ *
+ * @parameter expression="${jaxx.verbose}" default-value="false"
+ *
+ * @since 1.3
+ */
+ protected boolean verbose;
+ /**
+ * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method
+ * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes.
+ *
+ * @parameter expression="${jaxx.i18nable}" default-value="true"
+ * @see jaxx.compiler.I18nHelper
+ */
+ protected boolean i18nable;
+ /**
+ * The store of helpIds generated by {@link JaxxGeneratorMojo}.
+ * <p/>
+ *
+ * @parameter expression="${jaxx.helpIdStore}" default-value="target/helpIds.properties"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File helpIdStore;
+ /**
+ * The name of the helpset to generate.
+ *
+ * @parameter expression="${jaxx.helpSetName}" default-value="${project.artifactId}"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpSetName;
+ /**
+ * The prefix to add to i18n key for any help i18n key.
+ *
+ * @parameter expression="${jaxx.helpsetI18nPrefix}" default-value="${jaxx.helpSetName}.help."
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpsetI18nPrefix;
+ /**
+ * The suffix to add to i18n key for an help Id.
+ *
+ * @parameter expression="${jaxx.helpsetTitleI18nSuffix}" default-value=".title"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpsetTitleI18nSuffix;
+ /**
+ * The suffix to add to i18n key for an toc Id.
+ *
+ * @parameter expression="${jaxx.helpsetTocI18nSuffix}" default-value=".toc"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpsetTocI18nSuffix;
+ /**
+ * The suffix to add to i18n key for an toc Id.
+ *
+ * @parameter expression="${jaxx.helpsetIndexI18nSuffix}" default-value=".index"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpsetIndexI18nSuffix;
+ protected boolean skip = true;
+ protected ClassLoader cl;
+
+ public abstract void init() throws Exception;
+
+ public abstract void doAction() throws Exception;
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ try {
+ init();
+ } catch (Exception e) {
+ if (e instanceof MojoFailureException) {
+ throw (MojoFailureException) e;
+ }
+ if (e instanceof MojoExecutionException) {
+ throw (MojoExecutionException) e;
+ }
+ throw new MojoExecutionException("error in init : " + e.getMessage(), e);
+ }
+
+ if (skip) {
+ if (verbose) {
+ getLog().info("jaxx - skip!");
+ }
+ return;
+ }
+
+ try {
+
+ doAction();
+
+ } catch (Exception e) {
+ //getLog().error(e);
+ Throwable e2 = e;
+ while (e2.getCause() != null) {
+ e2 = e.getCause();
+ }
+ getLog().error(e2);
+
+ throw new MojoExecutionException(e2.getMessage(), e2);
+ } finally {
+ System.gc();
+ }
+
+ }
+
+}
\ No newline at end of file
Deleted: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,585 +0,0 @@
-/* *##%
- * Copyright (C) 2007
- * JaxxPlugin, Code Lutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-package org.codelutin.jaxx;
-
-import jaxx.beaninfos.BeanInfoUtil;
-import jaxx.compiler.CompilerOptions;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXCompilerLaunchor;
-import jaxx.runtime.JAXXContext;
-import jaxx.tags.TagManager;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codelutin.util.FileUpdaterHelper;
-import org.codelutin.util.MirroredFileUpdater;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import jaxx.compiler.CompiledObjectDecorator;
-import jaxx.compiler.HelpRootCompiledObjectDecorator;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Classe permettant de transformer des sources jaxx vers du source java.
- *
- * @author chemit
- * @goal generate
- * @phase process-sources
- * @requiresDependencyResolution compile
- * @requiresProject
- */
-public class JaxxGeneratorMojo extends AbstractJaxxMojo {
-
- /**
- * Le compilateur à utiliser (par défaut celui de Swing)
- *
- * @parameter expression="${jaxx.compilerFQN}" default-value="jaxx.compiler.SwingCompiler"
- */
- protected String compilerFQN;
- /**
- * Le compilateur à utiliser (par défaut celui de Swing)
- *
- * @parameter expression="${jaxx.validatorFQN}" default-value="jaxx.runtime.validator.swing.SwingValidator"
- */
- protected String validatorFQN;
- /**
- * chemin du repertoire de generation des resources.
- *
- * @parameter expression="${jaxx.outResource}" default-value="${basedir}/target/generated-sources/resources"
- */
- protected File outResource;
- /**
- * chemin du repertoire de compilation des resources.
- *
- * @parameter expression="${jaxx.outClass}" default-value="${basedir}/target/classes"
- */
- protected File outClass;
- /**
- * Repertoire sources des fichiers jaxx a generer.
- *
- * @parameter expression="${jaxx.src}" default-value="${maven.src.dir}/main/java"
- */
- protected File src;
- /**
- * pour optimizer le code compile ou genere ?
- *
- * @parameter expression="${jaxx.optimize}" default-value="false"
- */
- protected boolean optimize;
- /**
- * les options de la compilation
- *
- * @parameter expression="${jaxx.javaOpts}"
- */
- protected String javaOpts = null;
- /**
- * pour filter les fichiers a traiter
- *
- * @parameter expression="${jaxx.includes}"
- */
- protected String[] includes;
- /**
- * pour filter les fichiers a ne pas traiter
- *
- * @parameter expression="${jaxx.excludes}"
- */
- protected String[] excludes;
- /**
- * flag to include in compiler classpath the java sources directories (src and outJava).
- * <p/>
- * By default, false.
- *
- * @parameter expression="${jaxx.addSourcesToClassPath}" default-value="false"
- */
- protected boolean addSourcesToClassPath;
- /**
- * flag to include in compiler classpath the project compile classpath.
- * <p/>
- * By default, false.
- *
- * @parameter expression="${jaxx.addProjectClassPath}" default-value="false"
- */
- protected boolean addProjectClassPath;
- /**
- * to force generation of java source for any jaxx files with no timestamp checking.
- * <p/>
- * By default, never force generation.
- *
- * @parameter expression="${jaxx.force}" default-value="false"
- */
- protected boolean force;
- /**
- * flag to add logger to each generated jaxx file.
- * <p/>
- * By default, always add it.
- *
- * @parameter expression="${jaxx.addLogger}" default-value="true"
- */
- protected boolean addLogger;
- /**
- * flag to keep compilers after the generate operation (usefull for tests.
- * <p/>
- * By default, always reset.
- *
- * @parameter expression="${jaxx.resetAfterCompile}" default-value="true"
- */
- protected boolean resetAfterCompile;
- /**
- * the name of implementation of {@link jaxx.runtime.JAXXContext}
- * to be used on {@link jaxx.runtime.JAXXObject}.
- * <p/>
- * Must not be abstract.
- *
- * @parameter expression="${jaxx.jaxxContextImplementorClass}" default-value="jaxx.runtime.DefaultJAXXContext"
- * @required
- */
- protected String jaxxContextImplementorClass;
- /**
- * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(String[])}.
- * <p/>
- * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(String[])}
- * <p/>
- * and then will be use by {@link jaxx.tags.swing.SwingInitializer#initialize()}.
- * <p/>
- * <p/>
- * This permit to use real beanInfo of imported graphic libraries.
- *
- * @parameter expression="${jaxx.beanInfoSearchPath}"
- */
- protected String[] beanInfoSearchPath;
- /**
- * list of fqn of class toimport for all generated jaxx files
- *
- * @parameter expression="${jaxx.extraImports}"
- *
- * @deprecated Prefer use of extraImportList as a string, so
- * could be use in properties section.
- */
- protected String[] extraImports;
- /**
- * list of fqn of class toimport for all generated jaxx files
- *
- * @parameter expression="${jaxx.extraImportList}"
- */
- protected String extraImportList;
- /**
- * the FQN of the ui to use for error notification.
- * <p/>
- * If not given, will use the one defined in validator
- *
- * @parameter expression="${jaxx.defaultErrorUIFQN}"
- * @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS
- */
- protected String defaultErrorUIFQN;
- /**
- * the FQN of the ui to use for error notification.
- * <p/>
- * If not given, will use the one defined in validator
- *
- * @parameter expression="${jaxx.defaultDecorator}" default-value="jaxx.compiler.DefaultCompiledObjectDecorator"
- *
- * @see jaxx.compiler.CompiledObjectDecorator
- */
- protected String defaultDecoratorFQN;
- /**
- * a flag to use UIManager to retreave icons.
- *
- * @parameter expression="${jaxx.useUIManagerForIcon}" default-value="false"
- */
- protected boolean useUIManagerForIcon;
- /**
- * flag to activate profile mode.
- * <p/>
- * By default, not active.
- *
- * @parameter expression="${jaxx.profile}" default-value="false"
- */
- protected boolean profile;
- /**
- * flag to activate help generation process.
- * <p/>
- * By default, not active.
- *
- * @parameter expression="${jaxx.generateHelp}" default-value="false"
- *
- * @since 1.3
- */
- private boolean generateHelp;
- /**
- * the FQN of help broker
- * <p/>
- * By default, none.
- *
- * @parameter expression="${jaxx.helpBrokerFQN}"
- *
- * @since 1.3
- */
- private String helpBrokerFQN;
- protected String[] files;
- private static final String[] INCLUDES = {"**\\/*.jaxx"};
- protected CompilerOptions options;
- protected MirroredFileUpdater updater;
- private Class<?> defaultErrorUIClass;
- private Class<? extends CompiledObjectDecorator> defaultDecoratorClass;
- private Class<? extends JAXXCompiler> compilerClass;
-
- @SuppressWarnings("unchecked")
- @Override
- public void init() throws Exception {
-
- if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) {
- // nothing to be done for this type of packaging
- skip = true;
- getLog().info("skip generate goal for packaging " + project.getPackaging());
- return;
- }
-
- if (generateHelp) {
- // check there is some bundle
- if (helpIdStore == null) {
- throw new MojoFailureException("you must set the helpIdStore property.");
- }
- }
-
- compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN);
- defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN);
-
- // check the validator class is correct
- Class.forName(validatorFQN);
-
- if (defaultErrorUIFQN != null && !defaultErrorUIFQN.trim().isEmpty()) {
- defaultErrorUIClass = Class.forName(defaultErrorUIFQN);
- }
- skip = false;
-
- checkJaxxContextImplementorClass();
-
- if (beanInfoSearchPath != null && beanInfoSearchPath.length > 0) {
- // regisre extra path
- BeanInfoUtil.addJaxxBeanInfoPath(beanInfoSearchPath);
- }
- if (!outResource.exists()) {
- outResource.mkdirs();
- }
-
- if (!outJava.exists()) {
- outJava.mkdirs();
- }
-
- fixCompileSourceRoots();
-
- if (addSourcesToClassPath || addProjectClassPath) {
- cl = initClassLoader(project, getLog());
- Thread.currentThread().setContextClassLoader(cl);
- }
- DirectoryScanner ds;
- ds = new DirectoryScanner();
- ds.setBasedir(src);
- boolean noIncludes = includes == null || includes.length == 0;
- ds.setIncludes(noIncludes ? INCLUDES : includes);
-
- if (excludes != null && excludes.length > 0) {
- ds.setExcludes(excludes);
- }
-
- ds.scan();
- String[] filesFind = ds.getIncludedFiles();
- if (verbose) {
- getLog().info("jaxx - discover " + filesFind.length + " jaxx file(s). ");
- }
-
- updater = (MirroredFileUpdater) FileUpdaterHelper.newJaxxFileUpdater(src, outJava);
-
- if (force) {
- // we will regenerate all files
- this.files = filesFind;
- } else {
- // filter files
- List<String> listFiles = new ArrayList<String>();
-
- for (String file : filesFind) {
- if (updater.isFileUpToDate(new File(src, file))) {
- if (verbose) {
- getLog().info("jaxx - skip file [" + file + "].");
- }
- } else {
- if (verbose) {
- getLog().info("jaxx - detect modify file [" + file + "].");
- }
- listFiles.add(file);
- }
- }
- this.files = listFiles.toArray(new String[listFiles.size()]);
- }
-
- if (extraImportList != null && !extraImportList.isEmpty()) {
- String[] imports = extraImportList.split(",");
- int i = 0;
- for (String importS : imports) {
- imports[i++] = importS.trim();
- }
- if (verbose) {
- getLog().info("extra imports " + java.util.Arrays.toString(imports));
- }
- extraImports = imports;
-
- }
- options = toCompilerOptions();
-
- if (verbose) {
- printInit();
- }
-
- }
-
- @Override
- public void doAction() throws MojoExecutionException {
- getLog().info("jaxx - detects " + this.files.length + " modify jaxx file(s). ");
-
- try {
-
- // force compiler init from here, not in a static block
- TagManager.reset(verbose);
-
- JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.newLaunchor(src, files, options);
- boolean success = launchor.compile();
- getLog().info("jaxx - generate " + launchor.getCompilerCount() + " file(s). ");
-
- if (!success) {
- throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
- }
-
- if (generateHelp) {
- // generate help
- generateHelp();
- }
-
- } catch (MojoExecutionException e) {
- getLog().error(e);
- throw e;
- } catch (Exception e) {
- //getLog().error(e);
- Throwable e2 = e;
- while (e2.getCause() != null) {
- e2 = e.getCause();
- }
- getLog().error(e2);
-
- throw new MojoExecutionException(e2.getMessage(), e2);
- }
- }
-
- public CompilerOptions toCompilerOptions() {
- CompilerOptions result = new CompilerOptions();
- result.setClassPath(src.getPath());
- if (javaOpts != null && !"".equals(javaOpts)) {
- result.setJavacOpts(javaOpts);
- }
- result.setCompilerClass(compilerClass);
- result.setValidatorFQN(validatorFQN);
- result.setKeepJavaFiles(true);
- result.setOptimize(optimize);
- result.setJavacTargetDirectory(outClass);
- result.setTargetDirectory(outJava);
- result.setVerbose(verbose);
- result.setI18nable(i18nable);
- result.setAddLogger(addLogger);
- result.setProfile(profile);
- result.setResetAfterCompile(resetAfterCompile);
- result.setJaxxContextImplementorClass(jaxxContextImplementorClass);
- result.setExtraImports(extraImports);
- result.setDefaultErrorUI(defaultErrorUIClass);
- result.setUseUIManagerForIcon(useUIManagerForIcon);
- result.setDefaultDecoratorClass(defaultDecoratorClass);
- result.setGenerateHelp(generateHelp);
- result.setHelpBrokerFQN(helpBrokerFQN);
- result.setHelpsetTitleI18nSuffix(helpsetTitleI18nSuffix);
- result.setHelpsetIndexI18nSuffix(helpsetIndexI18nSuffix);
- result.setHelpsetTocI18nSuffix(helpsetTocI18nSuffix);
- result.setHelpSetName(helpSetName);
- result.setHelpsetI18nPrefix(helpsetI18nPrefix);
-
- if (cl != null) {
- result.setClassLoader(cl);
- }
- return result;
- }
-
- protected void fixCompileSourceRoots() {
- //fixme should remove this silly test when we will make real maven plugin tests :)
- if (project != null) {
- if (!project.getCompileSourceRoots().contains(outJava.getPath())) {
- project.addCompileSourceRoot(outJava.getPath());
- }
- }
- }
-
- protected void printInit() {
- getLog().info(options.toString());
- getLog().info("includes : " + Arrays.toString(includes));
- for (String file : files) {
- getLog().info("will generate " + file);
- }
-
- ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
- getLog().info(threadLoader.toString());
- if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) {
- try {
- java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs");
- m.setAccessible(true);
- URL[] urls = (URL[]) m.invoke(threadLoader);
-
- for (URL url : urls) {
- getLog().info("url in class loader " + url);
- }
- } catch (Exception e) {
- getLog().warn("??? : " + e.getMessage(), e);
- }
- }
-
- //fixme should remove this silly test when we will make real maven plugin tests :)
- if (getPluginContext() != null) {
- for (Object e : getPluginContext().keySet()) {
- getLog().info("pluginContext " + e + " : " + getPluginContext().get(e));
- }
- }
- }
-
- protected void checkJaxxContextImplementorClass() {
- if (jaxxContextImplementorClass == null) {
- throw new IllegalArgumentException("jaxxContextImplementor can not be null");
- }
- try {
- Class jaxxContextImplementor = Class.forName(jaxxContextImplementorClass);
- if (!JAXXContext.class.isAssignableFrom(jaxxContextImplementor)) {
- throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' does not implements " + JAXXContext.class);
- }
- if (Modifier.isAbstract(jaxxContextImplementor.getModifiers())) {
- throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' can not be abstract.");
-
- }
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("could not find jaxxContextImplementor class : " + jaxxContextImplementorClass);
- }
- }
-
- protected void generateHelp() throws IOException {
- Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
- if (helpIds.isEmpty()) {
- if (verbose) {
- // no ids detected in this compilation round
- getLog().info("no helpIds detected.");
- }
- return;
- }
-
- if (!helpIdStore.getParentFile().exists()) {
- helpIdStore.getParentFile().mkdirs();
- }
-
- Properties p = new Properties();
-
- for (String helpId : helpIds) {
- String path = helpId.replaceAll("\\.", File.separator);
- path = removeQuote(path) + ".html";
- p.put(removeQuote(helpId), path);
- }
-
- FileOutputStream w = new FileOutputStream(helpIdStore);
-
- try {
- p.store(w, null);
- } finally {
- w.close();
- }
-
- getLog().info("helpIdStore generated in " + helpIdStore);
-
- helpIds.clear();
- }
-
- @SuppressWarnings({"unchecked"})
- protected URLClassLoader initClassLoader(MavenProject project, org.apache.maven.plugin.logging.Log log) throws MalformedURLException {
- URLClassLoader loader = null;
- if (project != null) {
-
- URLClassLoader result;
- try {
-
- List<URL> lUrls = new ArrayList<URL>();
- List<String> sources = project.getCompileSourceRoots();
-
- if (addSourcesToClassPath) {
- for (String source : sources) {
- lUrls.add(new File(source).toURI().toURL());
- }
- }
- if (addProjectClassPath) {
- getLog().info("use project compile scope class-path");
- // add also all dependencies of the project in compile scope
- Set artifacts = project.getArtifacts();
- for (Object o : artifacts) {
- Artifact a = (Artifact) o;
- lUrls.add(a.getFile().toURI().toURL());
- }
- }
-
- result = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader());
-
- } catch (IOException e) {
- throw new RuntimeException("Can't create ClassLoader for reason " + e.getMessage(), e);
- }
- loader = result;
- } else {
- List<URL> lUrls = new ArrayList<URL>();
- if (addSourcesToClassPath) {
- lUrls.add(src.toURI().toURL());
- }
- loader = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader());
- }
- if (verbose) {
- for (URL entry : loader.getURLs()) {
- log.info("classpath : " + entry);
- }
- }
- return loader;
- }
-
- protected String removeQuote(String txt) {
- if (txt.startsWith("\"")) {
- txt = txt.substring(1);
- }
- if (txt.endsWith("\"")) {
- txt = txt.substring(0, txt.length() - 1);
- }
- return txt;
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java (from rev 1406, jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java)
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxGeneratorMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,585 @@
+/* *##%
+ * Copyright (C) 2007
+ * JaxxPlugin, Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+package org.nuiton.jaxx;
+
+import jaxx.beaninfos.BeanInfoUtil;
+import jaxx.compiler.CompilerOptions;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXCompilerLaunchor;
+import jaxx.runtime.JAXXContext;
+import jaxx.tags.TagManager;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.nuiton.util.FileUpdaterHelper;
+import org.nuiton.util.MirroredFileUpdater;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import jaxx.compiler.CompiledObjectDecorator;
+import jaxx.compiler.HelpRootCompiledObjectDecorator;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Classe permettant de transformer des sources jaxx vers du source java.
+ *
+ * @author chemit
+ * @goal generate
+ * @phase process-sources
+ * @requiresDependencyResolution compile
+ * @requiresProject
+ */
+public class JaxxGeneratorMojo extends AbstractJaxxMojo {
+
+ /**
+ * Le compilateur à utiliser (par défaut celui de Swing)
+ *
+ * @parameter expression="${jaxx.compilerFQN}" default-value="jaxx.compiler.SwingCompiler"
+ */
+ protected String compilerFQN;
+ /**
+ * Le compilateur à utiliser (par défaut celui de Swing)
+ *
+ * @parameter expression="${jaxx.validatorFQN}" default-value="jaxx.runtime.validator.swing.SwingValidator"
+ */
+ protected String validatorFQN;
+ /**
+ * chemin du repertoire de generation des resources.
+ *
+ * @parameter expression="${jaxx.outResource}" default-value="${basedir}/target/generated-sources/resources"
+ */
+ protected File outResource;
+ /**
+ * chemin du repertoire de compilation des resources.
+ *
+ * @parameter expression="${jaxx.outClass}" default-value="${basedir}/target/classes"
+ */
+ protected File outClass;
+ /**
+ * Repertoire sources des fichiers jaxx a generer.
+ *
+ * @parameter expression="${jaxx.src}" default-value="${maven.src.dir}/main/java"
+ */
+ protected File src;
+ /**
+ * pour optimizer le code compile ou genere ?
+ *
+ * @parameter expression="${jaxx.optimize}" default-value="false"
+ */
+ protected boolean optimize;
+ /**
+ * les options de la compilation
+ *
+ * @parameter expression="${jaxx.javaOpts}"
+ */
+ protected String javaOpts = null;
+ /**
+ * pour filter les fichiers a traiter
+ *
+ * @parameter expression="${jaxx.includes}"
+ */
+ protected String[] includes;
+ /**
+ * pour filter les fichiers a ne pas traiter
+ *
+ * @parameter expression="${jaxx.excludes}"
+ */
+ protected String[] excludes;
+ /**
+ * flag to include in compiler classpath the java sources directories (src and outJava).
+ * <p/>
+ * By default, false.
+ *
+ * @parameter expression="${jaxx.addSourcesToClassPath}" default-value="false"
+ */
+ protected boolean addSourcesToClassPath;
+ /**
+ * flag to include in compiler classpath the project compile classpath.
+ * <p/>
+ * By default, false.
+ *
+ * @parameter expression="${jaxx.addProjectClassPath}" default-value="false"
+ */
+ protected boolean addProjectClassPath;
+ /**
+ * to force generation of java source for any jaxx files with no timestamp checking.
+ * <p/>
+ * By default, never force generation.
+ *
+ * @parameter expression="${jaxx.force}" default-value="false"
+ */
+ protected boolean force;
+ /**
+ * flag to add logger to each generated jaxx file.
+ * <p/>
+ * By default, always add it.
+ *
+ * @parameter expression="${jaxx.addLogger}" default-value="true"
+ */
+ protected boolean addLogger;
+ /**
+ * flag to keep compilers after the generate operation (usefull for tests.
+ * <p/>
+ * By default, always reset.
+ *
+ * @parameter expression="${jaxx.resetAfterCompile}" default-value="true"
+ */
+ protected boolean resetAfterCompile;
+ /**
+ * the name of implementation of {@link jaxx.runtime.JAXXContext}
+ * to be used on {@link jaxx.runtime.JAXXObject}.
+ * <p/>
+ * Must not be abstract.
+ *
+ * @parameter expression="${jaxx.jaxxContextImplementorClass}" default-value="jaxx.runtime.DefaultJAXXContext"
+ * @required
+ */
+ protected String jaxxContextImplementorClass;
+ /**
+ * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(String[])}.
+ * <p/>
+ * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(String[])}
+ * <p/>
+ * and then will be use by {@link jaxx.tags.swing.SwingInitializer#initialize()}.
+ * <p/>
+ * <p/>
+ * This permit to use real beanInfo of imported graphic libraries.
+ *
+ * @parameter expression="${jaxx.beanInfoSearchPath}"
+ */
+ protected String[] beanInfoSearchPath;
+ /**
+ * list of fqn of class toimport for all generated jaxx files
+ *
+ * @parameter expression="${jaxx.extraImports}"
+ *
+ * @deprecated Prefer use of extraImportList as a string, so
+ * could be use in properties section.
+ */
+ protected String[] extraImports;
+ /**
+ * list of fqn of class toimport for all generated jaxx files
+ *
+ * @parameter expression="${jaxx.extraImportList}"
+ */
+ protected String extraImportList;
+ /**
+ * the FQN of the ui to use for error notification.
+ * <p/>
+ * If not given, will use the one defined in validator
+ *
+ * @parameter expression="${jaxx.defaultErrorUIFQN}"
+ * @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS
+ */
+ protected String defaultErrorUIFQN;
+ /**
+ * the FQN of the ui to use for error notification.
+ * <p/>
+ * If not given, will use the one defined in validator
+ *
+ * @parameter expression="${jaxx.defaultDecorator}" default-value="jaxx.compiler.DefaultCompiledObjectDecorator"
+ *
+ * @see jaxx.compiler.CompiledObjectDecorator
+ */
+ protected String defaultDecoratorFQN;
+ /**
+ * a flag to use UIManager to retreave icons.
+ *
+ * @parameter expression="${jaxx.useUIManagerForIcon}" default-value="false"
+ */
+ protected boolean useUIManagerForIcon;
+ /**
+ * flag to activate profile mode.
+ * <p/>
+ * By default, not active.
+ *
+ * @parameter expression="${jaxx.profile}" default-value="false"
+ */
+ protected boolean profile;
+ /**
+ * flag to activate help generation process.
+ * <p/>
+ * By default, not active.
+ *
+ * @parameter expression="${jaxx.generateHelp}" default-value="false"
+ *
+ * @since 1.3
+ */
+ private boolean generateHelp;
+ /**
+ * the FQN of help broker
+ * <p/>
+ * By default, none.
+ *
+ * @parameter expression="${jaxx.helpBrokerFQN}"
+ *
+ * @since 1.3
+ */
+ private String helpBrokerFQN;
+ protected String[] files;
+ private static final String[] INCLUDES = {"**\\/*.jaxx"};
+ protected CompilerOptions options;
+ protected MirroredFileUpdater updater;
+ private Class<?> defaultErrorUIClass;
+ private Class<? extends CompiledObjectDecorator> defaultDecoratorClass;
+ private Class<? extends JAXXCompiler> compilerClass;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void init() throws Exception {
+
+ if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) {
+ // nothing to be done for this type of packaging
+ skip = true;
+ getLog().info("skip generate goal for packaging " + project.getPackaging());
+ return;
+ }
+
+ if (generateHelp) {
+ // check there is some bundle
+ if (helpIdStore == null) {
+ throw new MojoFailureException("you must set the helpIdStore property.");
+ }
+ }
+
+ compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN);
+ defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN);
+
+ // check the validator class is correct
+ Class.forName(validatorFQN);
+
+ if (defaultErrorUIFQN != null && !defaultErrorUIFQN.trim().isEmpty()) {
+ defaultErrorUIClass = Class.forName(defaultErrorUIFQN);
+ }
+ skip = false;
+
+ checkJaxxContextImplementorClass();
+
+ if (beanInfoSearchPath != null && beanInfoSearchPath.length > 0) {
+ // regisre extra path
+ BeanInfoUtil.addJaxxBeanInfoPath(beanInfoSearchPath);
+ }
+ if (!outResource.exists()) {
+ outResource.mkdirs();
+ }
+
+ if (!outJava.exists()) {
+ outJava.mkdirs();
+ }
+
+ fixCompileSourceRoots();
+
+ if (addSourcesToClassPath || addProjectClassPath) {
+ cl = initClassLoader(project, getLog());
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ DirectoryScanner ds;
+ ds = new DirectoryScanner();
+ ds.setBasedir(src);
+ boolean noIncludes = includes == null || includes.length == 0;
+ ds.setIncludes(noIncludes ? INCLUDES : includes);
+
+ if (excludes != null && excludes.length > 0) {
+ ds.setExcludes(excludes);
+ }
+
+ ds.scan();
+ String[] filesFind = ds.getIncludedFiles();
+ if (verbose) {
+ getLog().info("jaxx - discover " + filesFind.length + " jaxx file(s). ");
+ }
+
+ updater = (MirroredFileUpdater) FileUpdaterHelper.newJaxxFileUpdater(src, outJava);
+
+ if (force) {
+ // we will regenerate all files
+ this.files = filesFind;
+ } else {
+ // filter files
+ List<String> listFiles = new ArrayList<String>();
+
+ for (String file : filesFind) {
+ if (updater.isFileUpToDate(new File(src, file))) {
+ if (verbose) {
+ getLog().info("jaxx - skip file [" + file + "].");
+ }
+ } else {
+ if (verbose) {
+ getLog().info("jaxx - detect modify file [" + file + "].");
+ }
+ listFiles.add(file);
+ }
+ }
+ this.files = listFiles.toArray(new String[listFiles.size()]);
+ }
+
+ if (extraImportList != null && !extraImportList.isEmpty()) {
+ String[] imports = extraImportList.split(",");
+ int i = 0;
+ for (String importS : imports) {
+ imports[i++] = importS.trim();
+ }
+ if (verbose) {
+ getLog().info("extra imports " + java.util.Arrays.toString(imports));
+ }
+ extraImports = imports;
+
+ }
+ options = toCompilerOptions();
+
+ if (verbose) {
+ printInit();
+ }
+
+ }
+
+ @Override
+ public void doAction() throws MojoExecutionException {
+ getLog().info("jaxx - detects " + this.files.length + " modify jaxx file(s). ");
+
+ try {
+
+ // force compiler init from here, not in a static block
+ TagManager.reset(verbose);
+
+ JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.newLaunchor(src, files, options);
+ boolean success = launchor.compile();
+ getLog().info("jaxx - generate " + launchor.getCompilerCount() + " file(s). ");
+
+ if (!success) {
+ throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
+ }
+
+ if (generateHelp) {
+ // generate help
+ generateHelp();
+ }
+
+ } catch (MojoExecutionException e) {
+ getLog().error(e);
+ throw e;
+ } catch (Exception e) {
+ //getLog().error(e);
+ Throwable e2 = e;
+ while (e2.getCause() != null) {
+ e2 = e.getCause();
+ }
+ getLog().error(e2);
+
+ throw new MojoExecutionException(e2.getMessage(), e2);
+ }
+ }
+
+ public CompilerOptions toCompilerOptions() {
+ CompilerOptions result = new CompilerOptions();
+ result.setClassPath(src.getPath());
+ if (javaOpts != null && !"".equals(javaOpts)) {
+ result.setJavacOpts(javaOpts);
+ }
+ result.setCompilerClass(compilerClass);
+ result.setValidatorFQN(validatorFQN);
+ result.setKeepJavaFiles(true);
+ result.setOptimize(optimize);
+ result.setJavacTargetDirectory(outClass);
+ result.setTargetDirectory(outJava);
+ result.setVerbose(verbose);
+ result.setI18nable(i18nable);
+ result.setAddLogger(addLogger);
+ result.setProfile(profile);
+ result.setResetAfterCompile(resetAfterCompile);
+ result.setJaxxContextImplementorClass(jaxxContextImplementorClass);
+ result.setExtraImports(extraImports);
+ result.setDefaultErrorUI(defaultErrorUIClass);
+ result.setUseUIManagerForIcon(useUIManagerForIcon);
+ result.setDefaultDecoratorClass(defaultDecoratorClass);
+ result.setGenerateHelp(generateHelp);
+ result.setHelpBrokerFQN(helpBrokerFQN);
+ result.setHelpsetTitleI18nSuffix(helpsetTitleI18nSuffix);
+ result.setHelpsetIndexI18nSuffix(helpsetIndexI18nSuffix);
+ result.setHelpsetTocI18nSuffix(helpsetTocI18nSuffix);
+ result.setHelpSetName(helpSetName);
+ result.setHelpsetI18nPrefix(helpsetI18nPrefix);
+
+ if (cl != null) {
+ result.setClassLoader(cl);
+ }
+ return result;
+ }
+
+ protected void fixCompileSourceRoots() {
+ //fixme should remove this silly test when we will make real maven plugin tests :)
+ if (project != null) {
+ if (!project.getCompileSourceRoots().contains(outJava.getPath())) {
+ project.addCompileSourceRoot(outJava.getPath());
+ }
+ }
+ }
+
+ protected void printInit() {
+ getLog().info(options.toString());
+ getLog().info("includes : " + Arrays.toString(includes));
+ for (String file : files) {
+ getLog().info("will generate " + file);
+ }
+
+ ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
+ getLog().info(threadLoader.toString());
+ if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) {
+ try {
+ java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs");
+ m.setAccessible(true);
+ URL[] urls = (URL[]) m.invoke(threadLoader);
+
+ for (URL url : urls) {
+ getLog().info("url in class loader " + url);
+ }
+ } catch (Exception e) {
+ getLog().warn("??? : " + e.getMessage(), e);
+ }
+ }
+
+ //fixme should remove this silly test when we will make real maven plugin tests :)
+ if (getPluginContext() != null) {
+ for (Object e : getPluginContext().keySet()) {
+ getLog().info("pluginContext " + e + " : " + getPluginContext().get(e));
+ }
+ }
+ }
+
+ protected void checkJaxxContextImplementorClass() {
+ if (jaxxContextImplementorClass == null) {
+ throw new IllegalArgumentException("jaxxContextImplementor can not be null");
+ }
+ try {
+ Class jaxxContextImplementor = Class.forName(jaxxContextImplementorClass);
+ if (!JAXXContext.class.isAssignableFrom(jaxxContextImplementor)) {
+ throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' does not implements " + JAXXContext.class);
+ }
+ if (Modifier.isAbstract(jaxxContextImplementor.getModifiers())) {
+ throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' can not be abstract.");
+
+ }
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("could not find jaxxContextImplementor class : " + jaxxContextImplementorClass);
+ }
+ }
+
+ protected void generateHelp() throws IOException {
+ Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
+ if (helpIds.isEmpty()) {
+ if (verbose) {
+ // no ids detected in this compilation round
+ getLog().info("no helpIds detected.");
+ }
+ return;
+ }
+
+ if (!helpIdStore.getParentFile().exists()) {
+ helpIdStore.getParentFile().mkdirs();
+ }
+
+ Properties p = new Properties();
+
+ for (String helpId : helpIds) {
+ String path = helpId.replaceAll("\\.", File.separator);
+ path = removeQuote(path) + ".html";
+ p.put(removeQuote(helpId), path);
+ }
+
+ FileOutputStream w = new FileOutputStream(helpIdStore);
+
+ try {
+ p.store(w, null);
+ } finally {
+ w.close();
+ }
+
+ getLog().info("helpIdStore generated in " + helpIdStore);
+
+ helpIds.clear();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected URLClassLoader initClassLoader(MavenProject project, org.apache.maven.plugin.logging.Log log) throws MalformedURLException {
+ URLClassLoader loader = null;
+ if (project != null) {
+
+ URLClassLoader result;
+ try {
+
+ List<URL> lUrls = new ArrayList<URL>();
+ List<String> sources = project.getCompileSourceRoots();
+
+ if (addSourcesToClassPath) {
+ for (String source : sources) {
+ lUrls.add(new File(source).toURI().toURL());
+ }
+ }
+ if (addProjectClassPath) {
+ getLog().info("use project compile scope class-path");
+ // add also all dependencies of the project in compile scope
+ Set artifacts = project.getArtifacts();
+ for (Object o : artifacts) {
+ Artifact a = (Artifact) o;
+ lUrls.add(a.getFile().toURI().toURL());
+ }
+ }
+
+ result = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader());
+
+ } catch (IOException e) {
+ throw new RuntimeException("Can't create ClassLoader for reason " + e.getMessage(), e);
+ }
+ loader = result;
+ } else {
+ List<URL> lUrls = new ArrayList<URL>();
+ if (addSourcesToClassPath) {
+ lUrls.add(src.toURI().toURL());
+ }
+ loader = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader());
+ }
+ if (verbose) {
+ for (URL entry : loader.getURLs()) {
+ log.info("classpath : " + entry);
+ }
+ }
+ return loader;
+ }
+
+ protected String removeQuote(String txt) {
+ if (txt.startsWith("\"")) {
+ txt = txt.substring(1);
+ }
+ if (txt.endsWith("\"")) {
+ txt = txt.substring(0, txt.length() - 1);
+ }
+ return txt;
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,792 +0,0 @@
-/* *##%
- * Copyright (C) 2007
- * JaxxPlugin, Code Lutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-package org.codelutin.jaxx;
-
-import org.apache.maven.plugin.MojoFailureException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-import org.apache.maven.model.Resource;
-import org.codelutin.i18n.I18n;
-import org.codelutin.util.FileUtil;
-import org.codelutin.util.SortedProperties;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-import static org.codelutin.i18n.I18n._;
-
-/**
- * Mojo to generate javax help stuff for your project.
- *
- * HelpIds should have been discovered by the JaxxMojo.
- *
- * @author chemit
- * @goal generate-help
- * @phase process-sources
- *
- * @requiresProject
- * @requiresDependencyResolution compile
- * @since 1.3
- */
-public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo {
-
- /**
- * The directory where to generate javaHelp skeleton files.
- * <p/>
- * Is required if generateHelp is on.
- *
- * @parameter expression="${jaxx.helpTarget}" alias="target" default-value="${maven.src.dir}/main/help"
- * @required
- *
- * @since 1.3
- */
- protected File target;
- /**
- * The locale to generate for help.
- *
- * By default, stay in France.
- *
- * @parameter expression="${jaxx.locale}" default-value="fr"
- * @required
- *
- * @since 1.3
- */
- protected String locale;
- /**
- * The package where to generate i18n java file.
- *
- * @parameter expression="${jaxx.packageName}" default-value="${project.groupId}"
- * @required
- *
- * @since 1.3
- */
- protected String packageName;
- /**
- * The file name of the helpset to generate.
- *
- * @parameter expression="${jaxx.helpSetFileName}" default-value="${jaxx.helpSetName}.hs"
- * @required
- *
- * @since 1.3
- */
- protected String helpsetFileName;
- /**
- * The file name of the helpset map to generate.
- *
- * @parameter expression="${jaxx.mapFileName}" default-value="${jaxx.helpSetName}Map.jhm"
- * @required
- *
- * @since 1.3
- */
- protected String mapFileName;
- /**
- * The file name of the helpset index to generate.
- *
- * @parameter expression="${jaxx.indexFileName}" default-value="${jaxx.helpSetName}Index.xml"
- * @required
- *
- * @since 1.3
- */
- protected String indexFileName;
- /**
- * The file name of the helpset toc to generate.
- *
- * @parameter expression="${jaxx.tocFileName}" default-value="${jaxx.helpSetName}TOC.xml"
- * @required
- *
- * @since 1.3
- */
- protected String tocFileName;
- /**
- * The file name of the i18n java file to generate.
- *
- * @parameter expression="${jaxx.i8nFileName}" default-value="${jaxx.helpSetName}I18n.java"
- * @required
- *
- * @since 1.3
- */
- protected String i8nFileName;
- /**
- * The template used to generate helpset file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.helpSetTemplate}" default-value="/defaultHelpSet.hs.vm"
- * @required
- *
- * @since 1.3
- */
- protected File helpSetTemplate;
- /**
- * The template used to generate helpset map file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm"
- * @required
- *
- * @since 1.3
- */
- protected File mapTemplate;
- /**
- * The template used to generate helpset index file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm"
- * @required
- *
- * @since 1.3
- */
- protected File indexTemplate;
- /**
- * The template used to generate helpset toc file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm"
- * @required
- *
- * @since 1.3
- */
- protected File tocTemplate;
- /**
- * The template used to generate helpset content file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm"
- * @required
- *
- * @since 1.3
- */
- protected File contentTemplate;
- /**
- * The template used to generate helpset content file.
- *
- * Must be an existing file or a ressource in classp-ath
- *
- * @parameter expression="${jaxx.i18nTemplate}" default-value="/defaultI18n.java.vm"
- * @required
- *
- * @since 1.3
- */
- protected File i18nTemplate;
- /**
- * The help ids discovered by Jaxx compilation
- */
- protected Properties helpIds;
- private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
-
- @Override
- public void init() throws Exception {
-
- if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) {
- // nothing to be done for this type of packaging
- skip = true;
- getLog().info("skip generate goal for packaging " + project.getPackaging());
- return;
- }
-
- if (!helpIdStore.exists()) {
- skip = true;
- getLog().info("no helpIdStore to react at " + helpIdStore);
- return;
- }
-
- // check there is some bundle
- if (locale == null) {
- throw new MojoFailureException("you must set the bundles property.");
- }
- // check there is some bundle
- if (target == null) {
- throw new MojoFailureException("you must set the target property.");
- }
- // check ressources
- checkResource(helpSetTemplate);
- checkResource(mapTemplate);
- checkResource(indexTemplate);
- checkResource(tocTemplate);
- checkResource(contentTemplate);
-
- if (!target.exists()) {
- getLog().info("mkdir " + target);
- target.mkdirs();
- }
-
-
- helpIds = new SortedProperties();
-
- InputStream stream = new FileInputStream(helpIdStore);
-
- helpIds.load(stream);
-
- stream.close();
-
- if (helpIds.isEmpty()) {
-
- // no ids detected
- getLog().warn("no helpIds detected, will skip.");
- skip = true;
- return;
- }
-
- skip = false;
- }
-
- @Override
- public void doAction() throws Exception {
-
- if (i18nable) {
-
- List<URL> lUrls = new java.util.ArrayList<URL>();
- List resources = project.getResources();
- for (Object o : resources) {
- Resource resource = (Resource) o;
- lUrls.add(new File(resource.getDirectory()).toURI().toURL());
- }
- I18n.setExtraURL(lUrls.toArray(new URL[lUrls.size()]));
- I18n.init(locale, null);
- }
-
- File file;
-
- Properties env = new Properties();
-
- env.put("helpSetName", helpSetName);
- env.put("helpSetFileName", helpsetFileName);
- env.put("mapFileName", mapFileName);
- env.put("indexFileName", indexFileName);
- env.put("tocFileName", tocFileName);
- env.put("separator", " ");
- env.put("autoremoveLine", AUTOREMOVE_LINE);
-
-
- int touchedFiles = 0;
-
- // ---------------------------------------------------------------
- // --- main helpset file -----------------------------------------
- // ---------------------------------------------------------------
-
-
- file = new File(target, helpsetFileName);
-
- boolean doCreate = generateHelSetFile(file, env);
-
- if (doCreate) {
- touchedFiles++;
- }
-
- // ---------------------------------------------------------------
- // --- helpset map file ------------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(target, mapFileName);
-
- Properties mergedHelpIds = generateMapFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset index file ----------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(target, indexFileName);
-
- NodeItem indexRootItem = generateIndexFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset toc file ------------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(target, tocFileName);
-
- NodeItem tocRootItem = generateTocFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset content files -------------------------------------
- // ---------------------------------------------------------------
-
- TemplateGenerator gen = prepareGenerator(contentTemplate);
-
- Enumeration keys = helpIds.keys();
-
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- String url = (String) helpIds.get(key);
- url = helpSetName + File.separator + url;
-
- File f = new File(target, url);
-
- boolean exist = f.exists();
-
- if (exist) {
- // check if there is a autoremoveLine in content
- String content = FileUtil.readAsString(f);
- if (!content.contains(AUTOREMOVE_LINE)) {
- // no regenerate marker detected, so skip this file
- if (verbose) {
- getLog().debug("skip existing file " + f);
- }
- continue;
- }
- }
-
- f.getParentFile().mkdirs();
-
- if (verbose) {
- if (exist) {
- getLog().info("regenerate content file " + f);
- } else {
- getLog().info("generate content file " + f);
- }
- }
-
- env.put("helpId", key);
- String i18n = helpsetI18nPrefix + key + helpsetTitleI18nSuffix;
- env.put("helpIdTitle", _(i18n));
- env.put("helpIdUrl", url);
-
- gen.generate(env, f);
- touchedFiles++;
- }
-
- // ---------------------------------------------------------------
- // --- i18n file -------------------------------------------------
- // ---------------------------------------------------------------
-
- String path = packageName.replaceAll("\\.", File.separator);
- path += File.separator + i8nFileName;
- file = new File(outJava, path);
- generateI18nFile(file, env, mergedHelpIds, indexRootItem, tocRootItem);
- touchedFiles++;
-
- getLog().info(touchedFiles + " file(s) treated.");
- }
-
- protected void generateI18nFile(File file, Properties env, Properties mergedHelpIds, NodeItem indexRootItem, NodeItem tocRootItem) throws Exception {
-
- boolean create = !file.exists();
-
- if (!file.getParentFile().exists()) {
- file.getParentFile().mkdirs();
- }
-
- Set<String> keys = new java.util.HashSet<String>();
-
- for (Object k : mergedHelpIds.keySet()) {
- String key = helpsetI18nPrefix + k + helpsetTitleI18nSuffix;
- keys.add(key);
- }
- indexRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetIndexI18nSuffix);
- tocRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetTocI18nSuffix);
-
- env.put("keys", keys);
- env.put("packageName", packageName);
- String className = file.getName();
- int index = className.lastIndexOf(".");
- className = className.substring(0, index);
- env.put("className", className);
-
- if (verbose) {
- if (create) {
- getLog().info("generate i18n java file " + file);
- } else {
- getLog().info("udpate i18n java file " + file);
- }
- }
-
- doGen(i18nTemplate, file, env);
-
- }
-
- protected boolean generateHelSetFile(File file, Properties env) throws Exception {
-
- if (file.exists()) {
- // check the auto removeline presence
- String content = FileUtil.readAsString(file);
- if (!content.contains(AUTOREMOVE_LINE)) {
- // no regenerate marker detected, so skip this file
- if (verbose) {
- getLog().info("skip existing helpset main file " + file);
- }
- return false;
- }
- }
-
- if (verbose) {
- if (file.exists()) {
- getLog().info("regenerate helpset main file " + file);
- } else {
- getLog().info("generate helpset main file " + file);
- }
- }
- doGen(helpSetTemplate, file, env);
- return true;
- }
-
- protected Properties generateMapFile(File file, Properties env) throws Exception {
-
- boolean create;
-
- Properties mergedHelpIds = null;
- if (file.exists()) {
-
- // get back the exisiting data and merge it with incoming ones
-
- if (verbose) {
- getLog().info("loading existing helpset map file " + file);
- }
-
- mergedHelpIds = getExistingHelpIds(file);
- create = false;
-
- } else {
-
- mergedHelpIds = new SortedProperties();
- create = true;
- }
-
- // inject new helpIds
-
- for (Object k : helpIds.keySet()) {
- mergedHelpIds.put(k, helpSetName + "/" + helpIds.get(k));
- }
-
- if (!mergedHelpIds.contains("top")) {
- // on ajoute une entree vers le root du helpset
-
- String topUrl = helpSetName + ".html";
- helpIds.put("top", topUrl);
- mergedHelpIds.put("top", helpSetName + "/" + topUrl);
- if (verbose) {
- getLog().debug("add top entry with url " + topUrl);
- }
- }
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset map file " + file);
- } else {
- getLog().info("udpate helpset map file " + file);
- }
- }
-
- env.put("helpIds", mergedHelpIds);
- doGen(mapTemplate, file, env);
- env.remove("helpIds");
- return mergedHelpIds;
- }
-
- protected NodeItem generateIndexFile(File file, Properties env) throws Exception {
- NodeItem rootItem = null;
-
- boolean create;
-
- if (file.exists()) {
-
- create = false;
-
- rootItem = getExistingItems("indexitem", file);
- } else {
- create = true;
- }
-
- if (rootItem == null) {
- rootItem = new NodeItem("top", helpSetName);
- }
-
- // inject new index entries
-
- for (Object k : helpIds.keySet()) {
- NodeItem toc = rootItem.findChild(k + "");
- if (verbose) {
- getLog().debug("index " + k + " : " + toc);
- }
- }
-
- //String prefix = helpsetI18nPrefix;
- //String prefix = helpsetI18nPrefix + helpSetName + ".";
- rootItem.applyI18n(helpsetI18nPrefix, helpsetIndexI18nSuffix);
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset index file " + file);
- } else {
- getLog().info("udpate helpset index file " + file);
- }
- }
-
- env.put("rootItem", rootItem);
- doGen(indexTemplate, file, env);
- env.remove("rootItem");
- return rootItem;
- }
-
- protected NodeItem generateTocFile(File file, Properties env) throws Exception {
- NodeItem rootItem = null;
-
- boolean create;
-
- if (file.exists()) {
-
- create = false;
-
- rootItem = getExistingItems("tocitem", file);
- } else {
- create = true;
- }
-
- if (rootItem == null) {
- rootItem = new NodeItem("top", helpSetName);
- }
- // inject new toc entries
-
- for (Object k : helpIds.keySet()) {
- NodeItem toc = rootItem.findChild(k + "");
- if (verbose) {
- getLog().debug("toc " + k + " : " + toc);
- }
- }
-
- //String prefix = helpsetI18nPrefix + helpSetName + ".";
- rootItem.applyI18n(helpsetI18nPrefix, helpsetTocI18nSuffix);
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset toc file " + file);
- } else {
- getLog().info("udpate helpset toc file " + file);
- }
- }
-
- env.put("rootItem", rootItem);
- doGen(tocTemplate, file, env);
- env.remove("rootItem");
- return rootItem;
- }
-
- protected void doGen(File template, File f, Properties env) throws Exception {
- TemplateGenerator gen = prepareGenerator(template);
- gen.generate(env, f);
- }
-
- protected TemplateGenerator prepareGenerator(File template) throws Exception {
- URL templateURL = getTemplate(template);
-
- if (verbose) {
- getLog().info("using template " + templateURL);
- }
- TemplateGenerator gen = new TemplateGenerator(project, templateURL);
- return gen;
- }
-
- protected URL getTemplate(File f) throws IOException {
- URL r = null;
- InputStream s = null;
- if (f.exists()) {
- r = f.toURI().toURL();
- } else {
- r = getClass().getResource(f.toString());
- }
- return r;
- }
-
- protected void checkResource(File f) throws MojoFailureException {
- if (!f.exists()) {
- // test in classPath
- InputStream r = getClass().getResourceAsStream(f.toString());
- if (r == null) {
- throw new MojoFailureException("could not find ressource " + f);
- }
- }
- }
-
- protected Properties getExistingHelpIds(File file) throws SAXException, IOException {
-
- final Properties result = new SortedProperties();
-
- XMLReader parser = XMLReaderFactory.createXMLReader();
-
- parser.setContentHandler(new ContentHandlerAdapter() {
-
- String target;
- String url;
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
- if ("mapID".equals(localName)) {
- target = atts.getValue("target");
- url = atts.getValue("url");
- if (verbose) {
- getLog().debug("detect map entry : " + target + " : " + url);
- }
- result.put(target, url);
- }
- }
- });
-
- InputStream s = new FileInputStream(file);
- try {
- parser.parse(new InputSource(s));
- } finally {
- s.close();
- }
- return result;
- }
-
- protected NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException {
-
- XMLReader parser = XMLReaderFactory.createXMLReader();
- NodeItemHandler handler = new NodeItemHandler(tagName);
-
- parser.setContentHandler(handler);
-
- NodeItem rootItem = null;
- InputStream s = new FileInputStream(file);
- try {
- parser.parse(new InputSource(s));
- rootItem = handler.rootItem;
- } finally {
- s.close();
- }
- return rootItem;
- }
-
- static class NodeItemHandler extends ContentHandlerAdapter {
-
- NodeItem rootItem;
- NodeItem currentItem;
- final Stack<NodeItem> stack;
- final String tagName;
-
- public NodeItemHandler(String tagName) {
- this.tagName = tagName;
- this.stack = new Stack<NodeItem>();
- }
-
- @Override
- public void startDocument() throws SAXException {
- rootItem = new NodeItem("top", null);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
- if (tagName.equals(localName)) {
-
- String target = atts.getValue("target");
- String text = atts.getValue("text");
-
- // debut d'un item
- if (currentItem == null) {
- // premier item
- if (rootItem.getTarget().equals(target)) {
- // le premier item est bien top
- //rootItem.setText(text);
- currentItem = rootItem;
- } else {
- // le premier noeud n'est pas top
- // en l'encapsule
- stack.push(rootItem);
- currentItem = new NodeItem(target, text);
- rootItem.addChild(currentItem);
- }
- } else {
- NodeItem newItem = new NodeItem(target, text);
- currentItem.addChild(newItem);
- currentItem = newItem;
- }
- currentItem.adjustTarget();
- stack.push(currentItem);
-
- }
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- if (tagName.equals(localName)) {
- // fin d'un item
- stack.pop();
- if (!stack.isEmpty()) {
- currentItem = stack.peek();
- }
- }
- }
- }
-
- static class ContentHandlerAdapter implements ContentHandler {
-
- @Override
- public void setDocumentLocator(Locator locator) {
- }
-
- @Override
- public void startDocument() throws SAXException {
- }
-
- @Override
- public void endDocument() throws SAXException {
- }
-
- @Override
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- }
-
- @Override
- public void endPrefixMapping(String prefix) throws SAXException {
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- }
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- }
-
- @Override
- public void processingInstruction(String target, String data) throws SAXException {
- }
-
- @Override
- public void skippedEntity(String name) throws SAXException {
- }
- }
-}
\ No newline at end of file
Copied: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java (from rev 1406, jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java)
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/JaxxHelpGeneratorMojo.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,792 @@
+/* *##%
+ * Copyright (C) 2007
+ * JaxxPlugin, Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+package org.nuiton.jaxx;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Stack;
+import org.apache.maven.model.Resource;
+import org.nuiton.i18n.I18n;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.SortedProperties;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Mojo to generate javax help stuff for your project.
+ *
+ * HelpIds should have been discovered by the JaxxMojo.
+ *
+ * @author chemit
+ * @goal generate-help
+ * @phase process-sources
+ *
+ * @requiresProject
+ * @requiresDependencyResolution compile
+ * @since 1.3
+ */
+public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo {
+
+ /**
+ * The directory where to generate javaHelp skeleton files.
+ * <p/>
+ * Is required if generateHelp is on.
+ *
+ * @parameter expression="${jaxx.helpTarget}" alias="target" default-value="${maven.src.dir}/main/help"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File target;
+ /**
+ * The locale to generate for help.
+ *
+ * By default, stay in France.
+ *
+ * @parameter expression="${jaxx.locale}" default-value="fr"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String locale;
+ /**
+ * The package where to generate i18n java file.
+ *
+ * @parameter expression="${jaxx.packageName}" default-value="${project.groupId}"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String packageName;
+ /**
+ * The file name of the helpset to generate.
+ *
+ * @parameter expression="${jaxx.helpSetFileName}" default-value="${jaxx.helpSetName}.hs"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String helpsetFileName;
+ /**
+ * The file name of the helpset map to generate.
+ *
+ * @parameter expression="${jaxx.mapFileName}" default-value="${jaxx.helpSetName}Map.jhm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String mapFileName;
+ /**
+ * The file name of the helpset index to generate.
+ *
+ * @parameter expression="${jaxx.indexFileName}" default-value="${jaxx.helpSetName}Index.xml"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String indexFileName;
+ /**
+ * The file name of the helpset toc to generate.
+ *
+ * @parameter expression="${jaxx.tocFileName}" default-value="${jaxx.helpSetName}TOC.xml"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String tocFileName;
+ /**
+ * The file name of the i18n java file to generate.
+ *
+ * @parameter expression="${jaxx.i8nFileName}" default-value="${jaxx.helpSetName}I18n.java"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected String i8nFileName;
+ /**
+ * The template used to generate helpset file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.helpSetTemplate}" default-value="/defaultHelpSet.hs.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File helpSetTemplate;
+ /**
+ * The template used to generate helpset map file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File mapTemplate;
+ /**
+ * The template used to generate helpset index file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File indexTemplate;
+ /**
+ * The template used to generate helpset toc file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File tocTemplate;
+ /**
+ * The template used to generate helpset content file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File contentTemplate;
+ /**
+ * The template used to generate helpset content file.
+ *
+ * Must be an existing file or a ressource in classp-ath
+ *
+ * @parameter expression="${jaxx.i18nTemplate}" default-value="/defaultI18n.java.vm"
+ * @required
+ *
+ * @since 1.3
+ */
+ protected File i18nTemplate;
+ /**
+ * The help ids discovered by Jaxx compilation
+ */
+ protected Properties helpIds;
+ private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
+
+ @Override
+ public void init() throws Exception {
+
+ if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) {
+ // nothing to be done for this type of packaging
+ skip = true;
+ getLog().info("skip generate goal for packaging " + project.getPackaging());
+ return;
+ }
+
+ if (!helpIdStore.exists()) {
+ skip = true;
+ getLog().info("no helpIdStore to react at " + helpIdStore);
+ return;
+ }
+
+ // check there is some bundle
+ if (locale == null) {
+ throw new MojoFailureException("you must set the bundles property.");
+ }
+ // check there is some bundle
+ if (target == null) {
+ throw new MojoFailureException("you must set the target property.");
+ }
+ // check ressources
+ checkResource(helpSetTemplate);
+ checkResource(mapTemplate);
+ checkResource(indexTemplate);
+ checkResource(tocTemplate);
+ checkResource(contentTemplate);
+
+ if (!target.exists()) {
+ getLog().info("mkdir " + target);
+ target.mkdirs();
+ }
+
+
+ helpIds = new SortedProperties();
+
+ InputStream stream = new FileInputStream(helpIdStore);
+
+ helpIds.load(stream);
+
+ stream.close();
+
+ if (helpIds.isEmpty()) {
+
+ // no ids detected
+ getLog().warn("no helpIds detected, will skip.");
+ skip = true;
+ return;
+ }
+
+ skip = false;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ if (i18nable) {
+
+ List<URL> lUrls = new java.util.ArrayList<URL>();
+ List resources = project.getResources();
+ for (Object o : resources) {
+ Resource resource = (Resource) o;
+ lUrls.add(new File(resource.getDirectory()).toURI().toURL());
+ }
+ I18n.setExtraURL(lUrls.toArray(new URL[lUrls.size()]));
+ I18n.init(locale, null);
+ }
+
+ File file;
+
+ Properties env = new Properties();
+
+ env.put("helpSetName", helpSetName);
+ env.put("helpSetFileName", helpsetFileName);
+ env.put("mapFileName", mapFileName);
+ env.put("indexFileName", indexFileName);
+ env.put("tocFileName", tocFileName);
+ env.put("separator", " ");
+ env.put("autoremoveLine", AUTOREMOVE_LINE);
+
+
+ int touchedFiles = 0;
+
+ // ---------------------------------------------------------------
+ // --- main helpset file -----------------------------------------
+ // ---------------------------------------------------------------
+
+
+ file = new File(target, helpsetFileName);
+
+ boolean doCreate = generateHelSetFile(file, env);
+
+ if (doCreate) {
+ touchedFiles++;
+ }
+
+ // ---------------------------------------------------------------
+ // --- helpset map file ------------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(target, mapFileName);
+
+ Properties mergedHelpIds = generateMapFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset index file ----------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(target, indexFileName);
+
+ NodeItem indexRootItem = generateIndexFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset toc file ------------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(target, tocFileName);
+
+ NodeItem tocRootItem = generateTocFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset content files -------------------------------------
+ // ---------------------------------------------------------------
+
+ TemplateGenerator gen = prepareGenerator(contentTemplate);
+
+ Enumeration keys = helpIds.keys();
+
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ String url = (String) helpIds.get(key);
+ url = helpSetName + File.separator + url;
+
+ File f = new File(target, url);
+
+ boolean exist = f.exists();
+
+ if (exist) {
+ // check if there is a autoremoveLine in content
+ String content = FileUtil.readAsString(f);
+ if (!content.contains(AUTOREMOVE_LINE)) {
+ // no regenerate marker detected, so skip this file
+ if (verbose) {
+ getLog().debug("skip existing file " + f);
+ }
+ continue;
+ }
+ }
+
+ f.getParentFile().mkdirs();
+
+ if (verbose) {
+ if (exist) {
+ getLog().info("regenerate content file " + f);
+ } else {
+ getLog().info("generate content file " + f);
+ }
+ }
+
+ env.put("helpId", key);
+ String i18n = helpsetI18nPrefix + key + helpsetTitleI18nSuffix;
+ env.put("helpIdTitle", _(i18n));
+ env.put("helpIdUrl", url);
+
+ gen.generate(env, f);
+ touchedFiles++;
+ }
+
+ // ---------------------------------------------------------------
+ // --- i18n file -------------------------------------------------
+ // ---------------------------------------------------------------
+
+ String path = packageName.replaceAll("\\.", File.separator);
+ path += File.separator + i8nFileName;
+ file = new File(outJava, path);
+ generateI18nFile(file, env, mergedHelpIds, indexRootItem, tocRootItem);
+ touchedFiles++;
+
+ getLog().info(touchedFiles + " file(s) treated.");
+ }
+
+ protected void generateI18nFile(File file, Properties env, Properties mergedHelpIds, NodeItem indexRootItem, NodeItem tocRootItem) throws Exception {
+
+ boolean create = !file.exists();
+
+ if (!file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ }
+
+ Set<String> keys = new java.util.HashSet<String>();
+
+ for (Object k : mergedHelpIds.keySet()) {
+ String key = helpsetI18nPrefix + k + helpsetTitleI18nSuffix;
+ keys.add(key);
+ }
+ indexRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetIndexI18nSuffix);
+ tocRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetTocI18nSuffix);
+
+ env.put("keys", keys);
+ env.put("packageName", packageName);
+ String className = file.getName();
+ int index = className.lastIndexOf(".");
+ className = className.substring(0, index);
+ env.put("className", className);
+
+ if (verbose) {
+ if (create) {
+ getLog().info("generate i18n java file " + file);
+ } else {
+ getLog().info("udpate i18n java file " + file);
+ }
+ }
+
+ doGen(i18nTemplate, file, env);
+
+ }
+
+ protected boolean generateHelSetFile(File file, Properties env) throws Exception {
+
+ if (file.exists()) {
+ // check the auto removeline presence
+ String content = FileUtil.readAsString(file);
+ if (!content.contains(AUTOREMOVE_LINE)) {
+ // no regenerate marker detected, so skip this file
+ if (verbose) {
+ getLog().info("skip existing helpset main file " + file);
+ }
+ return false;
+ }
+ }
+
+ if (verbose) {
+ if (file.exists()) {
+ getLog().info("regenerate helpset main file " + file);
+ } else {
+ getLog().info("generate helpset main file " + file);
+ }
+ }
+ doGen(helpSetTemplate, file, env);
+ return true;
+ }
+
+ protected Properties generateMapFile(File file, Properties env) throws Exception {
+
+ boolean create;
+
+ Properties mergedHelpIds = null;
+ if (file.exists()) {
+
+ // get back the exisiting data and merge it with incoming ones
+
+ if (verbose) {
+ getLog().info("loading existing helpset map file " + file);
+ }
+
+ mergedHelpIds = getExistingHelpIds(file);
+ create = false;
+
+ } else {
+
+ mergedHelpIds = new SortedProperties();
+ create = true;
+ }
+
+ // inject new helpIds
+
+ for (Object k : helpIds.keySet()) {
+ mergedHelpIds.put(k, helpSetName + "/" + helpIds.get(k));
+ }
+
+ if (!mergedHelpIds.contains("top")) {
+ // on ajoute une entree vers le root du helpset
+
+ String topUrl = helpSetName + ".html";
+ helpIds.put("top", topUrl);
+ mergedHelpIds.put("top", helpSetName + "/" + topUrl);
+ if (verbose) {
+ getLog().debug("add top entry with url " + topUrl);
+ }
+ }
+
+ if (verbose) {
+ if (create) {
+ getLog().info("generate helpset map file " + file);
+ } else {
+ getLog().info("udpate helpset map file " + file);
+ }
+ }
+
+ env.put("helpIds", mergedHelpIds);
+ doGen(mapTemplate, file, env);
+ env.remove("helpIds");
+ return mergedHelpIds;
+ }
+
+ protected NodeItem generateIndexFile(File file, Properties env) throws Exception {
+ NodeItem rootItem = null;
+
+ boolean create;
+
+ if (file.exists()) {
+
+ create = false;
+
+ rootItem = getExistingItems("indexitem", file);
+ } else {
+ create = true;
+ }
+
+ if (rootItem == null) {
+ rootItem = new NodeItem("top", helpSetName);
+ }
+
+ // inject new index entries
+
+ for (Object k : helpIds.keySet()) {
+ NodeItem toc = rootItem.findChild(k + "");
+ if (verbose) {
+ getLog().debug("index " + k + " : " + toc);
+ }
+ }
+
+ //String prefix = helpsetI18nPrefix;
+ //String prefix = helpsetI18nPrefix + helpSetName + ".";
+ rootItem.applyI18n(helpsetI18nPrefix, helpsetIndexI18nSuffix);
+
+ if (verbose) {
+ if (create) {
+ getLog().info("generate helpset index file " + file);
+ } else {
+ getLog().info("udpate helpset index file " + file);
+ }
+ }
+
+ env.put("rootItem", rootItem);
+ doGen(indexTemplate, file, env);
+ env.remove("rootItem");
+ return rootItem;
+ }
+
+ protected NodeItem generateTocFile(File file, Properties env) throws Exception {
+ NodeItem rootItem = null;
+
+ boolean create;
+
+ if (file.exists()) {
+
+ create = false;
+
+ rootItem = getExistingItems("tocitem", file);
+ } else {
+ create = true;
+ }
+
+ if (rootItem == null) {
+ rootItem = new NodeItem("top", helpSetName);
+ }
+ // inject new toc entries
+
+ for (Object k : helpIds.keySet()) {
+ NodeItem toc = rootItem.findChild(k + "");
+ if (verbose) {
+ getLog().debug("toc " + k + " : " + toc);
+ }
+ }
+
+ //String prefix = helpsetI18nPrefix + helpSetName + ".";
+ rootItem.applyI18n(helpsetI18nPrefix, helpsetTocI18nSuffix);
+
+ if (verbose) {
+ if (create) {
+ getLog().info("generate helpset toc file " + file);
+ } else {
+ getLog().info("udpate helpset toc file " + file);
+ }
+ }
+
+ env.put("rootItem", rootItem);
+ doGen(tocTemplate, file, env);
+ env.remove("rootItem");
+ return rootItem;
+ }
+
+ protected void doGen(File template, File f, Properties env) throws Exception {
+ TemplateGenerator gen = prepareGenerator(template);
+ gen.generate(env, f);
+ }
+
+ protected TemplateGenerator prepareGenerator(File template) throws Exception {
+ URL templateURL = getTemplate(template);
+
+ if (verbose) {
+ getLog().info("using template " + templateURL);
+ }
+ TemplateGenerator gen = new TemplateGenerator(project, templateURL);
+ return gen;
+ }
+
+ protected URL getTemplate(File f) throws IOException {
+ URL r = null;
+ InputStream s = null;
+ if (f.exists()) {
+ r = f.toURI().toURL();
+ } else {
+ r = getClass().getResource(f.toString());
+ }
+ return r;
+ }
+
+ protected void checkResource(File f) throws MojoFailureException {
+ if (!f.exists()) {
+ // test in classPath
+ InputStream r = getClass().getResourceAsStream(f.toString());
+ if (r == null) {
+ throw new MojoFailureException("could not find ressource " + f);
+ }
+ }
+ }
+
+ protected Properties getExistingHelpIds(File file) throws SAXException, IOException {
+
+ final Properties result = new SortedProperties();
+
+ XMLReader parser = XMLReaderFactory.createXMLReader();
+
+ parser.setContentHandler(new ContentHandlerAdapter() {
+
+ String target;
+ String url;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ if ("mapID".equals(localName)) {
+ target = atts.getValue("target");
+ url = atts.getValue("url");
+ if (verbose) {
+ getLog().debug("detect map entry : " + target + " : " + url);
+ }
+ result.put(target, url);
+ }
+ }
+ });
+
+ InputStream s = new FileInputStream(file);
+ try {
+ parser.parse(new InputSource(s));
+ } finally {
+ s.close();
+ }
+ return result;
+ }
+
+ protected NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException {
+
+ XMLReader parser = XMLReaderFactory.createXMLReader();
+ NodeItemHandler handler = new NodeItemHandler(tagName);
+
+ parser.setContentHandler(handler);
+
+ NodeItem rootItem = null;
+ InputStream s = new FileInputStream(file);
+ try {
+ parser.parse(new InputSource(s));
+ rootItem = handler.rootItem;
+ } finally {
+ s.close();
+ }
+ return rootItem;
+ }
+
+ static class NodeItemHandler extends ContentHandlerAdapter {
+
+ NodeItem rootItem;
+ NodeItem currentItem;
+ final Stack<NodeItem> stack;
+ final String tagName;
+
+ public NodeItemHandler(String tagName) {
+ this.tagName = tagName;
+ this.stack = new Stack<NodeItem>();
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ rootItem = new NodeItem("top", null);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ if (tagName.equals(localName)) {
+
+ String target = atts.getValue("target");
+ String text = atts.getValue("text");
+
+ // debut d'un item
+ if (currentItem == null) {
+ // premier item
+ if (rootItem.getTarget().equals(target)) {
+ // le premier item est bien top
+ //rootItem.setText(text);
+ currentItem = rootItem;
+ } else {
+ // le premier noeud n'est pas top
+ // en l'encapsule
+ stack.push(rootItem);
+ currentItem = new NodeItem(target, text);
+ rootItem.addChild(currentItem);
+ }
+ } else {
+ NodeItem newItem = new NodeItem(target, text);
+ currentItem.addChild(newItem);
+ currentItem = newItem;
+ }
+ currentItem.adjustTarget();
+ stack.push(currentItem);
+
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ if (tagName.equals(localName)) {
+ // fin d'un item
+ stack.pop();
+ if (!stack.isEmpty()) {
+ currentItem = stack.peek();
+ }
+ }
+ }
+ }
+
+ static class ContentHandlerAdapter implements ContentHandler {
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ }
+
+ @Override
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ }
+
+ @Override
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ }
+
+ @Override
+ public void processingInstruction(String target, String data) throws SAXException {
+ }
+
+ @Override
+ public void skippedEntity(String name) throws SAXException {
+ }
+ }
+}
\ No newline at end of file
Deleted: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,137 +0,0 @@
-package org.codelutin.jaxx;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import static org.codelutin.i18n.I18n._;
-
-public class NodeItem {
-
- String absoluteTarget;
- private String target;
- private String text;
- private List<NodeItem> childs;
-
- public NodeItem(String target, String text) {
- this.target = target;
- this.absoluteTarget = target;
-
- this.text = text;
- }
-
- public String getTarget() {
- return target;
- }
-
- public String getAbsoluteTarget() {
- return absoluteTarget;
- }
-
- public String getText() {
- return text;
- }
-
- public List<NodeItem> getChilds() {
- return childs;
- }
-
- public NodeItem findChild(String path) {
- NodeItem result = null;
- String[] paths = path.split("\\.");
- for (int i = 0, j = paths.length; i < j; i++) {
- String p = paths[i];
- if (result == null) {
-
- // first node
- if (target.equals(p)) {
- result = this;
- continue;
- }
- result = getChild(p);
- if (result == null) {
- result = new NodeItem(p, null);
- addChild(result);
- adjutsAbsoluteTarget(result);
- }
- continue;
- }
- NodeItem child = result.getChild(p);
- if (child == null) {
- child = new NodeItem(p, null);
- result.addChild(child);
- result.adjutsAbsoluteTarget(child);
- result = child;
- } else {
- result = child;
- }
- }
- return result;
- }
-
- public NodeItem getChild(int index) {
- return childs.get(index);
- }
-
- public NodeItem getChild(String target) {
- if (isLeaf()) {
- return null;
- }
- for (NodeItem i : childs) {
- if (i.target.equals(target)) {
- return i;
- }
- }
- return null;
- }
-
- public void addChild(NodeItem child) {
- if (childs == null) {
- childs = new ArrayList<NodeItem>();
- }
-
- childs.add(child);
- }
-
- public void adjutsAbsoluteTarget(NodeItem child) {
- if (!"top".equals(target)) {
- // on ne prefixe pas les fils direct du root
- child.absoluteTarget = absoluteTarget + "." + child.target;
- }
- }
-
- public void adjustTarget() {
- int index = target.lastIndexOf(".");
- if (index > -1) {
- target = target.substring(index + 1);
- }
- }
-
- public boolean isLeaf() {
- return childs == null || childs.isEmpty();
- }
-
- public void applyI18n(String prefix, String suffix) {
- String key = prefix + getAbsoluteTarget() + suffix;
- text = _(key);
- if (!isLeaf()) {
- for (NodeItem i : getChilds()) {
- i.applyI18n(prefix, suffix);
- }
- }
- }
-
- public void extractI18n(Set<String> keys, String prefix, String suffix) {
- String key = prefix + getAbsoluteTarget() + suffix;
- keys.add(key);
- if (!isLeaf()) {
- for (NodeItem i : getChilds()) {
- i.extractI18n(keys, prefix, suffix);
- }
- }
- }
-
- @Override
- public String toString() {
- return super.toString() + "<target:" + target + ", text:" + text + ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">";
- }
-}
Copied: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java (from rev 1406, jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java)
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/NodeItem.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,137 @@
+package org.nuiton.jaxx;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import static org.nuiton.i18n.I18n._;
+
+public class NodeItem {
+
+ String absoluteTarget;
+ private String target;
+ private String text;
+ private List<NodeItem> childs;
+
+ public NodeItem(String target, String text) {
+ this.target = target;
+ this.absoluteTarget = target;
+
+ this.text = text;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public String getAbsoluteTarget() {
+ return absoluteTarget;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public List<NodeItem> getChilds() {
+ return childs;
+ }
+
+ public NodeItem findChild(String path) {
+ NodeItem result = null;
+ String[] paths = path.split("\\.");
+ for (int i = 0, j = paths.length; i < j; i++) {
+ String p = paths[i];
+ if (result == null) {
+
+ // first node
+ if (target.equals(p)) {
+ result = this;
+ continue;
+ }
+ result = getChild(p);
+ if (result == null) {
+ result = new NodeItem(p, null);
+ addChild(result);
+ adjutsAbsoluteTarget(result);
+ }
+ continue;
+ }
+ NodeItem child = result.getChild(p);
+ if (child == null) {
+ child = new NodeItem(p, null);
+ result.addChild(child);
+ result.adjutsAbsoluteTarget(child);
+ result = child;
+ } else {
+ result = child;
+ }
+ }
+ return result;
+ }
+
+ public NodeItem getChild(int index) {
+ return childs.get(index);
+ }
+
+ public NodeItem getChild(String target) {
+ if (isLeaf()) {
+ return null;
+ }
+ for (NodeItem i : childs) {
+ if (i.target.equals(target)) {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ public void addChild(NodeItem child) {
+ if (childs == null) {
+ childs = new ArrayList<NodeItem>();
+ }
+
+ childs.add(child);
+ }
+
+ public void adjutsAbsoluteTarget(NodeItem child) {
+ if (!"top".equals(target)) {
+ // on ne prefixe pas les fils direct du root
+ child.absoluteTarget = absoluteTarget + "." + child.target;
+ }
+ }
+
+ public void adjustTarget() {
+ int index = target.lastIndexOf(".");
+ if (index > -1) {
+ target = target.substring(index + 1);
+ }
+ }
+
+ public boolean isLeaf() {
+ return childs == null || childs.isEmpty();
+ }
+
+ public void applyI18n(String prefix, String suffix) {
+ String key = prefix + getAbsoluteTarget() + suffix;
+ text = _(key);
+ if (!isLeaf()) {
+ for (NodeItem i : getChilds()) {
+ i.applyI18n(prefix, suffix);
+ }
+ }
+ }
+
+ public void extractI18n(Set<String> keys, String prefix, String suffix) {
+ String key = prefix + getAbsoluteTarget() + suffix;
+ keys.add(key);
+ if (!isLeaf()) {
+ for (NodeItem i : getChilds()) {
+ i.extractI18n(keys, prefix, suffix);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<target:" + target + ", text:" + text + ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">";
+ }
+}
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/TemplateGenerator.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/TemplateGenerator.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/TemplateGenerator.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
import java.io.File;
import java.io.FileWriter;
Copied: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton (from rev 1405, jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin)
Property changes on: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1722Test.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/Bug1722Test.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1722Test.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
/** @author chemit */
public class Bug1722Test extends JaxxBaseTest {
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1750Test.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/Bug1750Test.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1750Test.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
import jaxx.Base64Coder;
import jaxx.compiler.JAXXCompiler;
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1751Test.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/Bug1751Test.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/Bug1751Test.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
/** @author chemit */
public class Bug1751Test extends JaxxBaseTest {
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXCompilerLaunchor;
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerValidatorTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerValidatorTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/CompilerValidatorTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
import jaxx.compiler.JAXXCompilerLaunchor;
import org.apache.maven.plugin.MojoExecutionException;
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/DecoratorTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/DecoratorTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
public class DecoratorTest extends JaxxBaseTest {
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/I18nTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/I18nTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/I18nTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
public class I18nTest extends JaxxBaseTest {
Deleted: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,85 +0,0 @@
-package org.codelutin.jaxx;
-
-import jaxx.runtime.DefaultJAXXContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codelutin.util.FileUtil;
-
-import java.io.File;
-import java.io.IOException;
-
-/** @author chemit */
-public abstract class JaxxBaseTest extends AbstractMojoTestCase {
-
- protected static final String DEFALUT_PREFIX = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testcases" + File.separator;
-
- /** log */
- protected Log log;
-
- protected JaxxGeneratorMojo mojo;
-
- protected File pomFile;
-
- public String getPrefix() {
- return DEFALUT_PREFIX;
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- getLog().info(getName());
- pomFile = getPomFile();
- mojo = (JaxxGeneratorMojo) lookupMojo("generate", pomFile);
- mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName();
- mojo.compilerFQN = jaxx.compiler.SwingCompiler.class.getName();
- mojo.validatorFQN = jaxx.runtime.validator.swing.SwingValidator.class.getName();
- mojo.defaultDecoratorFQN = jaxx.compiler.DefaultCompiledObjectDecorator.class.getName();
- assertNotNull(mojo);
- }
-
- protected File getPomFile() {
- return new File(getBasedir(), getPrefix() + getName().substring(4) + ".xml");
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- if (mojo != null) {
- mojo = null;
- }
- if (pomFile != null) {
- pomFile = null;
- }
- }
-
- protected void checkPattern(JaxxGeneratorMojo mojo, String pattern, boolean required, String... files) throws IOException {
- if (files.length == 0) {
- files = mojo.files;
- }
- for (String file : files) {
- // check we have a the required/forbidden pattern
- File f = new File(mojo.outJava, file.substring(0, file.length() - 4) + "java");
- if (mojo.verbose) {
- getLog().info("check generated file " + f);
- }
-
- assertTrue("generated file " + f + " was not found...", f.exists());
- String content = FileUtil.readAsString(f);
-
- String errorMessage = required ? "could not find the pattern : " : "should not have found pattern :";
- assertEquals(errorMessage + pattern + " in file " + f, required, content.contains(pattern));
- }
- }
-
- protected Log getLog() {
- if (log == null) {
- log = LogFactory.getLog(getClass());
- }
- return log;
- }
-
- protected void assertNumberJaxxFiles(int expectedNbFiles) {
- assertEquals(expectedNbFiles, mojo.files.length);
- }
-}
Copied: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java (from rev 1406, jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java)
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/JaxxBaseTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -0,0 +1,85 @@
+package org.nuiton.jaxx;
+
+import jaxx.runtime.DefaultJAXXContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.nuiton.util.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+
+/** @author chemit */
+public abstract class JaxxBaseTest extends AbstractMojoTestCase {
+
+ protected static final String DEFALUT_PREFIX = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "testcases" + File.separator;
+
+ /** log */
+ protected Log log;
+
+ protected JaxxGeneratorMojo mojo;
+
+ protected File pomFile;
+
+ public String getPrefix() {
+ return DEFALUT_PREFIX;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ getLog().info(getName());
+ pomFile = getPomFile();
+ mojo = (JaxxGeneratorMojo) lookupMojo("generate", pomFile);
+ mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName();
+ mojo.compilerFQN = jaxx.compiler.SwingCompiler.class.getName();
+ mojo.validatorFQN = jaxx.runtime.validator.swing.SwingValidator.class.getName();
+ mojo.defaultDecoratorFQN = jaxx.compiler.DefaultCompiledObjectDecorator.class.getName();
+ assertNotNull(mojo);
+ }
+
+ protected File getPomFile() {
+ return new File(getBasedir(), getPrefix() + getName().substring(4) + ".xml");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (mojo != null) {
+ mojo = null;
+ }
+ if (pomFile != null) {
+ pomFile = null;
+ }
+ }
+
+ protected void checkPattern(JaxxGeneratorMojo mojo, String pattern, boolean required, String... files) throws IOException {
+ if (files.length == 0) {
+ files = mojo.files;
+ }
+ for (String file : files) {
+ // check we have a the required/forbidden pattern
+ File f = new File(mojo.outJava, file.substring(0, file.length() - 4) + "java");
+ if (mojo.verbose) {
+ getLog().info("check generated file " + f);
+ }
+
+ assertTrue("generated file " + f + " was not found...", f.exists());
+ String content = FileUtil.readAsString(f);
+
+ String errorMessage = required ? "could not find the pattern : " : "should not have found pattern :";
+ assertEquals(errorMessage + pattern + " in file " + f, required, content.contains(pattern));
+ }
+ }
+
+ protected Log getLog() {
+ if (log == null) {
+ log = LogFactory.getLog(getClass());
+ }
+ return log;
+ }
+
+ protected void assertNumberJaxxFiles(int expectedNbFiles) {
+ assertEquals(expectedNbFiles, mojo.files.length);
+ }
+}
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/NodeItemTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/NodeItemTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/NodeItemTest.java 2009-05-16 02:03:26 UTC (rev 1408)
@@ -1,4 +1,4 @@
-package org.codelutin.jaxx;
+package org.nuiton.jaxx;
import org.junit.Assert;
import org.junit.Test;
1
0
r1407 - in jaxx/trunk: jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 16, 2009
by tchemit@users.labs.libre-entreprise.org May 16, 2009
May 16, 2009
Author: tchemit
Date: 2009-05-16 01:37:48 +0000 (Sat, 16 May 2009)
New Revision: 1407
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
Log:
fix scm level
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -45,6 +45,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -51,6 +51,9 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -63,6 +63,11 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -58,6 +58,8 @@
<properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+
<maven.jar.main.class>jaxx.demo.JAXXDemo</maven.jar.main.class>
<jaxx.addProjectClassPath>true</jaxx.addProjectClassPath>
@@ -70,6 +72,7 @@
<jnlp.build.directory>${project.build.directory}/jnlp</jnlp.build.directory>
+
</properties>
<build>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -63,6 +63,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -45,6 +45,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -51,6 +51,10 @@
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<build>
<resources>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -52,6 +52,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<build>
<plugins>
<plugin>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -50,6 +50,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<build>
<plugins>
<plugin>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -50,6 +50,10 @@
<!-- ************************************************************* -->
<packaging>jar</packaging>
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<build>
<pluginManagement>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-16 01:37:48 UTC (rev 1407)
@@ -126,6 +126,11 @@
<!-- ************************************************************* -->
<packaging>maven-plugin</packaging>
+
+ <properties>
+ <helper.scmModuleLevel>1</helper.scmModuleLevel>
+ </properties>
+
<build>
<plugins>
1
0
r1406 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-api/src/main/java/jaxx/compiler jaxx-compiler-api/src/site/rst jaxx-compiler-swing jaxx-compiler-swing/src/main/java/jaxx/compiler jaxx-compiler-validator jaxx-example jaxx-example/src/main/java/jaxx/demo jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing/src/main/java/jaxx/runtime/swing jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation jaxx-runtime-swing-widget jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing
by tchemit@users.labs.libre-entreprise.org May 16, 2009
by tchemit@users.labs.libre-entreprise.org May 16, 2009
May 16, 2009
Author: tchemit
Date: 2009-05-16 01:23:55 +0000 (Sat, 16 May 2009)
New Revision: 1406
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/I18nHelper.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXProfile.java
jaxx/trunk/jaxx-compiler-api/src/site/rst/I18n.rst
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/SwingCompiler.java
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java
jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java
jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidator.java
jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorField.java
jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java
jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java
jaxx/trunk/pom.xml
jaxx/trunk/src/site/rst/I18n.rst
Log:
migrate to nuiton
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-compiler-api</artifactId>
<dependencies>
@@ -26,6 +26,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -43,9 +48,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-api</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-api</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/I18nHelper.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/I18nHelper.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/I18nHelper.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,7 +8,7 @@
import java.util.List;
/**
- * I18n methods to add {@link org.codelutin.i18n.I18n#_(String, Object[])} method on some attributes.
+ * I18n methods to add {@link org.nuiton.i18n.I18n#_(String, Object[])} method on some attributes.
* <p/>
* Make sure to set an i18nable compiler to have his {@link CompilerOptions#isI18nable()} returning true.
*
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXProfile.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXProfile.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXProfile.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -6,7 +6,7 @@
import java.util.Map.Entry;
import java.util.SortedMap;
import jaxx.compiler.JAXXCompilerLaunchor.LifeCycle;
-import org.codelutin.util.StringUtil;
+import org.nuiton.util.StringUtil;
/**
* Pour profiler les temps d'execution pendant une compilation.
Modified: jaxx/trunk/jaxx-compiler-api/src/site/rst/I18n.rst
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/site/rst/I18n.rst 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-api/src/site/rst/I18n.rst 2009-05-16 01:23:55 UTC (rev 1406)
@@ -28,7 +28,7 @@
::
- org.codelutin.i18n.I18n._(String)
+ org.nuiton.i18n.I18n._(String)
La liste des attributs en question sont les suivants :
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-compiler-swing</artifactId>
<dependencies>
@@ -32,6 +32,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -49,9 +54,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/SwingCompiler.java
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/SwingCompiler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/SwingCompiler.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -36,7 +36,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "static org.codelutin.i18n.I18n._",
+ "static org.nuiton.i18n.I18n._",
"static jaxx.runtime.Util.createImageIcon");
@@ -66,7 +66,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "static org.codelutin.i18n.I18n._",
+ "static org.nuiton.i18n.I18n._",
"static jaxx.runtime.Util.createImageIcon");
}
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-compiler-validator</artifactId>
<dependencies>
@@ -44,6 +44,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -61,9 +66,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-validator</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-validator</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-example</artifactId>
<dependencies>
@@ -36,6 +36,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -106,7 +111,7 @@
<plugins>
<plugin>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<version>${project.version}</version>
<executions>
@@ -119,7 +124,7 @@
</plugin>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
<entries>
@@ -155,12 +160,6 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-example</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-example</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
-
<profiles>
<!-- by default jnlp is only perform on a release stage when using the maven-release-plugin -->
<profile>
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-05-16 01:23:55 UTC (rev 1406)
@@ -2,7 +2,7 @@
<script><![CDATA[
static {
-org.codelutin.i18n.I18n.init("fr", "FR");
+org.nuiton.i18n.I18n.init("fr", "FR");
}
void $afterCompleteSetup() {
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx 2009-05-16 01:23:55 UTC (rev 1406)
@@ -2,7 +2,7 @@
<style source="Validation.css"/>
<script><![CDATA[
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.n_;
void $afterCompleteSetup() {
}]]>
</script>
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx 2009-05-16 01:23:55 UTC (rev 1406)
@@ -29,7 +29,7 @@
</BeanValidator>
<script><![CDATA[
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.n_;
import jaxx.runtime.SwingUtil;
void $afterCompleteSetup() {
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,19 +8,19 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime-api</artifactId>
<dependencies>
<dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
</dependency>
<dependency>
@@ -44,6 +44,11 @@
<artifactId>commons-jxpath</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -61,9 +66,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime-swing</artifactId>
<dependencies>
@@ -26,6 +26,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -43,9 +48,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -1,6 +1,6 @@
package jaxx.runtime.swing;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.JComponent;
import javax.swing.JTable;
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -1,6 +1,6 @@
package jaxx.runtime.swing;
-import org.codelutin.util.EnumEditor;
+import org.nuiton.util.EnumEditor;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -5,7 +5,7 @@
import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.StringUtil;
+import org.nuiton.util.StringUtil;
import javax.swing.JTree;
import javax.swing.UIManager;
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -5,7 +5,7 @@
import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import java.lang.reflect.InvocationTargetException;
import java.util.regex.Pattern;
@@ -89,7 +89,7 @@
protected String libelle;
- protected Decorator decorator;
+ protected Decorator<?> decorator;
protected NavigationTreeNode node;
@@ -104,7 +104,7 @@
this.internalClass = String.class;
}
- public NodeRenderer(Decorator decorator) {
+ public NodeRenderer(Decorator<?> decorator) {
this.decorator = decorator;
this.internalClass = decorator.getInternalClass();
}
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime-swing-widget</artifactId>
<dependencies>
@@ -71,7 +71,7 @@
<plugins>
<plugin>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<version>${project.version}</version>
<executions>
@@ -84,7 +84,7 @@
</plugin>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
<entries>
@@ -113,10 +113,4 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing-widget</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing-widget</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
-
</project>
\ No newline at end of file
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2009-05-16 01:23:55 UTC (rev 1406)
@@ -54,7 +54,7 @@
</JPopupMenu>
<script><![CDATA[
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.n_;
public static final String DEFAULT_POPUP_LABEL = n_("entitycombobox.popup.label");
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,8 +8,8 @@
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import javax.swing.JPopupMenu;
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime-validator</artifactId>
<dependencies>
@@ -33,6 +33,11 @@
<artifactId>xwork</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -50,7 +55,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<executions>
<execution>
@@ -66,9 +71,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidator.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidator.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidator.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -6,7 +6,7 @@
import org.apache.commons.beanutils.Converter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.ConverterUtil;
+import org.nuiton.util.ConverterUtil;
import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
Modified: jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorField.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorField.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorField.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -1,6 +1,6 @@
package jaxx.runtime.validator;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.event.EventListenerList;
import java.util.ArrayList;
Modified: jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -1,6 +1,6 @@
package jaxx.runtime.validator;
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.n_;
/**
* The differents levels of messages in validation process.
Modified: jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -7,7 +7,7 @@
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.codelutin.util.ConverterUtil;
+import org.nuiton.util.ConverterUtil;
/**
* Extends {@link FieldExpressionValidator} to add some extra parameters available
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime-validator-swing</artifactId>
<dependencies>
@@ -31,6 +31,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -48,7 +53,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<executions>
<execution>
@@ -64,9 +69,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
+
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -15,7 +15,7 @@
import jaxx.runtime.validator.swing.SwingValidatorMessageListMouseListener;
import jaxx.runtime.validator.swing.SwingValidatorMessage;
import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import static org.codelutin.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.n_;
/**
* The helper class for validation module.
Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -7,7 +7,7 @@
import javax.swing.DefaultListCellRenderer;
import jaxx.runtime.validator.BeanValidatorScope;
import jaxx.runtime.SwingValidatorUtil;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
/**
* A simple render of a table of validator's messages, says a table that use
Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -7,7 +7,7 @@
import java.awt.Component;
import jaxx.runtime.validator.BeanValidatorScope;
import jaxx.runtime.SwingValidatorUtil;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
/**
* A simple render of a table of validator's messages, says a table that use
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -9,12 +9,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-swing-action</artifactId>
<dependencies>
@@ -31,6 +31,11 @@
<version>3.7.ga</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -62,7 +67,7 @@
<plugins>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<executions>
<execution>
@@ -80,10 +85,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-swing-action</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-swing-action</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
- </scm>
-
+
</project>
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -21,6 +21,8 @@
* <p/>
* The class implements the logic of research of the configuration annotation.
*
+ * @param <A> type of annotation
+ * @param <C> type of component
* @author chemit
*/
public abstract class AbstractActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> implements ActionConfigurationResolver<A, C> {
@@ -45,6 +47,7 @@
this.componentImpl = componentImpl;
}
+ @Override
public A resolveConfiguration(MyAbstractAction action) {
if (action.hasDelegate()) {
return resolveConfiguration(action.getDelegate());
@@ -53,17 +56,21 @@
}
@SuppressWarnings({"unchecked"})
+ @Override
public A applyConfiguration(JComponent component, MyAbstractAction action) {
- if (component != null && componentImpl.isAssignableFrom(component.getClass()))
+ if (component != null && componentImpl.isAssignableFrom(component.getClass())) {
return applyConfiguration0((C) component, action);
+ }
return null;
}
+ @Override
public Class<A> getAnnotationImpl() {
return annotationImpl;
}
+ @Override
public Class<C> getComponentImpl() {
return componentImpl;
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -22,7 +22,7 @@
import javassist.CtConstructor;
import javassist.LoaderClassPath;
import javassist.NotFoundException;
-import org.codelutin.util.SortedProperties;
+import org.nuiton.util.SortedProperties;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
@@ -247,8 +247,9 @@
outputStream.write(byteCode);
} finally {
- if (outputStream != null)
+ if (outputStream != null) {
outputStream.close();
+ }
}
}
@@ -262,8 +263,9 @@
w.append("#").append(new java.util.Date().toString()).append("\n").toString();
w.append(providerFQN);
} finally {
- if (w != null)
+ if (w != null) {
w.close();
+ }
}
}
@@ -286,8 +288,9 @@
w = new BufferedWriter(fo.openWriter());
actions.store(w, "generated by " + getClass().getName());
} finally {
- if (w != null)
+ if (w != null) {
w.close();
+ }
}
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -14,7 +14,7 @@
*/
package org.codelutin.jaxx.action;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.AbstractButton;
import javax.swing.Action;
@@ -30,6 +30,7 @@
super(ActionConfig.class, AbstractButton.class);
}
+ @Override
protected ActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
ActionConfig anno = resolveConfiguration(action);
if (anno == null) {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -26,6 +26,8 @@
* Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
* of the component type is given by the {@link C} class.
*
+ * @param <A> type of annotation for config
+ * @param <C> type of component
* @author chemit
*/
public interface ActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -42,6 +42,7 @@
* <p/>
* Finally, a {@link #dispose()} method is there to shut down all instanciated action when you want to dispose all uis.
*
+ * @param <A> type of boxed action
* @author chemit
* @see ActionProvider
* @see MyAbstractAction
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -21,7 +21,7 @@
import jaxx.runtime.swing.JAXXToggleButton;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.Resource;
+import org.nuiton.util.Resource;
import javax.swing.AbstractButton;
import javax.swing.Action;
@@ -52,6 +52,7 @@
* le fqn' is a classe of type {@link org.codelutin.jaxx.action.ActionNameProvider} which gives us at
* runtime the names of each entry to put in cache for the givne action fqn.
*
+ * @param <A> the type of action
* @author chemit
*/
public class ActionFactoryFromProvider<A extends MyAbstractAction> implements ActionFactory<A> {
@@ -88,10 +89,12 @@
this.selectActionConfigInitializer = registerInitializer(SelectActionConfigConfigurationResolver.class);
}
+ @Override
public Class<A> getBaseClass() {
return baseImpl;
}
+ @Override
public void resetCache() {
cache.clear();
}
@@ -100,6 +103,7 @@
return cache.get(actionKey);
}*/
+ @Override
public void loadActions(JAXXObject ui) {
if (log.isDebugEnabled()) {
log.debug("for ui " + ui.getClass());
@@ -162,6 +166,7 @@
* @param component le button où rattacher l'action
* @return une nouvelle instance de l'action associée à sa clef.
*/
+ @Override
public A newAction(String actionKey, JComponent component) {
// try first in cache
A result = getActionFromCache(actionKey);
@@ -216,27 +221,33 @@
return result;
}
+ @Override
public A newAction(String actionKey) {
return newAction(actionKey, null);
}
+ @Override
public String[] getActionNames() {
return impls.keySet().toArray(new String[impls.size()]);
}
+ @Override
public Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet() {
return impls.entrySet();
}
+ @Override
public Set<Entry<String, A>> cacheEntrySet() {
return cache.entrySet();
}
+ @Override
public void fireAction(String actionKey, Object source, JComponent component) {
A action = newAction(actionKey, component);
fireAction0(actionKey, source, action);
}
+ @Override
public void fireAction(String actionKey, Object source) {
fireAction(actionKey, source, null);
}
@@ -245,6 +256,7 @@
* @param actionKey la clef de l'action
* @return l'action deja stockee dans le cache d'action, ou <code>null</code> si non trouvée.
*/
+ @Override
public A getActionFromCache(String actionKey) {
// on vérifie que l'action existe bien
checkRegistredAction(actionKey);
@@ -261,6 +273,7 @@
return action;
}
+ @Override
public void dispose() {
if (log.isInfoEnabled()) {
log.info(this);
@@ -426,7 +439,7 @@
* @param klass class to use to obtain classloader
* @return the fixed classloader
*/
- public static URLClassLoader fixClassLoader(Class klass) {
+ public static URLClassLoader fixClassLoader(Class<?> klass) {
ClassLoader l = klass.getClassLoader();
URLClassLoader cl;
if (!(l instanceof URLClassLoader)) {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -21,6 +21,7 @@
* {@link #getBaseClass()} and deliver some implementations of such actions indexed by their logical names via the
* method {#link #getClasses()}.
*
+ * @param <A> type of action boxed
* @author chemit
* @see MyAbstractAction
*/
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -16,7 +16,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import java.io.IOException;
import java.io.InputStream;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -16,7 +16,7 @@
import jaxx.runtime.JAXXObject;
import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -52,6 +52,7 @@
this.delegate = delegate;
}
+ @Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (hasDelegate()) {
// delegate to real action
@@ -129,11 +130,11 @@
}
protected boolean beforeAction(ActionEvent evt) throws Exception {
- boolean enabled = isEnabled();
- if (enabled && hasDelegate()) {
+ boolean canContinue = isEnabled();
+ if (canContinue && hasDelegate()) {
return delegate.beforeAction(evt);
}
- return enabled;
+ return canContinue;
}
protected void doAction(ActionEvent evt) throws Exception {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -14,7 +14,7 @@
*/
package org.codelutin.jaxx.action;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.Action;
import javax.swing.JComboBox;
@@ -30,6 +30,7 @@
super(SelectActionConfig.class, JComboBox.class);
}
+ @Override
protected SelectActionConfig applyConfiguration0(JComboBox component, MyAbstractAction action) {
SelectActionConfig anno = resolveConfiguration(action);
if (anno == null) {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -14,7 +14,7 @@
*/
package org.codelutin.jaxx.action;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import javax.swing.AbstractButton;
import javax.swing.Action;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -17,7 +17,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-/** @author chemit */
+/**
+ * @param <H> type of handler
+ * @author chemit */
public abstract class AbstractUIAction<H extends DialogUIHandler<?, ?>> extends javax.swing.AbstractAction {
protected static Log log = LogFactory.getLog(AbstractUIAction.class);
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -30,9 +30,10 @@
* <p/>
* TODO : make jaxx authorized implementing interface for root tag :)
*
+ * @param <H> type of handler
* @author chemit
*/
-public abstract class DialogUI<H extends DialogUIHandler> extends JDialog implements WindowListener {
+public abstract class DialogUI<H extends DialogUIHandler<?,?>> extends JDialog implements WindowListener {
protected static Log log = LogFactory.getLog(DialogUI.class);
@@ -90,24 +91,31 @@
return UIHelper.createActionIcon(name);
}
+ @Override
public void windowOpened(WindowEvent e) {
}
+ @Override
public void windowClosed(WindowEvent e) {
}
+ @Override
public void windowClosing(WindowEvent e) {
}
+ @Override
public void windowIconified(WindowEvent e) {
}
+ @Override
public void windowDeiconified(WindowEvent e) {
}
+ @Override
public void windowActivated(WindowEvent e) {
}
+ @Override
public void windowDeactivated(WindowEvent e) {
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -14,7 +14,7 @@
*/
package org.codelutin.jaxx.util;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -26,6 +26,9 @@
* <p/>
* The class contains also a shared instace of concrete ui.
*
+ * @param <M> type of model
+ * @param <U> type of ui
+ * @param <H> type of handler
* @author chemit
*/
public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
@@ -130,7 +133,7 @@
@Override
public boolean equals(Object o) {
- return this == o || o instanceof DialogUIDef && uiClass.equals(((DialogUIDef) o).uiClass);
+ return this == o || o instanceof DialogUIDef<?,?,?> && uiClass.equals(((DialogUIDef<?,?,?>) o).uiClass);
}
@Override
@@ -200,7 +203,7 @@
throw new IllegalStateException("no handler impl found in " + this);
}
try {
- Class[] prototype = getHandlerPrototype(params);
+ Class<?>[] prototype = getHandlerPrototype(params);
Object[] parameters = getHandlerParameters(ui, model, params);
H result = handlerClass.getConstructor(prototype).newInstance(parameters);
log.info(result);
@@ -218,7 +221,7 @@
return result;
}
- protected Class[] getHandlerPrototype(Object[] params) {
+ protected Class<?>[] getHandlerPrototype(Object[] params) {
int length = params.length;
for (Constructor<?> constructor : handlerClass.getConstructors()) {
Class<?>[] prototype = constructor.getParameterTypes();
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -23,9 +23,11 @@
/**
* DialogUI handler
*
+ * @param <M> type of model
+ * @param <U> type of ui
* @author chemit
*/
-public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler>> implements PropertyChangeListener {
+public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler<?,?>>> implements PropertyChangeListener {
protected static Log log = LogFactory.getLog(DialogUIHandler.class);
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -48,8 +48,8 @@
// only deal with real closed and none visible windows...
return;
}
- for (DialogUIDef def : factory.getDefs()) {
- DialogUI ui = def.uiInstance;
+ for (DialogUIDef<?,?,?> def : factory.getDefs()) {
+ DialogUI<?> ui = def.uiInstance;
if (ui != null && ui.isVisible()) {
// at least one ui visible, do not close all
return;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -14,8 +14,10 @@
*/
package org.codelutin.jaxx.util;
-/** @author chemit */
-public interface FormElement<U extends DialogUI> {
+/**
+ * @param <U> type of dialog
+ * @author chemit */
+public interface FormElement<U extends DialogUI<?>> {
String name();
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -21,7 +21,11 @@
import java.awt.Point;
import java.awt.event.ActionEvent;
-/** @author chemit */
+/**
+ * @param <M> type of model
+ * @param <U> type of ui
+ * @param <H> type of handler
+ * @author chemit */
public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends javax.swing.AbstractAction {
protected static Log log = LogFactory.getLog(AbstractUIAction.class);
@@ -80,15 +84,16 @@
this.undecorated = undecorated;
}
+ @Override
public void actionPerformed(java.awt.event.ActionEvent e) {
checkInit();
- U ui = initUI(e);
- ui.setTitle(uiDef.getUiTitle());
- log.info(ui.getTitle());
+ U gui = initUI(e);
+ gui.setTitle(uiDef.getUiTitle());
+ log.info(gui.getTitle());
//TODO ui.setUndecorated(undecorated);
- setPosition(this.getUi(), ui, position);
+ setPosition(this.getUi(), gui, position);
- ui.setVisible(true);
+ gui.setVisible(true);
}
protected void setPosition(javax.swing.JDialog parentUI, javax.swing.JDialog ui, String position) {
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -17,7 +17,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.StringUtil;
+import org.nuiton.util.StringUtil;
import javax.swing.event.EventListenerList;
import java.util.ArrayList;
@@ -35,11 +35,11 @@
private final String applicationName;
- private final DialogUIDef[] defs;
+ private final DialogUIDef<?,?,?>[] defs;
private final EventListenerList listeners;
- public UIFactory(String applicationName, DialogUIDef[] defs, FactoryWindowListener... listeners) {
+ public UIFactory(String applicationName, DialogUIDef<?,?,?>[] defs, FactoryWindowListener... listeners) {
this.applicationName = applicationName;
this.listeners = new EventListenerList();
for (FactoryWindowListener listener : listeners) {
@@ -72,7 +72,7 @@
public void removeFactoryWindowListener(FactoryWindowListener l) {
listeners.remove(FactoryWindowListener.class, l);
- for (DialogUIDef def : getDefs()) {
+ for (DialogUIDef<?,?,?> def : getDefs()) {
if (def.uiInstance != null) {
def.uiInstance.removeWindowListener(l);
}
@@ -144,7 +144,7 @@
return providers.toArray(new UIProvider[providers.size()]);
}
- protected DialogUIDef[] getDefs() {
+ protected DialogUIDef<?,?,?>[] getDefs() {
return defs;
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -54,6 +54,7 @@
Action quitAction = new AbstractAction("quit") {
private static final long serialVersionUID = -869095664995763057L;
+ @Override
public void actionPerformed(ActionEvent e) {
ui.dispose();
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -27,12 +27,12 @@
public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.cancel");
+ String text = org.nuiton.i18n.I18n._("lutinui.config.cancel");
putValue(NAME, text);
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
putValue(MNEMONIC_KEY, (int) text.charAt(0));
}
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.cancel.tooltip");
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.cancel.tooltip");
putValue(SHORT_DESCRIPTION, libelle);
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -15,9 +15,9 @@
package org.codelutin.jaxx.util.config;
import org.codelutin.jaxx.util.DialogUIHandler;
-import org.codelutin.util.ConverterUtil;
-import org.codelutin.util.config.Config;
-import org.codelutin.util.config.Property;
+import org.nuiton.util.ConverterUtil;
+import org.nuiton.util.config.Config;
+import org.nuiton.util.config.Property;
import javax.swing.JComponent;
import java.awt.Color;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -15,7 +15,7 @@
package org.codelutin.jaxx.util.config;
import org.codelutin.jaxx.util.DialogUIModel;
-import org.codelutin.util.config.Config;
+import org.nuiton.util.config.Config;
import java.util.EnumSet;
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -27,12 +27,12 @@
public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.reset");
+ String text = org.nuiton.i18n.I18n._("lutinui.config.reset");
putValue(NAME, text);
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
putValue(MNEMONIC_KEY, (int) text.charAt(0));
}
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.reset.tooltip");
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.reset.tooltip");
putValue(SHORT_DESCRIPTION, libelle);
}
Modified: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -27,12 +27,12 @@
public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
super(null, UIHelper.createActionIcon("save-config"), dialogUI);
if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.save");
+ String text = org.nuiton.i18n.I18n._("lutinui.config.save");
putValue(NAME, text);
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
putValue(MNEMONIC_KEY, (int) text.charAt(0));
}
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.save.tooltip");
+ String libelle = org.nuiton.i18n.I18n._("lutinui.config.save.tooltip");
putValue(SHORT_DESCRIPTION, libelle);
}
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,12 +8,12 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin.jaxx</groupId>
+ <groupId>org.nuiton.jaxx</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<dependencies>
@@ -59,8 +59,8 @@
<!-- other dependencies -->
<dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinpluginutil</artifactId>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
</dependency>
<!-- pour acceder aux BeansInfos swing via Introspector -->
@@ -98,6 +98,17 @@
<artifactId>commons-lang</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <classifier>tests</classifier>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -143,10 +154,5 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/maven-jaxx-plugin</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/maven-jaxx-plugin</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/mave…</url>
- </scm>
-
+
</project>
\ No newline at end of file
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/AbstractJaxxMojo.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -57,7 +57,7 @@
*/
protected boolean verbose;
/**
- * to make compiler i18nable, says add the {@link org.codelutin.i18n.I18n#_(String, Object[])} method
+ * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method
* invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes.
*
* @parameter expression="${jaxx.i18nable}" default-value="true"
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -27,8 +27,8 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.util.DirectoryScanner;
-import org.codelutin.util.FileUpdaterHelper;
-import org.codelutin.util.MirroredFileUpdater;
+import org.nuiton.util.FileUpdaterHelper;
+import org.nuiton.util.MirroredFileUpdater;
import java.io.File;
import java.io.FileOutputStream;
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxHelpGeneratorMojo.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -31,9 +31,9 @@
import java.util.Set;
import java.util.Stack;
import org.apache.maven.model.Resource;
-import org.codelutin.i18n.I18n;
-import org.codelutin.util.FileUtil;
-import org.codelutin.util.SortedProperties;
+import org.nuiton.i18n.I18n;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.SortedProperties;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -41,7 +41,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
/**
* Mojo to generate javax help stuff for your project.
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/NodeItem.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import static org.codelutin.i18n.I18n._;
+import static org.nuiton.i18n.I18n._;
public class NodeItem {
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-05-16 01:23:55 UTC (rev 1406)
@@ -4,7 +4,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codelutin.util.FileUtil;
+import org.nuiton.util.FileUtil;
import java.io.File;
import java.io.IOException;
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/pom.xml 2009-05-16 01:23:55 UTC (rev 1406)
@@ -8,14 +8,13 @@
<!-- ************************************************************* -->
<parent>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinproject</artifactId>
- <version>3.5.4</version>
+ <groupId>org.nuiton</groupId>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
- <groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -35,31 +34,32 @@
<module>jaxx-example</module>
</modules>
- <!--dependencies>
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
- </dependency>
- </dependencies-->
-
<dependencyManagement>
<dependencies>
<!-- lutin dependencies -->
<dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
<version>${lutinutil.version}</version>
</dependency>
<dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinpluginutil</artifactId>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
<version>${lutinpluginutil.version}</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>${lutinpluginutil.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
<!-- common dependencies -->
<dependency>
@@ -134,6 +134,13 @@
<version>1.1</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</dependencyManagement>
@@ -153,19 +160,17 @@
<properties>
- <!-- id du projet du labs -->
- <labs.id>38</labs.id>
+ <!-- a supprimer des qu'on pourra deployer les sites sur nuiton -->
+ <site.deploy.url>scpexe://labs.libre-entreprise.org/home/groups/buix/htdocs</site.deploy.url>
- <!-- nom du projet du labs -->
- <labs.project>buix</labs.project>
-
<!-- libs version -->
- <lutinutil.version>1.0.6</lutinutil.version>
+ <lutinutil.version>1.1.0-SNAPSHOT</lutinutil.version>
<jaxx.version>${project.version}</jaxx.version>
- <i18n.version>0.12</i18n.version>
- <lutinpluginutil.version>0.5</lutinpluginutil.version>
+ <i18n.version>1.0.0-SNAPSHOT</i18n.version>
+ <lutinpluginutil.version>1.0.0-alpha-1-SNAPSHOT</lutinpluginutil.version>
+
<swingx.version>0.9.6</swingx.version>
- <maven.version>2.0.10</maven.version>
+
</properties>
<build>
@@ -175,16 +180,9 @@
<!-- plugin i18n -->
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.nuiton</groupId>
<artifactId>maven-i18n-plugin</artifactId>
- <version>${i18n.version}</version>
- <dependencies>
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
- <version>${lutinutil.version}</version>
- </dependency>
- </dependencies>
+ <version>${i18n.version}</version>
</plugin>
<plugin>
@@ -215,21 +213,15 @@
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
- <scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
- </scm>
-
+
<!-- Maven Environment : Repositories -->
- <!--Code Lutin Repository-->
+ <!--Nuiton Repository : pourra etre supprimer lorsqu'on sera sur central -->
<repositories>
<repository>
-
- <id>codelutin-repository</id>
- <name>CodeLutinRepository</name>
- <url>http://lutinbuilder.labs.libre-entreprise.org/maven2</url>
+ <id>nuiton-repository</id>
+ <name>NuitonRepository</name>
+ <url>${repository.home.url}</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
@@ -241,36 +233,4 @@
</repository>
</repositories>
- <profiles>
- <!-- perform only on a release stage when using the maven-release-plugin -->
- <profile>
- <id>release-profile</id>
- <activation>
- <property>
- <name>performRelease</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <!-- always add license and third-party files to classpath -->
- <plugin>
- <groupId>org.codelutin</groupId>
- <artifactId>maven-license-switcher-plugin</artifactId>
- <version>0.8</version>
- <executions>
- <execution>
- <id>attach-licenses</id>
- <goals>
- <goal>license</goal>
- <goal>third-party</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>
\ No newline at end of file
Modified: jaxx/trunk/src/site/rst/I18n.rst
===================================================================
--- jaxx/trunk/src/site/rst/I18n.rst 2009-05-15 14:01:35 UTC (rev 1405)
+++ jaxx/trunk/src/site/rst/I18n.rst 2009-05-16 01:23:55 UTC (rev 1406)
@@ -28,7 +28,7 @@
::
- org.codelutin.i18n.I18n._(String)
+ org.nuiton.i18n.I18n._(String)
La liste des attributs en question sont les suivants :
1
0
r1405 - in guix/trunk: . guix-runtime guix-runtime/src guix-runtime/src/main guix-runtime/src/main/java guix-runtime/src/main/java/org guix-runtime/src/main/java/org/nuiton guix-runtime/src/main/java/org/nuiton/guix guix-runtime/src/test guix-runtime/src/test/java guix-runtime/src/test/java/org guix-runtime/src/test/java/org/nuiton
by kmorin@users.labs.libre-entreprise.org May 15, 2009
by kmorin@users.labs.libre-entreprise.org May 15, 2009
May 15, 2009
Author: kmorin
Date: 2009-05-15 14:01:35 +0000 (Fri, 15 May 2009)
New Revision: 1405
Added:
guix/trunk/guix-runtime/
guix/trunk/guix-runtime/pom.xml
guix/trunk/guix-runtime/src/
guix/trunk/guix-runtime/src/main/
guix/trunk/guix-runtime/src/main/java/
guix/trunk/guix-runtime/src/main/java/org/
guix/trunk/guix-runtime/src/main/java/org/nuiton/
guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/
guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingListener.java
guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingUpdateListener.java
guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/GuixObject.java
guix/trunk/guix-runtime/src/test/
guix/trunk/guix-runtime/src/test/java/
guix/trunk/guix-runtime/src/test/java/org/
guix/trunk/guix-runtime/src/test/java/org/nuiton/
guix/trunk/guix-runtime/src/test/java/org/nuiton/guix/
Log:
Ajout du module (pas encore fonctionnel) guix-runtime
Property changes on: guix/trunk/guix-runtime
___________________________________________________________________
Name: svn:ignore
+ target
Added: guix/trunk/guix-runtime/pom.xml
===================================================================
--- guix/trunk/guix-runtime/pom.xml (rev 0)
+++ guix/trunk/guix-runtime/pom.xml 2009-05-15 14:01:35 UTC (rev 1405)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.nuiton.guix</groupId>
+ <artifactId>guix</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>guix-runtime</artifactId>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>guix-runtime</name>
+ <description>Guix runtime</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+ <scm>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/guix/trunk/guix-runtime</connection>
+ <!--developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/guix/trunk</developerConnection-->
+ <!--url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/guix/trunk/?roo…</url-->
+ </scm>
+</project>
\ No newline at end of file
Added: guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingListener.java
===================================================================
--- guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingListener.java (rev 0)
+++ guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingListener.java 2009-05-15 14:01:35 UTC (rev 1405)
@@ -0,0 +1,42 @@
+package org.nuiton.guix;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which processes a data binding when it receives a
+ * <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingListener</code> which will run the given data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to run
+ */
+ public DataBindingListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ /**
+ * Processes the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.processDataBinding(dest);
+
+ // for now, handle dependency changes by always removing & reapplying
+ // the binding. We should be more efficient and only do this when it's
+ // actually necessary
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingUpdateListener.java
===================================================================
--- guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingUpdateListener.java (rev 0)
+++ guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/DataBindingUpdateListener.java 2009-05-15 14:01:35 UTC (rev 1405)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which removes and re-applies a data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingUpdateListener implements PropertyChangeListener {
+ private GuixObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a
+ * data binding when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to reapply
+ */
+ public DataBindingUpdateListener(GuixObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ public String getBindingName() {
+ return dest;
+ }
+
+
+ /**
+ * Updates the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Added: guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/GuixObject.java
===================================================================
--- guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/GuixObject.java (rev 0)
+++ guix/trunk/guix-runtime/src/main/java/org/nuiton/guix/GuixObject.java 2009-05-15 14:01:35 UTC (rev 1405)
@@ -0,0 +1,46 @@
+package org.nuiton.guix;
+
+/** The <code>GuixObject</code> interface is implemented by all classes produced by the Guix compiler. */
+public interface GuixObject {
+ /**
+ * Retrieves an object defined in an XML tag by its ID.
+ *
+ * @param id the id of the component to retrieve
+ * @return the object
+ */
+ public Object getObjectById(String id);
+
+ /**
+ * Pretrieves the dictonary of knwon objects indexed by their ids.
+ *
+ * @return the dictonary of objects.
+ */
+ public java.util.Map<String, Object> get$objectMap();
+
+ public void applyDataBinding(String id);
+
+
+ public void removeDataBinding(String id);
+
+ /**
+ * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
+ * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
+ * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
+ * case <code>foo.getText()</code>.
+ *
+ * @param dest the name of the data binding to run
+ */
+ public void processDataBinding(String dest);
+
+
+ /**
+ * All <code>GuixObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
+ * furthermore (for technical reasons) must allow code in outside packages, specifically the Guix runtime,
+ * to trigger these events.
+ *
+ * @param name the name of the property which changed
+ * @param oldValue the old value of the property
+ * @param newValue the new value of the property
+ */
+ public void firePropertyChange(String name, Object oldValue, Object newValue);
+}
\ No newline at end of file
1
0
r1404 - in guix/trunk/guix-maven-plugin: . src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org May 15, 2009
by kmorin@users.labs.libre-entreprise.org May 15, 2009
May 15, 2009
Author: kmorin
Date: 2009-05-15 14:00:25 +0000 (Fri, 15 May 2009)
New Revision: 1404
Modified:
guix/trunk/guix-maven-plugin/pom.xml
guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
Log:
Ajout des parametres dans le mojo
Modified: guix/trunk/guix-maven-plugin/pom.xml
===================================================================
--- guix/trunk/guix-maven-plugin/pom.xml 2009-05-15 13:59:55 UTC (rev 1403)
+++ guix/trunk/guix-maven-plugin/pom.xml 2009-05-15 14:00:25 UTC (rev 1404)
@@ -25,6 +25,12 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>guix-compiler-swing</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<!-- maven plugin project dependencies -->
<dependency>
Modified: guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
===================================================================
--- guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-05-15 13:59:55 UTC (rev 1403)
+++ guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-05-15 14:00:25 UTC (rev 1404)
@@ -5,6 +5,9 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.nuiton.guix.generator.Generator;
+import org.nuiton.guix.generator.GuixGenerator;
+import org.nuiton.guix.generator.SwingGenerator;
/**
* Launches the program
@@ -45,12 +48,21 @@
*/
private String mainClass;
+ /**
+ * Generation language
+ * @parameter expression="${guix.generationLanguage}" default-value="Swing"
+ * @since 0.0.1
+ */
+ private String generationLanguage;
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
GuixInitializer.initialize();
File guixFilesDir = new File(this.guixFilesDir);
File targetDirectory = new File(this.targetDirectory);
-
+ Class generatorClass = null;
+ if(generationLanguage.equals("Swing"))
+ generatorClass = SwingGenerator.class;
if(!targetDirectory.exists())
targetDirectory.mkdirs();
@@ -59,7 +71,7 @@
GuixLauncher gcl = new GuixLauncher(guixFiles.toArray(
new File[guixFiles.size()]),targetDirectory,rootPackage,
- guixFilesDir,mainClass);
+ guixFilesDir,mainClass,generatorClass);
boolean result = gcl.compile();
if(result)
getLog().info("Compilation succeeded !");
@@ -85,4 +97,5 @@
}
return result;
}
+
}
1
0
r1403 - in guix/trunk: . guix-compiler-swing guix-compiler-swing/src guix-compiler-swing/src/main guix-compiler-swing/src/main/java guix-compiler-swing/src/main/java/org guix-compiler-swing/src/main/java/org/nuiton guix-compiler-swing/src/main/java/org/nuiton/guix guix-compiler-swing/src/main/java/org/nuiton/guix/generator guix-compiler-swing/src/spring guix-compiler-swing/src/test
by kmorin@users.labs.libre-entreprise.org May 15, 2009
by kmorin@users.labs.libre-entreprise.org May 15, 2009
May 15, 2009
Author: kmorin
Date: 2009-05-15 13:59:55 +0000 (Fri, 15 May 2009)
New Revision: 1403
Added:
guix/trunk/guix-compiler-swing/
guix/trunk/guix-compiler-swing/pom.xml
guix/trunk/guix-compiler-swing/src/
guix/trunk/guix-compiler-swing/src/main/
guix/trunk/guix-compiler-swing/src/main/java/
guix/trunk/guix-compiler-swing/src/main/java/org/
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
guix/trunk/guix-compiler-swing/src/main/resources/
guix/trunk/guix-compiler-swing/src/spring/
guix/trunk/guix-compiler-swing/src/spring/SwingAbstractClassGenerator.java
guix/trunk/guix-compiler-swing/src/spring/SwingGenerator.java
guix/trunk/guix-compiler-swing/src/spring/SwingImplementationGenerator.java
guix/trunk/guix-compiler-swing/src/spring/SwingInterfaceGenerator.java
guix/trunk/guix-compiler-swing/src/spring/SwingMainClassGenerator.java
guix/trunk/guix-compiler-swing/src/test/
guix/trunk/guix-compiler-swing/src/test/java/
guix/trunk/guix-compiler-swing/src/test/resources/
Log:
Ajout du module guix-compiler-swing
Property changes on: guix/trunk/guix-compiler-swing
___________________________________________________________________
Name: svn:ignore
+ target
Added: guix/trunk/guix-compiler-swing/pom.xml
===================================================================
--- guix/trunk/guix-compiler-swing/pom.xml (rev 0)
+++ guix/trunk/guix-compiler-swing/pom.xml 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.nuiton.guix</groupId>
+ <artifactId>guix</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>guix-compiler-swing</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.guix</groupId>
+ <artifactId>guix-compiler</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jdesktop</groupId>
+ <artifactId>beansbinding</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.4c</version>
+ </dependency>
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>guix-compiler-swing</name>
+ <description>Guix compiler for swing</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+ <scm>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/guix/trunk/guix-compiler-swing</connection>
+ <!--developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/guix/trunk</developerConnection-->
+ <!--url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/guix/trunk/?roo…</url-->
+ </scm>
+
+</project>
Added: guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingFileGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,153 @@
+package org.nuiton.guix.generator;
+
+//~--- non-JDK imports --------------------------------------------------------
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import org.nuiton.guix.databinding.BindingUtils;
+import org.nuiton.guix.model.AttributeDescriptor;
+
+/**
+ *
+ * @author morin
+ */
+public class SwingFileGenerator extends JavaFileGenerator {
+
+ public SwingFileGenerator(GuixModelObject gmo) {
+ super(gmo);
+ jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
+ Modifier.PUBLIC,
+ gmo.getClassDescriptor().getName(),
+ null);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+ jf.addImport("javax.swing.*");
+ jf.addImport("java.awt.*");
+
+ jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName() + "." + gmo.getClassDescriptor().getSuperClass().getName());
+
+ if (!gmo.getJavadoc().equals("")) {
+ sb.append("\n/**\n* ");
+ sb.append(gmo.getJavadoc());
+ sb.append("\n*/");
+ }
+
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ "org.jdesktop.beansbinding.BindingGroup",
+ "bindingGroup"),
+ true);
+ addFields(gmo);
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName(),
+ null, null, "initialize();"));
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initialize", null, null, "createComponents();\ninitComponents();\ninitDataBinding();"));
+
+ Map<String, String> methodBodies = browseModelObjects(gmo);
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "createComponents", null, null,
+ "this.setLayout(new FlowLayout());\n" + methodBodies.get("componentsCreation")));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initComponents", null, null, methodBodies.get("componentsTree")));
+
+ StringBuffer dataBinding = new StringBuffer("bindingGroup = new org.jdesktop.beansbinding.BindingGroup();\n");
+ dataBinding.append(methodBodies.get("bindings"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initDataBinding", null, null, dataBinding.toString()));
+
+ saveFile(out);
+ }
+
+ private void addFields(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ child.getClassDescriptor().getName(),
+ child.getId()),
+ true);
+ addFields(child);
+ }
+ }
+
+ private Map<String, String> browseModelObjects(GuixModelObject gmo) {
+ StringBuffer componentsCreation = new StringBuffer();
+ StringBuffer componentsTree = new StringBuffer();
+ StringBuffer bindings = new StringBuffer();
+
+ if (gmo.getParent() != null) {
+ String capitalizedId = (gmo.getId().length() > 0) ? Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
+ StringBuffer creationMethod = new StringBuffer(gmo.getId()).append(" = new ").append(gmo.getClassDescriptor().getName()).append("();");
+ jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
+ componentsCreation.append("create").append(capitalizedId).append("();\n");
+
+
+ componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId()).append(".add(").append(gmo.getId()).append(");\n");
+
+ for (AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
+ String binding = BindingUtils.processDataBindings(attr.getValue());
+ if (binding != null) {
+ bindings.append("bindingGroup.addBinding(\n").append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\norg.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,").append("this").append(",org.jdesktop.beansbinding.ELProperty.create(\"${").append(binding).append("}\"),").append(gmo.getId()).append(",org.jdesktop.beansbinding.BeanProperty.create(\"").append(attr.getName()).append("\")").append("));\n").append("bindingGroup.bind();\n");
+ }
+ else {
+ String capitalizedAttribute = (attr.getName().length() > 0) ? Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
+ boolean addQuote = false;
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("get" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex) {
+ log.error(ex);
+ }
+ catch (NoSuchMethodException ex) {
+ try {
+ addQuote = Class.forName(gmo.getClassDescriptor().getPackageName() + "." + gmo.getClassDescriptor().getName()).getMethod("is" + capitalizedAttribute, null).getReturnType().equals(String.class);
+ }
+ catch (ClassNotFoundException ex2) {
+ log.error(ex2);
+ }
+ catch (NoSuchMethodException ex2) {
+ log.error(ex2);
+ }
+ }
+ componentsTree.append(gmo.getId()).append(".set").append(capitalizedAttribute).append("(").append(addQuote ? "\"" : "").append(attr.getValue()).append(addQuote ? "\"" : "").append(");\n");
+ }
+ }
+ }
+ for (GuixModelObject child : gmo.getChildren()) {
+ Map<String, String> methodBodies = browseModelObjects(child);
+ componentsCreation.append(methodBodies.get("componentsCreation"));
+ componentsTree.append(methodBodies.get("componentsTree"));
+ bindings.append(methodBodies.get("bindings"));
+ }
+ Map<String, String> result = new HashMap<String, String>();
+ result.put("componentsCreation", componentsCreation.toString());
+ result.put("componentsTree", componentsTree.toString());
+ result.put("bindings", bindings.toString());
+ return result;
+ }
+
+ public void addMainMethod() {
+ //public static void main(String[] arg) {
+ //SwingUtilities.invokeLater(new Runnable() { public void run() { new JAXXDemo().setVisible(true); } });
+ //}
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC | Modifier.STATIC,
+ "void",
+ "main",
+ new JavaArgument[]{new JavaArgument("String[]", "args")},
+ null,
+ "SwingUtilities.invokeLater(" +
+ "new Runnable() {" +
+ "public void run() {" +
+ jf.getClassName() +
+ " main = new " +
+ jf.getClassName() + "();\n" +
+ "main.pack();\n" +
+ "main.setVisible(true);}});"));
+ }
+}
+
Added: guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/main/java/org/nuiton/guix/generator/SwingGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,55 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.guix.generator;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author kevin
+ */
+public class SwingGenerator extends GuixGenerator {
+
+ protected Log log = LogFactory.getLog(SwingGenerator.class);
+
+ public void generate() {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ //File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
+ File out = new File(destDir, gmoClassName + ".java");
+
+ if (lastModification > out.lastModified()) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Generation of " + gmo.getClassDescriptor().getName());
+ }
+ if (!out.exists()) {
+ try {
+ out.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ SwingFileGenerator ing = new SwingFileGenerator(gmo);
+ if (mainClass) {
+ ing.addMainMethod();
+ }
+ ing.generate(out);
+ }
+ catch (IllegalArgumentException ex) {
+ log.error(ex);
+ }
+ catch (IllegalStateException ex) {
+ log.error(ex);
+ }
+ }
+ else if (log.isWarnEnabled()) {
+ log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ }
+ }
+}
Added: guix/trunk/guix-compiler-swing/src/spring/SwingAbstractClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/spring/SwingAbstractClassGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/spring/SwingAbstractClassGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,143 @@
+package org.nuiton.guix.generator.spring;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.generator.*;
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import javax.swing.JComponent;
+import org.nuiton.guix.databinding.BindingUtils;
+import org.nuiton.guix.model.AttributeDescriptor;
+
+/**
+ *
+ * @author morin
+ */
+public class SwingAbstractClassGenerator extends JavaFileGenerator {
+ public SwingAbstractClassGenerator(GuixModelObject gmo) {
+ super(gmo);
+ jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
+ Modifier.PUBLIC,
+ JavaFile.ABSTRACT_CLASS,
+ gmo.getClassDescriptor().getName() + "Abstract",
+ null);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+
+ jf.setSuperClass(gmo.getClassDescriptor().getSuperClass().getPackageName()
+ + "." + gmo.getClassDescriptor().getSuperClass().getName());
+ jf.addInterface(gmo.getClassDescriptor().getName());
+
+ if (!gmo.getJavadoc().equals("")) {
+ sb.append("\n/**\n* ");
+ sb.append(gmo.getJavadoc());
+ sb.append("\n*/");
+ }
+
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ "org.jdesktop.beansbinding.BindingGroup",
+ "bindingGroup"),
+ true);
+ addFields(gmo);
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Abstract",
+ null, null, "initialize();"));
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initialize", null, null, "createComponents();\ninitComponents();\ninitDataBinding();"));
+
+ Map<String, String> methodBodies = browseModelObjects(gmo);
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "createComponents", null, null, methodBodies.get("componentsCreation")));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initComponents", null, null, methodBodies.get("componentsTree")));
+
+ StringBuffer dataBinding = new StringBuffer("bindingGroup = new org.jdesktop.beansbinding.BindingGroup();\n");
+ dataBinding.append(methodBodies.get("bindings"));
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initDataBinding", null, null, dataBinding.toString()));
+
+ //sb.append("\n\npublic abstract void test();\n\n}");
+ saveFile(out);
+ }
+
+ private void addFields(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ child.getClassDescriptor().getName(),
+ child.getId()),
+ true);
+ addFields(child);
+ }
+ }
+
+ private Map<String,String> browseModelObjects(GuixModelObject gmo) {
+ StringBuffer componentsCreation = new StringBuffer();
+ StringBuffer componentsTree = new StringBuffer();
+ StringBuffer bindings = new StringBuffer();
+
+ if(gmo.getParent() != null) {
+ String capitalizedId = (gmo.getId().length()>0) ?
+ Character.toUpperCase(gmo.getId().charAt(0)) + gmo.getId().substring(1) : gmo.getId();
+ StringBuffer creationMethod = new StringBuffer(gmo.getId())
+ .append(" = new ")
+ .append(gmo.getClassDescriptor().getName())
+ .append("();");
+ jf.addMethod(new JavaMethod(Modifier.PRIVATE, "void", "create" + capitalizedId, null, null, creationMethod.toString()));
+ componentsCreation.append("create")
+ .append(capitalizedId)
+ .append("();\n");
+
+
+ componentsTree.append(gmo.getParent().getId() == null ? "this" : gmo.getParent().getId())
+ .append(".add(")
+ .append(gmo.getId())
+ .append(");\n");
+
+ for(AttributeDescriptor attr : gmo.getAttributeDescriptors()) {
+ String binding = BindingUtils.processDataBindings(attr.getValue());
+ if(binding != null) {
+ bindings.append("bindingGroup.addBinding(\n")
+ .append("org.jdesktop.beansbinding.Bindings.createAutoBinding(\norg.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ,")
+ .append("this")
+ .append(",org.jdesktop.beansbinding.ELProperty.create(\"${")
+ .append(binding)
+ .append("}\"),")
+ .append(gmo.getId())
+ .append(",org.jdesktop.beansbinding.BeanProperty.create(\"")
+ .append(attr.getName())
+ .append("\")")
+ .append("));\n")
+ .append("bindingGroup.bind();");
+ }
+ else {
+ String capitalizedAttribute = (attr.getName().length()>0) ?
+ Character.toUpperCase(attr.getName().charAt(0)) + attr.getName().substring(1) : attr.getName();
+ componentsTree.append(gmo.getId())
+ .append(".set")
+ .append(capitalizedAttribute)
+ .append("(")
+ .append(attr.getValue())
+ .append(");\n");
+ }
+ }
+ }
+ for (GuixModelObject child : gmo.getChildren()) {
+ Map<String,String> methodBodies = browseModelObjects(child);
+ componentsCreation.append(methodBodies.get("componentsCreation"));
+ componentsTree.append(methodBodies.get("componentsTree"));
+ bindings.append(methodBodies.get("bindings"));
+ }
+ Map<String,String> result = new HashMap<String, String>();
+ result.put("componentsCreation", componentsCreation.toString());
+ result.put("componentsTree", componentsTree.toString());
+ result.put("bindings", bindings.toString());
+ return result;
+ }
+}
+
Added: guix/trunk/guix-compiler-swing/src/spring/SwingGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/spring/SwingGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/spring/SwingGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,116 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.guix.generator.spring;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.generator.GuixGenerator;
+
+/**
+ *
+ * @author kevin
+ */
+public class SwingGenerator extends GuixGenerator {
+
+ protected Log log = LogFactory.getLog(SwingGenerator.class);
+
+ public void generate() {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ //File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
+ File out = new File(destDir, gmoClassName + ".java");
+ File outAbstract = new File(destDir, gmoClassName + "Abstract.java");
+ File outImpl = new File(destDir, gmoClassName + "Impl.java");
+
+ if (lastModification > out.lastModified()) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Generation of " + gmo.getClassDescriptor().getName());
+ }
+ if (!out.exists()) {
+ try {
+ out.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ if (!outAbstract.exists()) {
+ try {
+ outAbstract.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ if (!outImpl.exists()) {
+ try {
+ outImpl.createNewFile();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ SwingInterfaceGenerator ing = new SwingInterfaceGenerator(gmo);
+ ing.generate(out);
+ SwingAbstractClassGenerator acg = new SwingAbstractClassGenerator(gmo);
+ acg.generate(outAbstract);
+ SwingImplementationGenerator img = new SwingImplementationGenerator(gmo);
+ img.generate(outImpl);
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", gmoClassName.replace(gmoClassName.charAt(0), Character.toLowerCase(gmoClassName.charAt(0))));
+ serializer.attribute("", "class", gmo.getClassDescriptor().getPackageName() + "." + gmoClassName + "Impl");
+ serializer.attribute("", "singleton", "false");
+ serializer.endTag("", "bean");
+ if (mainClass) {
+ SwingMainClassGenerator mcg = new SwingMainClassGenerator(gmo, destDir);
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(new File(destDir, "Main.java"));
+ fw.write(mcg.getClassContent());
+ fw.close();
+ }
+ catch (IOException ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ }
+ }
+ finally {
+ try {
+ fw.close();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", "main");
+ serializer.attribute("", "class", gmo.getClassDescriptor().getPackageName() + ".Main");
+ serializer.startTag("", "property");
+ serializer.attribute("", "name", gmoClassName.replace(gmoClassName.charAt(0), Character.toLowerCase(gmoClassName.charAt(0))));
+ serializer.startTag("", "ref");
+ serializer.attribute("", "bean", gmoClassName.replace(gmoClassName.charAt(0), Character.toLowerCase(gmoClassName.charAt(0))));
+ serializer.endTag("", "ref");
+ serializer.endTag("", "property");
+ serializer.endTag("", "bean");
+ }
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ catch (IllegalArgumentException ex) {
+ log.error(ex);
+ }
+ catch (IllegalStateException ex) {
+ log.error(ex);
+ }
+ }
+ else if (log.isWarnEnabled()) {
+ log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ }
+ }
+}
Added: guix/trunk/guix-compiler-swing/src/spring/SwingImplementationGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/spring/SwingImplementationGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/spring/SwingImplementationGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,53 @@
+
+/*
+* To change this template, choose Tools | Templates
+* and open the template in the editor.
+ */
+package org.nuiton.guix.generator.spring;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.generator.*;
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+
+/**
+ *
+ * @author morin
+ */
+public class SwingImplementationGenerator extends JavaFileGenerator {
+ public SwingImplementationGenerator(GuixModelObject gmo) {
+ super(gmo);
+ jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
+ Modifier.PUBLIC,
+ JavaFile.CLASS,
+ gmo.getClassDescriptor().getName() + "Impl",
+ gmo.getClassDescriptor().getName() + "Abstract");
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+
+ if (!gmo.getJavadoc().equals("")) {
+ sb.append("\n/**\n * ");
+ sb.append(gmo.getJavadoc());
+ sb.append("\n */");
+ }
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, null, gmo.getClassDescriptor().getName() + "Impl",
+ null, null, "super();"));
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "initialize", null, null, "super.initialize();"));
+
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "test", null, null, "setVisible(true);"));
+
+ saveFile(out);
+ }
+
+}
+
Added: guix/trunk/guix-compiler-swing/src/spring/SwingInterfaceGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/spring/SwingInterfaceGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/spring/SwingInterfaceGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,50 @@
+package org.nuiton.guix.generator.spring;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.generator.*;
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+
+/**
+ * Generator of interfaces
+ *
+ * @author morin
+ */
+public class SwingInterfaceGenerator extends JavaFileGenerator {
+ public SwingInterfaceGenerator(GuixModelObject gmo) {
+ super(gmo);
+ jf = new JavaFile(gmo.getClassDescriptor().getPackageName(),
+ Modifier.PUBLIC,
+ JavaFile.INTERFACE,
+ gmo.getClassDescriptor().getName(),
+ null);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+ addFields(gmo);
+ jf.addMethod(new JavaMethod(Modifier.PUBLIC, "void", "test", null, null, null));
+ //sb.append("\n\npublic void test();\n\n}");
+ saveFile(out);
+ }
+
+ private void addFields(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ jf.addField(new JavaField(Modifier.PRIVATE,
+ child.getClassDescriptor().getName(),
+ child.getId()),
+ true);
+ addFields(child);
+ }
+ }
+
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Added: guix/trunk/guix-compiler-swing/src/spring/SwingMainClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler-swing/src/spring/SwingMainClassGenerator.java (rev 0)
+++ guix/trunk/guix-compiler-swing/src/spring/SwingMainClassGenerator.java 2009-05-15 13:59:55 UTC (rev 1403)
@@ -0,0 +1,66 @@
+package org.nuiton.guix.generator.spring;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.generator.*;
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.lang.reflect.Modifier;
+
+/**
+ * Generator of interfaces
+ *
+ * @author morin
+ */
+public class SwingMainClassGenerator {
+ private JavaFile clazz;
+
+ public SwingMainClassGenerator(GuixModelObject gmo, File destDir) {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ String gmoAttributeName = gmoClassName.replace(gmoClassName.charAt(0),
+ Character.toLowerCase(gmoClassName.charAt(0)));
+
+ clazz = new JavaFile(gmo.getClassDescriptor().getPackageName(),
+ Modifier.PUBLIC,
+ JavaFile.CLASS, "Main", null);
+
+ clazz.addImport("java.io.File");
+ clazz.addImport("org.springframework.beans.factory.ListableBeanFactory");
+ clazz.addImport("org.springframework.beans.factory.xml.XmlBeanFactory");
+ clazz.addImport("org.springframework.core.io.FileSystemResource");
+
+ StringBuffer mainMethod = new StringBuffer();
+ mainMethod.append("//usine à beans\n")
+ .append("ListableBeanFactory bf = new XmlBeanFactory(")
+ .append("new FileSystemResource(new File(\"")
+ .append(destDir.getAbsolutePath())
+ .append("/config.xml\")));\n")
+ .append(gmoClassName)
+ .append(" ")
+ .append(gmoAttributeName)
+ .append(" = (")
+ .append(gmoClassName)
+ .append(") bf.getBean(\"")
+ .append(gmoAttributeName)
+ .append("\");\n")
+ .append(gmoAttributeName)
+ .append(".test();");
+ //SwingUtilities.invokeLater(new Runnable() { public void run() { new JAXXDemo().setVisible(true); } });
+
+ clazz.addMethod(new JavaMethod(
+ Modifier.PUBLIC | Modifier.STATIC,
+ "void",
+ "main",
+ new JavaArgument[]{new JavaArgument("String[]", "args")},
+ null,
+ mainMethod.toString()));
+ }
+
+ public String getClassContent() {
+ return clazz.toString("\n");
+ }
+}
+
1
0
r1402 - in guix/trunk/guix-compiler/src: main/java/org/nuiton/guix main/java/org/nuiton/guix/compiler main/java/org/nuiton/guix/databinding main/java/org/nuiton/guix/generator test/java/org/nuiton/guix test/java/org/nuiton/guix/compiler
by kmorin@users.labs.libre-entreprise.org May 15, 2009
by kmorin@users.labs.libre-entreprise.org May 15, 2009
May 15, 2009
Author: kmorin
Date: 2009-05-15 13:59:00 +0000 (Fri, 15 May 2009)
New Revision: 1402
Added:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaArgument.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java
Removed:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java
Modified:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java
guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java
Log:
G?\195?\169n?\195?\169ration des classes
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -4,26 +4,21 @@
import org.nuiton.guix.compiler.GuixCompiler;
import java.io.File;
import java.io.FileWriter;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.guix.generator.AbstractClassGenerator;
-import org.nuiton.guix.generator.ImplementationGenerator;
-import org.nuiton.guix.generator.InterfaceGenerator;
-import org.nuiton.guix.generator.MainClassGenerator;
+import org.nuiton.guix.generator.Generator;
+import org.nuiton.guix.generator.GuixGenerator;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.GuixModelObject;
import org.nuiton.guix.model.Rule;
import org.nuiton.guix.model.Selector;
import org.nuiton.guix.model.StyleSheet;
-import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
/**
@@ -45,8 +40,8 @@
protected List<String> guixFileClassNames = new ArrayList<String>();
/** Maps the root GuixModelObjects being compiled to the compiler instance
* handling the compilation. */
- protected Map<GuixModelObject, GuixCompiler> rootModelObjects =
- new HashMap<GuixModelObject, GuixCompiler>();
+ protected Map<GuixModelObject, Long> rootModelObjects =
+ new HashMap<GuixModelObject, Long>();
/** CLassDescriptor met during the compilation */
protected List<ClassDescriptor> classDescriptors =
new ArrayList<ClassDescriptor>();
@@ -55,6 +50,7 @@
private File targetDirectory;
private String rootPackage;
private String mainClass;
+ private Class generatorClass;
/**
* Constructor
@@ -62,7 +58,7 @@
* @param files the files to compile
*/
public GuixLauncher(File[] files, File targetDirectory, String rootPackage,
- File baseDir, String mainClass) {
+ File baseDir, String mainClass, Class generatorClass) {
// Set up a simple configuration that logs on the console.
this.files = files;
this.targetDirectory = targetDirectory;
@@ -94,6 +90,7 @@
else {
mainClass = "";
}
+ this.generatorClass = generatorClass;
}
/**
@@ -153,7 +150,7 @@
GuixCompiler compiler = new GuixCompiler(file, this, classPackage);
GuixModelObject rootModelObject = compiler.compile();
- rootModelObjects.put(rootModelObject, compiler);
+ rootModelObjects.put(rootModelObject, compiler.getLastModification());
if (compiler.isFailed()) {
success = false;
@@ -177,225 +174,123 @@
}
}
}
- if (success || true) {
- XmlPullParserFactory factory =
- XmlPullParserFactory.newInstance(
- System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
- null);
- XmlSerializer serializer = factory.newSerializer();
- File config = new File(destDir,"config.xml");
-
- serializer.setOutput(new PrintWriter(config));
- serializer.startDocument("UTF-8", null);
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
- serializer.text("\n");
- serializer.docdecl(" beans SYSTEM \"http://www.springframework.org/dtd/spring-beans.dtd\"");
- serializer.text("\n");
- serializer.startTag("", "beans");
-
+ if (generatorClass != null) {
for (GuixModelObject mo : rootModelObjects.keySet()) {
- String moClassName = mo.getClassDescriptor().getName();
- //File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
- File out = new File(destDir, moClassName + ".java");
- File outAbstract = new File(destDir, moClassName + "Abstract.java");
- File outImpl = new File(destDir, moClassName + "Impl.java");
-
- if (log.isInfoEnabled()) {
- log.info(moClassName + " last modification : " + new Date(rootModelObjects.get(mo).getLastModification()));
+ try {
+ Generator gen = (GuixGenerator) generatorClass.newInstance();
+ gen.setDestDir(destDir);
+ gen.setGmo(mo);
+ gen.setLastModification(rootModelObjects.get(mo));
+ gen.setMainClass((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass));
+ gen.generate();
+ /*= new SwingGenerator(mo,destDir,
+ (mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass),
+ rootModelObjects.get(mo), serializer);
+ }*/
}
-
- if (rootModelObjects.get(mo).getLastModification() > out.lastModified()) {
- if (log.isInfoEnabled()) {
- log.info("Generation of " + mo.getClassDescriptor().getName());
- }
- if (!out.exists()) {
- out.createNewFile();
- }
- if (!outAbstract.exists()) {
- outAbstract.createNewFile();
- }
- if (!outImpl.exists()) {
- outImpl.createNewFile();
- }
- /*XmlSerializer serializer = factory.newSerializer();
- XmlSerializer cssSerializer = factory.newSerializer();
-
- serializer.setOutput(new PrintWriter(f));
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
- serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
-
- cssSerializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
- cssSerializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
-
- writeModelTree(serializer, mo, cssSerializer, destDir);
-
- serializer.endDocument();*/
-
- InterfaceGenerator ing = new InterfaceGenerator(mo);
- ing.generate(out);
-
- AbstractClassGenerator acg = new AbstractClassGenerator(mo);
- acg.generate(outAbstract);
-
- ImplementationGenerator img = new ImplementationGenerator(mo);
- img.generate(outImpl);
-
- serializer.startTag("", "bean");
- serializer.attribute("", "id", moClassName.replace(moClassName.charAt(0),
- Character.toLowerCase(moClassName.charAt(0))));
- serializer.attribute("", "class",
- mo.getClassDescriptor().getPackageName() + "." + moClassName + "Impl");
- serializer.attribute("", "singleton", "false");
- serializer.endTag("", "bean");
-
- if ((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass)) {
- MainClassGenerator mcg = new MainClassGenerator(mo, destDir);
- FileWriter fw = null;
- try {
- fw = new FileWriter(new File(destDir, "Main.java"));
- fw.write(mcg.getClassContent());
- fw.close();
- }
- catch (IOException ex) {
- if (log.isErrorEnabled()) {
- log.error(ex);
- }
- }
- finally {
- try {
- fw.close();
- }
- catch (IOException ex) {
- log.error(ex);
- }
- }
-
- serializer.startTag("", "bean");
- serializer.attribute("", "id", "main");
- serializer.attribute("", "class", mo.getClassDescriptor().getPackageName() + ".Main");
- serializer.startTag("", "property");
- serializer.attribute("", "name", moClassName.replace(moClassName.charAt(0),
- Character.toLowerCase(moClassName.charAt(0))));
- serializer.startTag("", "ref");
- serializer.attribute("", "bean", moClassName.replace(moClassName.charAt(0),
- Character.toLowerCase(moClassName.charAt(0))));
- serializer.endTag("", "ref");
- serializer.endTag("", "property");
- serializer.endTag("", "bean");
- }
- /*<bean id = "articlesDao" class
-
- ="istia.st.articles.dao.ArticlesDaoPlainJdbc">
- <constructor-arg index="0">
- <value>org.firebirdsql.jdbc.FBDriver</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>jdbc:firebirdsql:localhost/3050:d:/databases/dbarticles.gdb</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>someone</value>
- </constructor-arg>
- <constructor-arg index="3">
- <value>somepassword</value>
- </constructor-arg>
- </bean>*/
-
-
+ catch (InstantiationException ex) {
+ log.error(ex);
}
- else if (log.isWarnEnabled()) {
- log.warn(mo.getClassDescriptor().getName() + " has already been generated and is up to date.");
+ catch (IllegalAccessException ex) {
+ log.error(ex);
}
+ catch (NullPointerException ex) {
+ log.error(ex);
+ }
}
- serializer.endTag("", "beans");
- serializer.endDocument();
-
- /*// pass 2
- if (!nextStep(LifeCycle.compile_second_pass, success)) {
- return false;
}
-
- assert guixFiles.size() == guixFileClassNames.size();
- List<File> jaxxFilesClone = new ArrayList<File>(guixFiles);
- for (String className : guixFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass");
- addProfileTime(compiler, currentPass.name() + "_start");
- if (log.isDebugEnabled()) {
- log.debug("runInitializers for " + className);
+ else {
+ if(log.isWarnEnabled()) {
+ log.warn("No generation language given");
+ }
}
- if (!compiler.isFailed()) {
- compiler.runInitializers();
- }
- if (log.isDebugEnabled()) {
- log.debug("compile second pass for " + className);
- }
- compiler.compileSecondPass();
- addProfileTime(compiler, currentPass.name() + "_end");
- if (log.isDebugEnabled()) {
- log.debug("done with result [" + !compiler.isFailed() + "] for " + className);
- }
- if (compiler.isFailed()) {
- success = false;
- }
- }
- if (!jaxxFilesClone.equals(guixFiles)) {
- throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + guixFiles + ")");
- }
- // stylesheet application
- if (!nextStep(LifeCycle.stylesheet_pass, success)) {
- return false;
- }
- assert guixFiles.size() == guixFileClassNames.size();
- for (String className : guixFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application");
- addProfileTime(compiler, currentPass.name() + "_start");
- compiler.applyStylesheets();
- addProfileTime(compiler, currentPass.name() + "_end");
- if (compiler.isFailed()) {
- success = false;
- }
- }
+ /*// pass 2
+ if (!nextStep(LifeCycle.compile_second_pass, success)) {
+ return false;
+ }
- // code generation
- if (!nextStep(LifeCycle.generate_pass, success)) {
- return false;
- }
- assert guixFiles.size() == guixFileClassNames.size();
- List<Generator> generators = new ArrayList<Generator>();
- for (Generator generator : ServiceLoader.load(Generator.class)) {
- generators.add(generator);
- }
- for (String className : guixFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
- addProfileTime(compiler, currentPass.name() + "_start");
- compiler.generateCode(generators);
- addProfileTime(compiler, currentPass.name() + "_end");
- //compiler.generateCode();
- if (compiler.isFailed()) {
- success = false;
- }
- }
+ assert guixFiles.size() == guixFileClassNames.size();
+ List<File> jaxxFilesClone = new ArrayList<File>(guixFiles);
+ for (String className : guixFileClassNames) {
+ JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass");
+ addProfileTime(compiler, currentPass.name() + "_start");
+ if (log.isDebugEnabled()) {
+ log.debug("runInitializers for " + className);
+ }
+ if (!compiler.isFailed()) {
+ compiler.runInitializers();
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("compile second pass for " + className);
+ }
+ compiler.compileSecondPass();
+ addProfileTime(compiler, currentPass.name() + "_end");
+ if (log.isDebugEnabled()) {
+ log.debug("done with result [" + !compiler.isFailed() + "] for " + className);
+ }
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ if (!jaxxFilesClone.equals(guixFiles)) {
+ throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + guixFiles + ")");
+ }
- if (options.isProfile()) {
- // profile pass (only if succes compile)
- if (!nextStep(LifeCycle.profile_pass, success)) {
- return false;
- }
- StringBuilder buffer = profiler.computeProfileReport();
- log.info(buffer.toString());
- }
+ // stylesheet application
+ if (!nextStep(LifeCycle.stylesheet_pass, success)) {
+ return false;
+ }
+ assert guixFiles.size() == guixFileClassNames.size();
+ for (String className : guixFileClassNames) {
+ JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application");
+ addProfileTime(compiler, currentPass.name() + "_start");
+ compiler.applyStylesheets();
+ addProfileTime(compiler, currentPass.name() + "_end");
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
- return report(success);
+ // code generation
+ if (!nextStep(LifeCycle.generate_pass, success)) {
+ return false;
+ }
+ assert guixFiles.size() == guixFileClassNames.size();
+ List<Generator> generators = new ArrayList<Generator>();
+ for (Generator generator : ServiceLoader.load(Generator.class)) {
+ generators.add(generator);
+ }
+ for (String className : guixFileClassNames) {
+ JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
+ addProfileTime(compiler, currentPass.name() + "_start");
+ compiler.generateCode(generators);
+ addProfileTime(compiler, currentPass.name() + "_end");
+ //compiler.generateCode();
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
- //FIXME : deal better the exception treatment...
- } catch (CompilerException e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
- return false;*/
- }
+ if (options.isProfile()) {
+ // profile pass (only if succes compile)
+ if (!nextStep(LifeCycle.profile_pass, success)) {
+ return false;
}
+ StringBuilder buffer = profiler.computeProfileReport();
+ log.info(buffer.toString());
+ }
+
+ return report(success);
+
+ //FIXME : deal better the exception treatment...
+ } catch (CompilerException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ return false;
+ }*/
+ }
catch (Throwable e) {
e.printStackTrace();
return false;
@@ -514,9 +409,9 @@
* @return false if another ClassDescriptor with the same classname
* and package has a different script or superclass
*/
- public boolean registerClassDescriptor(ClassDescriptor classDescriptor) {
+ public ClassDescriptor registerClassDescriptor(ClassDescriptor classDescriptor) {
if (classDescriptor == null || classDescriptor.getName() == null) {
- return false;
+ return null;
}
int i = 0;
while (i < classDescriptors.size() && (!classDescriptors.get(i).getName().equals(classDescriptor.getName()) || (classDescriptors.get(i).getPackageName() != null && classDescriptor.getPackageName() != null && !classDescriptors.get(i).getPackageName().equals(classDescriptor.getPackageName())))) {
@@ -528,8 +423,9 @@
if (log.isDebugEnabled()) {
log.debug("new ClassDescriptor " + classDescriptor + " inserted");
}
- return true;
+ return classDescriptor;
}
+ classDescriptors.get(i).setPackageName(classDescriptor.getPackageName());
if (classDescriptor.getScript() != null) {
if (classDescriptors.get(i).getScript() == null) {
classDescriptors.get(i).setScript(classDescriptor.getScript());
@@ -541,7 +437,7 @@
if (log.isDebugEnabled()) {
log.error("ClassDescriptor " + classDescriptor + " script already defined and different !");
}
- return false;
+ return null;
}
}
if (classDescriptor.getSuperClass() != null) {
@@ -555,9 +451,9 @@
if (log.isErrorEnabled()) {
log.error("ClassDescriptor " + classDescriptor + " superclass already defined and different !");
}
- return false;
+ return null;
}
}
- return true;
+ return classDescriptors.get(i);
}
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -143,7 +143,10 @@
// the class name is the name of the file minus the extension
String className = src.getName().substring(0, src.getName().lastIndexOf('.'));
- rootMO.setClassDescriptor(new ClassDescriptor(className, srcPackage));
+ // register the ClassDescriptor
+ ClassDescriptor cd = launcher.registerClassDescriptor(new ClassDescriptor(className, srcPackage));
+ rootMO.setClassDescriptor(cd);
+ failed = cd == null;
rootMO.getClassDescriptor().setSuperClass(new ClassDescriptor(tagName, tagPackageName));
rootMO.setAttributeDescriptors(getAttributes(xpp));
rootMO.setChildren(new ArrayList<GuixModelObject>());
@@ -184,9 +187,6 @@
// all the script tags have been recorded
rootMO.getClassDescriptor().setScript(script.toString());
- // register the root ClassDescriptor
- failed = !launcher.registerClassDescriptor(rootMO.getClassDescriptor());
-
return rootMO;
}
} catch (XmlPullParserException ex) {
@@ -247,7 +247,7 @@
// the parent is still the same
prev = previousMO;
} // if the tag is a script tag
- else if ((xpp.getName() != null) && xpp.getName().equals("script")) {
+ else if ((xpp.getName() != null) && xpp.getName().equals("script")) {
File scriptFile = null;
// the name of the file to load
@@ -268,7 +268,7 @@
// the parent is still the same
prev = previousMO;
} // if the tag is a class tag
- else {
+ else {
String tagNameSpace = xpp.getNamespace();
String tagPackageName = resolvePackageName(tagNameSpace, xpp.getName());
String tagName;
@@ -288,17 +288,18 @@
GuixModelObject mo = new GuixModelObject(id, javaDoc, xpp.getAttributeValue("", "styleClass"));
mo.setParent(previousMO);
- mo.setClassDescriptor(new ClassDescriptor(tagName, tagPackageName));
+ mo.setAttributeDescriptors(getAttributes(xpp));
mo.setChildren(new ArrayList<GuixModelObject>());
// add this GuixModelObject to the children of the parent
previousMO.getChildren().add(mo);
// register the ClassDescriptor
- failed = !launcher.registerClassDescriptor(mo.getClassDescriptor());
+ ClassDescriptor cd = launcher.registerClassDescriptor(new ClassDescriptor(tagName, tagPackageName));
+ mo.setClassDescriptor(cd);
+ failed = cd == null;
if (!failed) {
-
// parse the children of the tag
prev = mo;
} else {
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/databinding/BindingUtils.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,155 @@
+package org.nuiton.guix.databinding;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.swing.JToggleButton;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author kevin
+ */
+public class BindingUtils {
+ /** left brace matcher */
+ protected static Matcher leftBraceMatcher = Pattern.compile("^(\\{)|[^\\\\](\\{)").matcher("");
+ /** right brace matcher */
+ protected static Matcher rightBraceMatcher = Pattern.compile("^(\\})|[^\\\\](\\})").matcher("");
+ /** log */
+ private static Log log = LogFactory.getLog(BindingUtils.class);
+
+ /**
+ * Examine an attribute value for data binding expressions. Returns a 'cooked' expression which
+ * can be used to determine the resulting value. It is expected that this expression will be used
+ * as the source expression in a call to {@link #registerDataBinding}.
+ * If the attribute value does not invoke data binding, this method returns <code>null</code>
+ *
+ * @param stringValue the string value of the property from the XML
+ * @param type the type of the property, from the <code>JAXXPropertyDescriptor</code>
+ * @return a processed version of the expression
+ * @throws jaxx.CompilerException ?
+ */
+ public static String processDataBindings(String stringValue) {
+ int pos = getNextLeftBrace(stringValue, 0);
+ if (pos != -1) {
+ StringBuffer expression = new StringBuffer();
+ int lastPos = 0;
+ while (pos != -1 && pos < stringValue.length()) {
+ if (pos > lastPos) {
+ if (expression.length() > 0) {
+ expression.append(" + ");
+ }
+ expression.append('"');
+ expression.append(escapeJavaString(stringValue.substring(lastPos, pos)));
+ expression.append('"');
+ }
+
+ if (expression.length() > 0) {
+ expression.append(" + ");
+ }
+ int pos2 = getNextRightBrace(stringValue, pos + 1);
+ if (pos2 == -1) {
+ if(log.isErrorEnabled())
+ log.error("unmatched '{' in expression: " + stringValue);
+ return "";
+ }
+ expression.append(stringValue.substring(pos + 1, pos2));
+ pos2++;
+ if (pos2 < stringValue.length()) {
+ pos = getNextLeftBrace(stringValue, pos2);
+ lastPos = pos2;
+ } else {
+ pos = stringValue.length();
+ lastPos = pos;
+ }
+ }
+ if (lastPos < stringValue.length()) {
+ if (expression.length() > 0) {
+ expression.append(" + ");
+ }
+ expression.append('"');
+ expression.append(escapeJavaString(stringValue.substring(lastPos)));
+ expression.append('"');
+ }
+
+ StringBuffer el = new StringBuffer();
+ Pattern p = Pattern .compile("\\.(get|is)([A-Z])([a-zA-Z0-9]*)\\(\\)");
+ Matcher m = p.matcher(expression.toString());
+ int mEnd = 0;
+ if(m.find()) {
+ do {
+ el.append(expression.toString().substring(mEnd, m.start()))
+ .append(".");
+ mEnd = m.end();
+ el.append(m.group(2).toLowerCase())
+ .append(m.group(3));
+ } while (m.find());
+ }
+ else {
+ el.append(expression.toString());
+ }
+ return el.toString().length() > 0 ? el.toString().substring(0, el.toString().length()) : el.toString();
+ }
+ return null;
+ }
+
+ protected static int getNextLeftBrace(String string, int pos) {
+ leftBraceMatcher.reset(string);
+ return leftBraceMatcher.find(pos) ? Math.max(leftBraceMatcher.start(1), leftBraceMatcher.start(2)) : -1;
+ }
+
+ protected static int getNextRightBrace(String string, int pos) {
+ leftBraceMatcher.reset(string);
+ rightBraceMatcher.reset(string);
+ int openCount = 1;
+ int rightPos;
+ while (openCount > 0) {
+ pos++;
+ int leftPos = leftBraceMatcher.find(pos) ? Math.max(leftBraceMatcher.start(1), leftBraceMatcher.start(2)) : -1;
+ rightPos = rightBraceMatcher.find(pos) ? Math.max(rightBraceMatcher.start(1), rightBraceMatcher.start(2)) : -1;
+ assert leftPos == -1 || leftPos >= pos;
+ assert rightPos == -1 || rightPos >= pos;
+ if (leftPos != -1 && leftPos < rightPos) {
+ pos = leftPos;
+ openCount++;
+ } else if (rightPos != -1) {
+ pos = rightPos;
+ openCount--;
+ } else {
+ openCount = 0;
+ }
+ }
+ return pos;
+ }
+
+ /**
+ * Escapes a string using standard Java escape sequences, generally in preparation to including it in a string literal
+ * in a compiled Java file.
+ *
+ * @param raw the raw string to be escape
+ * @return a string in which all 'dangerous' characters have been replaced by equivalent Java escape sequences
+ */
+ protected static String escapeJavaString(String raw) {
+ StringBuffer out = new StringBuffer(raw);
+ for (int i = 0; i < out.length(); i++) {
+ char c = out.charAt(i);
+ if (c == '\\' || c == '"') {
+ out.insert(i, '\\');
+ i++;
+ } else if (c == '\n') {
+ out.replace(i, i + 1, "\\n");
+ i++;
+ } else if (c == '\r') {
+ out.replace(i, i + 1, "\\r");
+ i++;
+ } else if (c < 32 || c > 127) {
+ String value = Integer.toString((int) c, 16);
+ while (value.length() < 4) {
+ value = "0" + value;
+ }
+ out.replace(i, i + 1, "\\u" + value);
+ i += 5;
+ }
+ }
+ return out.toString();
+ }
+}
Deleted: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -1,87 +0,0 @@
-package org.nuiton.guix.generator;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.nuiton.guix.model.GuixModelObject;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-
-/**
- *
- * @author morin
- */
-public class AbstractClassGenerator extends GuixGenerator {
- public AbstractClassGenerator(GuixModelObject gmo) {
- super(gmo);
- }
-
- @Override
- public void generate(File out) {
- super.generate();
-
- if (!gmo.getJavadoc().equals("")) {
- sb.append("\n/**\n* ");
- sb.append(gmo.getJavadoc());
- sb.append("\n*/");
- }
-
- sb.append("\npublic abstract class ");
- sb.append(gmo.getClassDescriptor().getName());
- sb.append("Abstract implements ");
- sb.append(gmo.getClassDescriptor().getName());
- sb.append(" {\n");
- addAttributes(gmo);
- sb.append("\n\n\t//Getters and Setters");
- addGettersAndSetters(gmo);
- sb.append("\n\npublic abstract void test();\n\n}");
- saveFile(out);
- }
-
- @Override
- protected void addGettersAndSetters(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- sb.append("\n\n\tpublic ");
- sb.append(child.getClassDescriptor().getName());
- sb.append(" get");
- sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
- sb.append("() {\n\t\treturn this.");
- sb.append(((child.getId() != null) &&!child.getId().equals(""))
- ? child.getId()
- : "test");
- sb.append(";\n\t}");
- sb.append("\n\n\tpublic ");
- sb.append("void set");
- sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
- sb.append("(");
- sb.append(child.getClassDescriptor().getName());
- sb.append(" ");
- sb.append(child.getId());
- sb.append("){\n\t\tthis.");
- sb.append(child.getId());
- sb.append(" = ");
- sb.append(child.getId());
- sb.append(";\n\t}");
- addGettersAndSetters(child);
- }
- }
-
- private void addAttributes(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- if (!child.getJavadoc().equals("")) {
- sb.append("\n\t/**\n\t * ");
- sb.append(child.getJavadoc());
- sb.append("\n\t */");
- }
-
- sb.append("\n\tprivate ");
- sb.append(child.getClassDescriptor().getName());
- sb.append(" ");
- sb.append(child.getId());
- sb.append(";\n");
- addAttributes(child);
- }
- }
-}
-
Copied: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java (from rev 1395, guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java)
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,30 @@
+package org.nuiton.guix.generator;
+import java.io.File;
+import org.nuiton.guix.model.GuixModelObject;
+import org.xmlpull.v1.XmlSerializer;
+
+/**
+ *
+ * @author kevin
+ */
+public interface Generator {
+
+ public void generate();
+
+ public File getDestDir();
+
+ public void setDestDir(File destDir);
+
+ public GuixModelObject getGmo();
+
+ public void setGmo(GuixModelObject gmo);
+
+ public Long getLastModification();
+
+ public void setLastModification(Long lastModification);
+
+ public boolean isMainClass();
+
+ public void setMainClass(boolean mainClass);
+
+}
Property changes on: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/Generator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -1,81 +1,56 @@
-package org.nuiton.guix.generator;
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+package org.nuiton.guix.generator;
+import java.io.File;
import org.nuiton.guix.model.GuixModelObject;
+import org.xmlpull.v1.XmlSerializer;
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import java.util.ArrayList;
-import java.util.List;
-
/**
- * GuixGenerator
*
+ * @author kevin
*/
-public abstract class GuixGenerator {
+public abstract class GuixGenerator implements Generator {
- /** log */
- protected Log log = LogFactory.getLog(GuixGenerator.class);
- protected StringBuffer sb = new StringBuffer();
- protected List<String> classes = new ArrayList<String>();
- protected GuixModelObject gmo;
+ protected GuixModelObject gmo = null;
+ protected File destDir = null;
+ protected boolean mainClass = false;
+ protected Long lastModification = null;
- public GuixGenerator(GuixModelObject gmo) {
- this.gmo = gmo;
+ public abstract void generate();
+
+ public File getDestDir() {
+ return destDir;
}
- public abstract void generate(File out);
+ public void setDestDir(File destDir) {
+ this.destDir = destDir;
+ }
- protected void generate() {
- sb.append("package ");
- sb.append(gmo.getClassDescriptor().getPackageName());
- sb.append(";\n\n");
- addImports(gmo);
+ public GuixModelObject getGmo() {
+ return gmo;
}
- protected abstract void addGettersAndSetters(GuixModelObject gmo);
+ public void setGmo(GuixModelObject gmo) {
+ this.gmo = gmo;
+ }
- protected void addImports(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- String fqn = child.getClassDescriptor().getPackageName() + "." + child.getClassDescriptor().getName();
+ public Long getLastModification() {
+ return lastModification;
+ }
- if (!classes.contains(fqn)) {
- classes.add(fqn);
- sb.append("import " + fqn + ";\n");
- }
+ public void setLastModification(Long lastModification) {
+ this.lastModification = lastModification;
+ }
- addImports(child);
- }
+ public boolean isMainClass() {
+ return mainClass;
}
- protected void saveFile(File out) {
- FileWriter fw = null;
-
- try {
- fw = new FileWriter(out);
- fw.write(sb.toString());
- fw.close();
- } catch (IOException ex) {
- if (log.isErrorEnabled()) {
- log.error(ex);
- }
- } finally {
- try {
- fw.close();
- } catch (IOException ex) {
- log.error(ex);
- }
- }
+ public void setMainClass(boolean mainClass) {
+ this.mainClass = mainClass;
}
-}
-
-//~ Formatted by Jindent --- http://www.jindent.com
+}
Deleted: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -1,51 +0,0 @@
-
-/*
-* To change this template, choose Tools | Templates
-* and open the template in the editor.
- */
-package org.nuiton.guix.generator;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.nuiton.guix.model.GuixModelObject;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- *
- * @author morin
- */
-public class ImplementationGenerator extends GuixGenerator {
- public ImplementationGenerator(GuixModelObject gmo) {
- super(gmo);
- }
-
- @Override
- public void generate(File out) {
- super.generate();
-
- if (!gmo.getJavadoc().equals("")) {
- sb.append("\n/**\n * ");
- sb.append(gmo.getJavadoc());
- sb.append("\n */");
- }
-
- sb.append("\npublic class ");
- sb.append(gmo.getClassDescriptor().getName());
- sb.append("Impl extends ");
- sb.append(gmo.getClassDescriptor().getName());
- sb.append("Abstract {\n");
- sb.append("public void test() {System.out.println(\"ca marche\");}");
- sb.append("\n\n}");
- saveFile(out);
- }
-
- @Override
- protected void addGettersAndSetters(GuixModelObject gmo) {}
-}
-
-
-//~ Formatted by Jindent --- http://www.jindent.com
Deleted: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -1,62 +0,0 @@
-package org.nuiton.guix.generator;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.nuiton.guix.model.GuixModelObject;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Generator of interfaces
- *
- * @author morin
- */
-public class InterfaceGenerator extends GuixGenerator {
- public InterfaceGenerator(GuixModelObject gmo) {
- super(gmo);
- }
-
- @Override
- public void generate(File out) {
- super.generate();
- sb.append("\npublic interface ");
- sb.append(gmo.getClassDescriptor().getName());
- sb.append(" {\n");
- sb.append("\n\t//Getters and Setters");
- addGettersAndSetters(gmo);
- sb.append("\n\npublic void test();\n\n}");
- saveFile(out);
- }
-
- @Override
- protected void addGettersAndSetters(GuixModelObject gmo) {
- for (GuixModelObject child : gmo.getChildren()) {
- sb.append("\n\n\tpublic ");
- sb.append(child.getClassDescriptor().getName());
- sb.append(" get");
- sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
- sb.append("();");
- sb.append("\n\n\tpublic ");
- sb.append("void set");
- sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
- sb.append("(");
- sb.append(child.getClassDescriptor().getName());
- sb.append(" ");
- sb.append(child.getId());
- sb.append(");");
- addGettersAndSetters(child);
- }
- }
-}
-
-
-//~ Formatted by Jindent --- http://www.jindent.com
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaArgument.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaArgument.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaArgument.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.generator;
+
+/**
+ * Represents an argument to a <code>JavaMethod</code>.
+ *
+ * @see JavaMethod
+ */
+public class JavaArgument {
+ private String name;
+ private String type;
+ private boolean isFinal;
+
+
+ /**
+ * Creates a new <code>JavaArgument</code> with the specified name and type. For example, the method <code>main()</code>
+ * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>.
+ *
+ * @param type the argument's type, as it would appear in Java source code
+ * @param name the argument's name
+ */
+ public JavaArgument(String type, String name) {
+ this(type, name, false);
+ }
+
+
+ /**
+ * Creates a new <code>JavaArgument</code> with the specified name, type, and finality. For example, the method <code>main()</code>
+ * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. The
+ * <code>isFinal</code> parameter allows the presence of the <code>final</code> keyword on the argument to be controlled.
+ *
+ * @param type the argument's type, as it would appear in Java source code
+ * @param name the argument's name
+ * @param isFinal <code>true</code> if the argument should be marked final
+ */
+ public JavaArgument(String type, String name, boolean isFinal) {
+ this.type = type;
+ this.name = name;
+ this.isFinal = isFinal;
+ }
+
+
+ /**
+ * Returns the argument's name.
+ *
+ * @return the name of the argument
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * Returns the argument's type as it would be represented in Java source code.
+ *
+ * @return the argument's type
+ */
+ public String getType() {
+ return type;
+ }
+
+
+ /**
+ * Returns <code>true</code> if the <code>final</code> keyword should appear before the argument.
+ *
+ * @return <code>true</code> if the argument is final
+ */
+ public boolean isFinal() {
+ return isFinal;
+ }
+
+
+ /**
+ * Returns the Java source code for this argument.
+ *
+ * @return the Java source code for this argument
+ */
+ @Override
+ public String toString() {
+ String result = type + ' ' + name;
+ return isFinal ? "final " + result : result;
+ }
+}
\ No newline at end of file
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaField.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.generator;
+
+import java.lang.reflect.Modifier;
+import java.util.Comparator;
+
+/**
+ * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created
+ * and added to a {@link JavaFile}, which can then output Java source code.
+ */
+public class JavaField implements Comparable<JavaField> {
+
+ private int modifiers;
+ private String type;
+ private String name;
+ private String initializer;
+
+
+ /**
+ * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be
+ * represented as it would appear in Java source code.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the field's declaration
+ * @param type the type of the field as it would appear in Java source code
+ * @param name the field's name
+ */
+ public JavaField(int modifiers, String type, String name) {
+ this(modifiers, type, name, null);
+ }
+
+
+ /**
+ * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be
+ * represented as it would appear in Java source code. The <code>initializer</code> is the initial
+ * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the
+ * default value.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the field's declaration
+ * @param type the type of the field as it would appear in Java source code
+ * @param name the field's name
+ * @param initializer the initial value of the field, as it would appear in Java source code
+ */
+ public JavaField(int modifiers, String type, String name, String initializer) {
+ this.modifiers = modifiers;
+ this.type = type;
+ this.name = name;
+ this.initializer = initializer;
+ }
+
+
+ /**
+ * Returns a bit mask describing the modifier keywords which should appear as part of this field's
+ * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this
+ * field.
+ *
+ * @return the modifier bit mask
+ */
+ public int getModifiers() {
+ return modifiers;
+ }
+
+
+ /**
+ * Returns the field's name.
+ *
+ * @return the field's name
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * Returns the field's type, as it would be represented in Java source code.
+ *
+ * @return the field's type
+ */
+ public String getType() {
+ return type;
+ }
+
+
+ /**
+ * Returns the Java source code for this field.
+ *
+ * @param lineSeparator line separator
+ * @return the Java source code for this field
+ */
+ public String toString(String lineSeparator) {
+ StringBuffer result = new StringBuffer();
+ result.append(JavaFile.getModifiersText(modifiers));
+ result.append(type).append(' ').append(name);
+ if (initializer != null) {
+ result.append(" = ").append(initializer);
+ }
+ result.append(';').append(lineSeparator);
+ return result.toString();
+ }
+
+ public int compareTo(JavaField o) {
+ return COMPARATOR.compare(this, o);
+ }
+
+ public static final Comparator<JavaField> COMPARATOR = new Comparator<JavaField>() {
+
+ public int compare(JavaField o1, JavaField o2) {
+
+ int result;
+ if ((result = compareStatic(o1, o2)) != 0) {
+ return result;
+ }
+
+ // data sources must be on the last after all other fields
+ if ((result = compareDataSource(o1, o2)) != 0) {
+ return result;
+ }
+
+ // same static
+ if ((result = compareVisibility(o1, o2)) != 0) {
+ return result;
+ }
+ // same visibility, test name
+ return o1.name.compareTo(o2.name);
+ }
+
+ public int compareStatic(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (Modifier.isStatic(o1.modifiers) && !Modifier.isStatic(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isStatic(o1.modifiers) && Modifier.isStatic(o2.modifiers)) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareDataSource(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (o1.name.startsWith("$DataSource") && !o2.name.startsWith("$DataSource")) {
+ return 1;
+ }
+ if (!o1.name.startsWith("$DataSource") && o2.name.startsWith("$DataSource")) {
+ return -1;
+ }
+ return 0;
+ }
+
+ public int compareVisibility(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (!Modifier.isPublic(o1.modifiers) && Modifier.isPublic(o2.modifiers)) {
+ return 1;
+ }
+
+ if (Modifier.isPublic(o1.modifiers) && !Modifier.isPublic(o2.modifiers)) {
+ return -1;
+ }
+
+ if (Modifier.isProtected(o1.modifiers) && !Modifier.isProtected(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isProtected(o1.modifiers) && Modifier.isProtected(o2.modifiers)) {
+ return 1;
+ }
+
+ if (Modifier.isPrivate(o1.modifiers) && !Modifier.isPrivate(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isPrivate(o1.modifiers) && Modifier.isPrivate(o2.modifiers)) {
+ return 1;
+ }
+ return 0;
+ }
+ };
+
+ public static JavaField newField(int modifiers, String returnType, String name) {
+ return newField(modifiers, returnType, name, null);
+ }
+
+ public static JavaField newField(int modifiers, String returnType, String name, String initializer) {
+ return new JavaField(modifiers, returnType, name, initializer);
+ }
+}
\ No newline at end of file
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFile.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,337 @@
+package org.nuiton.guix.generator;
+
+import org.nuiton.guix.generator.JavaMethod.MethodOrder;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map.Entry;
+
+/**
+ * A Java source file being generated for output. Once the class is completely initialized, use the
+ * {@link #toString} method to generate source code for it.
+ */
+public class JavaFile {
+
+ protected static final String GETTER_PATTERN = "return %1$s;";
+
+ protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;";
+
+ protected static final String SETTER_PATTERN = "this.%2$s = newValue;";
+
+ private int modifiers;
+ private String packageName;
+ private String className;
+ private List<String> imports = new ArrayList<String>();
+ private List<JavaField> fields = new ArrayList<JavaField>();
+ private List<JavaMethod> methods = new ArrayList<JavaMethod>();
+ private List<JavaFile> innerClasses = new ArrayList<JavaFile>();
+ private String superClass;
+ private List<String> interfaces;
+ private StringBuffer rawBodyCode = new StringBuffer();
+ private boolean superclassIsGuixObject;
+ private String genericType;
+ private String superGenericType;
+
+
+ public JavaFile() {
+ }
+
+
+ public JavaFile(String packageName, int modifiers, String className, String superClass) {
+ this(packageName, modifiers, className, superClass, null);
+ }
+
+
+ public JavaFile(String packageName, int modifiers, String className, String superClass, List<String> interfaces) {
+ this.packageName = packageName;
+ this.modifiers = modifiers;
+ this.className = className;
+ this.superClass = superClass;
+ this.interfaces = interfaces;
+ }
+
+
+ public void addImport(String importString) {
+ imports.add(importString);
+ }
+
+ public void addImport(Class importString) {
+ imports.add(importString.getName());
+ }
+
+
+ public String[] getImports() {
+ return imports.toArray(new String[imports.size()]);
+ }
+
+ public int getModifiers() {
+ return modifiers;
+ }
+
+
+ public void setModifiers(int modifiers) {
+ this.modifiers = modifiers;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ public void setPackageName(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+ public String getSuperClass() {
+ return superClass;
+ }
+
+
+ public void setSuperClass(String superClass) {
+ this.superClass = superClass;
+ }
+
+
+ public List<String> getInterfaces() {
+ if (interfaces == null) {
+ interfaces = new ArrayList<String>();
+ }
+ return interfaces;
+ }
+
+
+ public void setInterfaces(List<String> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public void setGenericType(String genericType) {
+ this.genericType = genericType;
+ }
+
+ public void addMethod(JavaMethod method) {
+ methods.add(method);
+ }
+
+
+ public JavaMethod[] getMethods() {
+ return methods.toArray(new JavaMethod[methods.size()]);
+ }
+
+ public void addField(JavaField field) {
+ addField(field, false);
+ }
+
+ public void addField(JavaField field, boolean javaBean) {
+ addSimpleField(field);
+ String id = field.getName();
+ String capitalizedName = (id.length()>0)? Character.toUpperCase(id.charAt(0))+id.substring(1) : id;
+ // add getter file
+ String content = String.format(GETTER_PATTERN, id);
+ addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(),
+ "get" + capitalizedName, null, null, content));
+
+ if (javaBean) {
+ // add full javabean support
+ if (Boolean.class.getName().equals(field.getType())) {
+ content = String.format(BOOLEAN_GETTER_PATTERN, id);
+ addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content));
+ }
+ content = String.format(SETTER_PATTERN, field.getType(), id);
+ JavaArgument arg = new JavaArgument(field.getType(), "newValue");
+ addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content));
+ }
+ }
+
+ public void addSimpleField(JavaField field) {
+ fields.add(field);
+ }
+
+
+ public JavaField[] getFields() {
+ return fields.toArray(new JavaField[fields.size()]);
+ }
+
+
+ public static String addIndentation(String source, int indentation, String lineSeparator) {
+ return indent(source, indentation, false, lineSeparator);
+ }
+
+
+ public static String setIndentation(String source, int indentation, String lineSeparator) {
+ return indent(source, indentation, true, lineSeparator);
+ }
+
+
+ public static String indent(String source, int indentation, boolean trim, String lineSeparator) {
+ if (trim) {
+ source = source.trim();
+ }
+ char[] spaces = new char[indentation];
+ Arrays.fill(spaces, ' ');
+ StringBuffer result = new StringBuffer();
+ String[] lines = source.split(System.getProperty("line.separator") + "|\n");
+ for (int i = 0; i < lines.length; i++) {
+ if (i > 0) {
+ result.append(lineSeparator);
+ }
+ result.append(spaces);
+ result.append(trim ? lines[i].trim() : lines[i]);
+ }
+ return result.toString();
+ }
+
+
+ public void addBodyCode(String bodyCode) {
+ rawBodyCode.append(bodyCode);
+ }
+
+
+ public String getClassBody(String lineSeparator) {
+ StringBuffer result = new StringBuffer();
+ if (fields.size() > 0) {
+ java.util.Collections.sort(fields); // sort fields
+
+ for (JavaField field : fields) {
+ result.append(addIndentation(field.toString(lineSeparator), 4, lineSeparator));
+ result.append(lineSeparator);
+ }
+
+ result.append(lineSeparator);
+ }
+
+ if (rawBodyCode.length() > 0) {
+ result.append(addIndentation("/* begin raw body code */\n", 4, lineSeparator));
+ String s = rawBodyCode.toString();
+ if (!s.startsWith(lineSeparator)) {
+ result.append(lineSeparator);
+ }
+ result.append(addIndentation(s, 4, lineSeparator));
+ result.append(lineSeparator);
+ result.append(addIndentation("/* end raw body code */", 4, lineSeparator));
+ result.append(lineSeparator);
+ }
+
+ for (JavaFile innerClass : innerClasses) {
+ result.append(addIndentation(innerClass.toString(), 4, lineSeparator));
+ result.append(lineSeparator).append(lineSeparator);
+ }
+
+ EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods);
+ for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) {
+ List<JavaMethod> list = entry.getValue();
+ entry.getKey().generate(result, list, lineSeparator);
+ list.clear();
+ }
+ map.clear();
+
+ return result.toString();
+ }
+
+
+ public String getClassDefinition(String lineSeparator) {
+ StringBuffer result = new StringBuffer();
+ result.append(getModifiersText(modifiers))
+ .append("class ")
+ .append(className.substring(className.lastIndexOf(".") + 1));
+ if (genericType != null) {
+ result.append('<').append(genericType).append('>');
+ }
+ if(superClass != null) {
+ result.append(" extends ");
+ result.append(superClass);
+ if (superGenericType != null) {
+ result.append('<').append(superGenericType).append('>');
+ }
+ }
+ if (interfaces != null && !interfaces.isEmpty()) {
+ result.append(" implements ").append(interfaces.get(0));
+ for (int i = 1; i < interfaces.size(); i++) {
+ result.append(", ").append(interfaces.get(i));
+ }
+ }
+ result.append(" {");
+ result.append(lineSeparator);
+ result.append(getClassBody(lineSeparator));
+ result.append("}");
+ return result.toString();
+ }
+
+
+ public static String getModifiersText(int modifiers) {
+ if (modifiers == 0) {
+ return "";
+ } else {
+ return Modifier.toString(modifiers) + ' ';
+ }
+ }
+
+
+ /**
+ * Returns the Java source code for this class.
+ *
+ * @param lineSeparator line separator
+ * @return a complete Java file for this class
+ */
+ public String toString(String lineSeparator) {
+ StringBuffer result = new StringBuffer();
+ if (packageName != null && !packageName.equals("")) {
+ result.append("package ").append(packageName).append(";");
+ result.append(lineSeparator);
+ result.append(lineSeparator);
+ }
+
+ if (imports.size() > 0) {
+ for (String anImport : imports) {
+ result.append("import ");
+ result.append(anImport);
+ result.append(';');
+ result.append(lineSeparator);
+ }
+ result.append(lineSeparator);
+ }
+
+ result.append(getClassDefinition(lineSeparator));
+ return result.toString();
+ }
+
+ public void addInterface(String canonicalName) {
+ if (interfaces == null || !interfaces.contains(canonicalName)) {
+ getInterfaces().add(canonicalName);
+ }
+ }
+
+ public void addInterfaces(String[] canonicalNames) {
+ if (canonicalNames == null) {
+ return;
+ }
+ for (String canonicalName : canonicalNames) {
+ if (interfaces == null || !interfaces.contains(canonicalName)) {
+ getInterfaces().add(canonicalName);
+ }
+ }
+ }
+
+ public boolean isSuperclassIsGuixObject() {
+ return superclassIsGuixObject;
+ }
+
+ public void setSuperclassIsGuixObject(boolean superclassIsGuixObject) {
+ this.superclassIsGuixObject = superclassIsGuixObject;
+ }
+
+ public void setSuperGenericType(String superGenericType) {
+ this.superGenericType = superGenericType;
+ }
+}
\ No newline at end of file
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaFileGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,75 @@
+package org.nuiton.guix.generator;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * GuixGenerator
+ *
+ */
+public abstract class JavaFileGenerator {
+
+ /** log */
+ protected Log log = LogFactory.getLog(JavaFileGenerator.class);
+ protected StringBuffer sb = new StringBuffer();
+ protected List<String> classes = new ArrayList<String>();
+ protected GuixModelObject gmo;
+ protected JavaFile jf;
+
+ public JavaFileGenerator(GuixModelObject gmo) {
+ this.gmo = gmo;
+ }
+
+ public abstract void generate(File out);
+
+ protected void generate() {
+ addImports(gmo);
+ }
+
+ protected void addImports(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ String fqn = child.getClassDescriptor().getPackageName() + "." + child.getClassDescriptor().getName();
+
+ if (!classes.contains(fqn)) {
+ classes.add(fqn);
+ jf.addImport(fqn);
+ }
+
+ addImports(child);
+ }
+ }
+
+ protected void saveFile(File out) {
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(out);
+ fw.write(jf.toString("\n"));
+ fw.close();
+ } catch (IOException ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ }
+ } finally {
+ try {
+ fw.close();
+ } catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ }
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/JavaMethod.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -0,0 +1,504 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package org.nuiton.guix.generator;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Represents a method in a Java source file being generated for output. <code>JavaMethods</code> are created
+ * and added to a {@link JavaFile}, which can then output Java source code. In addition to normal methods, a
+ * <code>JavaMethod</code> can represent a constructor -- constructors should be named after their containing
+ * classes and have a return type of <code>null</code>.
+ */
+public class JavaMethod implements Comparable<JavaMethod> {
+ private int modifiers;
+ private String returnType;
+ private String name;
+ private JavaArgument[] arguments;
+ private String[] exceptions;
+ private StringBuffer bodyCode;
+
+
+ /**
+ * Constructs a new no-argument <code>JavaMethod</code> which throws no checked exceptions. The
+ * <code>modifiers</code> parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier},
+ * and the <code>returnType</code> of the method should be represented as it would appear in Java source
+ * code (<code>null</code> for a constructor). The method body is initially empty.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the method's declaration
+ * @param returnType the return type of the method as it would appear in Java source code
+ * @param name the method's name
+ * @see #appendBodyCode
+ */
+ //public JavaMethod(int modifiers, String returnType, String name) {
+ // this(modifiers, returnType, name, null);
+ //}
+
+
+ /**
+ * Constructs a new <code>JavaMethod</code> which throws no checked exceptions. The <code>modifiers</code>
+ * parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the
+ * <code>returnType</code> of the method should be represented as it would appear in Java source code
+ * (<code>null</code> for a constructor). The method body is initially empty.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the method's declaration
+ * @param returnType the return type of the method as it would appear in Java source code
+ * @param name the method's name
+ * @param arguments the method's arguments
+ * @see #appendBodyCode
+ */
+ //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments) {
+ // this(modifiers, returnType, name, arguments, null);
+ //}
+
+
+ /**
+ * Constructs a new <code>JavaMethod</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and <code>exceptions</code>
+ * of the method should be represented as they would appear in Java source code (<code>null</code> for a
+ * constructor). The method body is initially empty.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the method's declaration
+ * @param returnType the return type of the method as it would appear in Java source code
+ * @param name the method's name
+ * @param arguments the method's arguments
+ * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code
+ * @see #appendBodyCode
+ */
+ //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions) {
+ // this(modifiers, returnType, name, arguments, exceptions, null);
+ //}
+
+
+ /**
+ * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter
+ * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and
+ * <code>exceptions</code> of the method should be represented as they would appear in Java source code (<code>null</code>
+ * for a constructor). The method body is initially empty.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the method's declaration
+ * @param returnType the return type of the method as it would appear in Java source code
+ * @param name the method's name
+ * @param arguments the method's arguments
+ * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code
+ * @param bodyCode Java source code which should appear in the method body
+ */
+ public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode) {
+ this.modifiers = modifiers;
+ this.returnType = returnType;
+ this.name = name;
+ this.arguments = arguments;
+ this.exceptions = exceptions;
+ this.bodyCode = bodyCode != null ? new StringBuffer(bodyCode) : null;
+ }
+
+
+ /**
+ * Returns a bit mask describing the modifier keywords which should appear as part of this method's
+ * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this
+ * field.
+ *
+ * @return the modifier bit mask
+ */
+ public int getModifiers() {
+ return modifiers;
+ }
+
+
+ /**
+ * Returns the method's return type, as it would be represented in Java source code.
+ *
+ * @return the method's return type
+ */
+ public String getReturnType() {
+ return returnType;
+ }
+
+
+ /**
+ * Returns the method's name.
+ *
+ * @return the method's name
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * Returns a list of the method's arguments.
+ *
+ * @return the method's arguments
+ */
+ public JavaArgument[] getArguments() {
+ return arguments;
+ }
+
+
+ /**
+ * Returns a list of exceptions the method can throw.
+ *
+ * @return the method's exceptions
+ */
+ public String[] getExceptions() {
+ return exceptions;
+ }
+
+
+ /**
+ * Returns the Java source code for the method's body.
+ *
+ * @return the method's body code
+ */
+ public String getBodyCode() {
+ return bodyCode.toString();
+ }
+
+
+ /**
+ * Appends additional code to the method's body.
+ *
+ * @param extraCode Java source code to append to the method's body
+ * @param lineSeparator line separator
+ */
+ public void appendBodyCode(String extraCode, String lineSeparator) {
+ if (extraCode.length() == 0) {
+ return;
+ }
+ if (bodyCode.length() > 0 && !bodyCode.toString().endsWith(lineSeparator)) {
+ bodyCode.append(lineSeparator);
+ }
+ bodyCode.append(extraCode);
+ }
+
+
+ /**
+ * Returns the Java source code for this method.
+ *
+ * @param lineSeparator line separator
+ * @return the Java source code for this method
+ */
+ public String toString(String lineSeparator) {
+ StringBuffer result = new StringBuffer();
+ result.append(JavaFile.getModifiersText(modifiers));
+ if (returnType != null) {
+ result.append(returnType);
+ result.append(' ');
+ }
+ result.append(name);
+ result.append('(');
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ if (i > 0) {
+ result.append(", ");
+ }
+ result.append(arguments[i].toString());
+ }
+ }
+ result.append(")");
+
+ if (bodyCode != null) {
+ result.append(" {");
+ result.append(lineSeparator);
+ String formattedBodyCode = JavaFile.addIndentation(bodyCode.toString().trim(), 4, lineSeparator);
+ if (formattedBodyCode.length() > 0) {
+ result.append(formattedBodyCode);
+ result.append(lineSeparator);
+ }
+ result.append("}");
+ }
+ else {
+ result.append(";");
+ }
+ return result.toString();
+ }
+
+ public int compareTo(JavaMethod o) {
+ return COMPARATOR.compare(this, o);
+ }
+
+ public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, String[] exceptions, JavaArgument... arguments) {
+ return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer);
+ }
+
+ public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, JavaArgument... arguments) {
+ return newMethod(modifiers, returnType, name, initializer, new String[0], arguments);
+ }
+
+ public enum MethodOrder {
+
+ statics(Modifier.STATIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Statics methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ },
+
+ constructors(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Constructors -----------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return method.returnType == null;
+ }
+ },
+
+ JAXXObject(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXObject implementation ----------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ private List<String> methods = Arrays.asList("applyDataBinding", "firePropertyChange", "getObjectById", "get$objectMap", "processDataBinding", "removeDataBinding");
+
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.name);
+ }
+ },
+
+ JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXContext implementation ---------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ private List<String> methods = Arrays.asList("getContextValue", "getDelegateContext", "getParentContainer", "removeContextValue", "setContextValue");
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.name);
+ }
+ },
+
+ JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXValidation implementation ------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ private List<String> methods = Arrays.asList("getValidator", "getValidatorIds");
+
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.name);
+ }
+ },
+
+ events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Event methods ----------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return (method.name.startsWith("do") && method.name.indexOf("__") > -1);
+ }
+ },
+
+ publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public acessor methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return (method.name.startsWith("get") || method.name.startsWith("is"));
+ }
+ },
+
+ publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public mutator methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return (method.name.startsWith("set"));
+ }
+ },
+
+ otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public mutator methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ @Override
+ public boolean accept(int mod) {
+ return super.accept(mod) && !Modifier.isStatic(mod);
+ }
+ },
+
+ protectedGetters(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- protected acessors methods ---------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return (method.name.startsWith("get") || method.name.startsWith("is"));
+ }
+ },
+
+ createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- ui creation methods ----------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ public boolean accept(JavaMethod method) {
+ return method.name.startsWith("create") || method.name.startsWith("add") ||
+ method.name.equals("$completeSetup") ||
+ method.name.equals("$initialize");
+ }
+ },
+
+ protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Other protected methods ------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ },
+
+ packageLocal(0, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Package methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ @Override
+ public boolean accept(int mod) {
+ return !Modifier.isStatic(mod) && !Modifier.isPublic(mod) && !Modifier.isProtected(mod);
+ }},
+
+ privates(Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Private methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ };
+
+ private final String header;
+
+ private int modifier;
+
+ MethodOrder(int modifier, String header) {
+ this.header = header;
+ this.modifier = modifier;
+ }
+
+ public String getHeader() {
+ return header;
+ }
+
+ public boolean accept(JavaMethod method) {
+ return true;
+ }
+
+ public boolean accept(int mod) {
+ return (mod & modifier) != 0;
+ }
+
+ public boolean accept(int mod, JavaMethod method) {
+ return accept(mod) && accept(method);
+ }
+
+ public static MethodOrder valueOf(JavaMethod method, int scope) {
+ for (MethodOrder o : values()) {
+ if (o.accept(scope, method)) {
+ return o;
+ }
+ }
+ throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + method);
+ }
+
+ public void generate(StringBuffer buffer, List<JavaMethod> methods, String lineSeparator) {
+ if (methods.isEmpty()) {
+ return;
+ }
+ buffer.append(JavaFile.addIndentation(header, 4, lineSeparator));
+ buffer.append(lineSeparator).append(lineSeparator);
+ for (JavaMethod method : methods) {
+ buffer.append(JavaFile.addIndentation(method.toString(lineSeparator), 4, lineSeparator));
+ buffer.append(lineSeparator).append(lineSeparator);
+ }
+ }
+ }
+
+ public static EnumMap<MethodOrder, List<JavaMethod>> getSortedMethods(List<JavaMethod> methods) {
+
+ EnumMap<MethodOrder, List<JavaMethod>> result = new EnumMap<MethodOrder, List<JavaMethod>>(MethodOrder.class);
+ for (MethodOrder methodOrder : MethodOrder.values()) {
+ result.put(methodOrder, new ArrayList<JavaMethod>());
+ }
+
+ EnumSet<MethodOrder> allConstants = EnumSet.allOf(MethodOrder.class);
+ List<JavaMethod> allMethods = new ArrayList<JavaMethod>(methods);
+ int[] scopes = new int[]{Modifier.STATIC, Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE};
+ for (int scope : scopes) {
+ EnumSet<MethodOrder> constants = getMethodOrderScope(allConstants, scope);
+
+ Iterator<JavaMethod> itMethods = allMethods.iterator();
+ while (itMethods.hasNext()) {
+ JavaMethod method = itMethods.next();
+ for (MethodOrder constant : constants) {
+ if (constant.accept(method.getModifiers(), method)) {
+ result.get(constant).add(method);
+ itMethods.remove();
+ break;
+ }
+ }
+ }
+ constants.clear();
+ }
+
+ if (!allMethods.isEmpty()) {
+ throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + allMethods);
+ }
+
+ for (MethodOrder methodOrder : MethodOrder.values()) {
+ // sort methods
+ java.util.Collections.sort(result.get(methodOrder));
+ }
+ return result;
+ }
+
+ public static EnumSet<MethodOrder> getMethodOrderScope(EnumSet<MethodOrder> allConstants, int scope) {
+ EnumSet<MethodOrder> constants = EnumSet.noneOf(MethodOrder.class);
+ for (MethodOrder order : allConstants) {
+ if (order.accept(scope)) {
+ constants.add(order);
+ }
+ }
+ return constants;
+ }
+
+ public static final Comparator<JavaMethod> COMPARATOR = new Comparator<JavaMethod>() {
+
+ public int compare(JavaMethod o1, JavaMethod o2) {
+
+ /*int result;
+ if ((result = compareStatic(o1, o2)) != 0) {
+ return result;
+ }
+ if ((result = compareConstructor(o1, o2)) != 0) {
+ return result;
+ }
+ if ((result = compareVisibility(o1, o2)) != 0) {
+ return result;
+ }*/
+ return o1.name.compareTo(o2.name);
+ }
+
+ public int compareStatic(JavaMethod o1, JavaMethod o2) {
+ if (Modifier.isStatic(o1.modifiers) && !Modifier.isStatic(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isStatic(o1.modifiers) && Modifier.isStatic(o2.modifiers)) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareConstructor(JavaMethod o1, JavaMethod o2) {
+ if (o1.returnType == null && o2.returnType != null) {
+ return -1;
+ }
+ if (o1.returnType != null && o2.returnType == null) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareVisibility(JavaMethod o1, JavaMethod o2) {
+ if (Modifier.isPublic(o1.modifiers) && !Modifier.isPublic(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isPublic(o1.modifiers) && Modifier.isPublic(o2.modifiers)) {
+ return 1;
+ }
+ if (Modifier.isProtected(o1.modifiers) && !Modifier.isProtected(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isProtected(o1.modifiers) && Modifier.isProtected(o2.modifiers)) {
+ return 1;
+ }
+ if (Modifier.isPrivate(o1.modifiers) && !Modifier.isPrivate(o2.modifiers)) {
+ return -1;
+ }
+ if (!Modifier.isPrivate(o1.modifiers) && Modifier.isPrivate(o2.modifiers)) {
+ return 1;
+ }
+ return 0;
+ }
+ };
+}
\ No newline at end of file
Deleted: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -1,60 +0,0 @@
-package org.nuiton.guix.generator;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.nuiton.guix.model.GuixModelObject;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Generator of interfaces
- *
- * @author morin
- */
-public class MainClassGenerator {
- private StringBuffer clazz = new StringBuffer();
-
- public MainClassGenerator(GuixModelObject gmo, File destDir) {
- String gmoClassName = gmo.getClassDescriptor().getName();
- String gmoAttributeName = gmoClassName.replace(gmoClassName.charAt(0),
- Character.toLowerCase(gmoClassName.charAt(0)));
-
- clazz.append("package ");
- clazz.append(gmo.getClassDescriptor().getPackageName());
- clazz.append(";\n\nimport java.io.File;\n"
- + "import org.springframework.beans.factory.ListableBeanFactory;\n"
- + "import org.springframework.beans.factory.xml.XmlBeanFactory;\n"
- + "import org.springframework.core.io.FileSystemResource;\n"
- + "\npublic class Main {"
- + "\n\n\tpublic static void main(String[] args) {\n" + "\t\t//usine à beans\n"
- + "\t\tListableBeanFactory bf = new XmlBeanFactory(" +
- "new FileSystemResource(new File(\"");
- clazz.append(destDir.getAbsolutePath());
- clazz.append("/config.xml\")));\n\t\t");
- clazz.append(gmoClassName);
- clazz.append(" ");
- clazz.append(gmoAttributeName);
- clazz.append(" = (");
- clazz.append(gmoClassName);
- clazz.append(") bf.getBean(\"");
- clazz.append(gmoAttributeName);
- clazz.append("\");\n\t\t");
- clazz.append(gmoAttributeName);
- clazz.append(".test();"
- + "\n\t}\n\n}");
- }
-
- public String getClassContent() {
- return clazz.toString();
- }
-}
-
Modified: guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java
===================================================================
--- guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -22,7 +22,7 @@
public void compileTest() {
GuixInitializer.initialize();
- GuixLauncher gl = new GuixLauncher(null,null,null,null,null);
+ GuixLauncher gl = new GuixLauncher(null,null,null,null,null,null);
assertTrue(gl.files == null || gl.classNames.length == gl.files.length);
assertTrue(gl.compile());
assertTrue(gl.files == null || gl.rootModelObjects.size() == gl.files.length);
@@ -31,7 +31,7 @@
File f2 = new File(f.getAbsolutePath());
File dir = new File("target/test");
File dir2 = new File(dir.getAbsolutePath());
- gl = new GuixLauncher(new File[]{f2},dir2,"org.nuiton.guix",f2.getParentFile(), null);
+ gl = new GuixLauncher(new File[]{f2},dir2,"org.nuiton.guix",f2.getParentFile(), null,null);
assertTrue(gl.files == null || gl.classNames.length == gl.files.length);
assertTrue(gl.compile());
}
@@ -41,36 +41,36 @@
*/
@Test
public void registerClassDescriptorTest() {
- GuixLauncher gl = new GuixLauncher(null,null,null,null,null);
- assertFalse(gl.registerClassDescriptor(null));
- assertFalse(gl.registerClassDescriptor(new ClassDescriptor(null, null)));
+ GuixLauncher gl = new GuixLauncher(null,null,null,null,null,null);
+ assertNull(gl.registerClassDescriptor(null));
+ assertNull(gl.registerClassDescriptor(new ClassDescriptor(null, null)));
ClassDescriptor cd = new ClassDescriptor("name", "package");
- assertTrue(gl.registerClassDescriptor(cd));
+ assertNotNull(gl.registerClassDescriptor(cd));
cd.setSuperClass(new ClassDescriptor("super", "package"));
- assertTrue(gl.registerClassDescriptor(cd)
+ assertTrue(gl.registerClassDescriptor(cd) != null
&& gl.classDescriptors.get(0).getSuperClass() != null);
- assertTrue(gl.registerClassDescriptor(cd)
+ assertTrue(gl.registerClassDescriptor(cd) != null
&& gl.classDescriptors.size() == 1);
ClassDescriptor cd2 = new ClassDescriptor("name", "package");
cd2.setSuperClass(new ClassDescriptor("super2", "package"));
- assertFalse(gl.registerClassDescriptor(cd2));
+ assertFalse(gl.registerClassDescriptor(cd2) != null);
ClassDescriptor cd3 = new ClassDescriptor("name", "package");
cd3.setScript("script");
- assertTrue(gl.registerClassDescriptor(cd3)
+ assertTrue(gl.registerClassDescriptor(cd3) != null
&& gl.classDescriptors.size() == 1);
ClassDescriptor cd4 = new ClassDescriptor("name", "package");
cd4.setScript("script2");
- assertFalse(gl.registerClassDescriptor(cd4));
+ assertNull(gl.registerClassDescriptor(cd4));
- assertTrue(gl.registerClassDescriptor(new ClassDescriptor("name", null))
+ assertTrue(gl.registerClassDescriptor(new ClassDescriptor("name", null)) != null
&& gl.classDescriptors.size() == 1);
- assertTrue(gl.registerClassDescriptor(new ClassDescriptor("test", null))
+ assertTrue(gl.registerClassDescriptor(new ClassDescriptor("test", null)) != null
&& gl.classDescriptors.size() == 2);
- assertTrue(gl.registerClassDescriptor(new ClassDescriptor("test", null))
+ assertTrue(gl.registerClassDescriptor(new ClassDescriptor("test", null)) != null
&& gl.classDescriptors.size() == 2);
}
}
Modified: guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java
===================================================================
--- guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java 2009-05-15 13:55:29 UTC (rev 1401)
+++ guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java 2009-05-15 13:59:00 UTC (rev 1402)
@@ -17,7 +17,7 @@
File f = new File("src/test/test.guix");
File f2 = new File(f.getAbsolutePath());
GuixLauncher gl = new GuixLauncher(new File[]{f2}, null,
- "org.nuiton.guix",f2.getParentFile(),null);
+ "org.nuiton.guix",f2.getParentFile(),null,null);
GuixCompiler gc = new GuixCompiler(null, null,null);
assertNull(gc.compile());
1
0
Author: kmorin
Date: 2009-05-15 13:55:29 +0000 (Fri, 15 May 2009)
New Revision: 1401
Modified:
guix/trunk/pom.xml
Log:
Ajout du module guix-compiler-swing
Modified: guix/trunk/pom.xml
===================================================================
--- guix/trunk/pom.xml 2009-05-11 09:17:42 UTC (rev 1400)
+++ guix/trunk/pom.xml 2009-05-15 13:55:29 UTC (rev 1401)
@@ -19,9 +19,10 @@
<modules>
<module>guix-compiler</module>
+ <module>guix-compiler-swing</module>
<module>guix-maven-plugin</module>
<module>guix-test</module>
-
+ <module>guix-runtime</module>
</modules>
<dependencyManagement>
@@ -236,4 +237,4 @@
</profile>
</profiles>
-</project>
+</project>
\ No newline at end of file
1
0
May 11, 2009
Author: tchemit
Date: 2009-05-11 09:17:42 +0000 (Mon, 11 May 2009)
New Revision: 1400
Modified:
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/pom.xml
Log:
scm values
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-11 09:17:42 UTC (rev 1400)
@@ -62,8 +62,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-api</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-api</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>${maven.scm.url.child}</url>
</scm>
</project>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
+++ jaxx/trunk/pom.xml 2009-05-11 09:17:42 UTC (rev 1400)
@@ -193,11 +193,7 @@
</plugin>
<plugin>
- <artifactId>maven-site-plugin</artifactId>
- <configuration>
- <locales>fr</locales>
- <siteDirectory>src/site</siteDirectory>
- </configuration>
+ <artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codelutin</groupId>
1
0
r1399 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-swing-widget/src/main/resources/i18n jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org May 11, 2009
by tchemit@users.labs.libre-entreprise.org May 11, 2009
May 11, 2009
Author: tchemit
Date: 2009-05-11 06:52:19 +0000 (Mon, 11 May 2009)
New Revision: 1399
Modified:
jaxx/trunk/changelog.txt
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
bump versions pass to 1.5.1-SNAPSHOT for last codelutin version
Modified: jaxx/trunk/changelog.txt
===================================================================
--- jaxx/trunk/changelog.txt 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/changelog.txt 2009-05-11 06:52:19 UTC (rev 1399)
@@ -1,3 +1,9 @@
+1.6.0 ?
+ * migrate to nuiton
+
+1.5.1 chemit 20090511
+ * 20090511 [chemit] - bump versions (lutinproject, jrst, lutinutil, maven-i18n-plugin, maven-license-switcher-plugin)
+
1.5
* 20090506 [chemit] - super-pom has no dependencies, use lutinutil 1.0.5
* 20090404 [chemit] - introduce module jaxx-runtime-swing-widget for swing widgets designed with jaxx.
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-11 06:52:19 UTC (rev 1399)
@@ -24,4 +24,4 @@
numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
-numbereditor.toggleSign=+/-
\ No newline at end of file
+numbereditor.toggleSign=+/-
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -49,7 +49,7 @@
<plugins>
<plugin>
<groupId>org.codelutin</groupId>
- <artifactId>maven-i18n-plugin</artifactId>
+ <artifactId>maven-i18n-plugin</artifactId>
<executions>
<execution>
<goals>
@@ -57,7 +57,7 @@
<goal>gen</goal>
</goals>
</execution>
- </executions>
+ </executions>
</plugin>
</plugins>
</build>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-08 17:33:16 UTC (rev 1398)
+++ jaxx/trunk/pom.xml 2009-05-11 06:52:19 UTC (rev 1399)
@@ -1,3 +1,4 @@
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -9,12 +10,12 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.5.3</version>
+ <version>3.5.4</version>
</parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -159,10 +160,10 @@
<labs.project>buix</labs.project>
<!-- libs version -->
- <lutinutil.version>1.0.5</lutinutil.version>
+ <lutinutil.version>1.0.6</lutinutil.version>
<jaxx.version>${project.version}</jaxx.version>
- <i18n.version>0.11</i18n.version>
- <lutinpluginutil.version>0.4</lutinpluginutil.version>
+ <i18n.version>0.12</i18n.version>
+ <lutinpluginutil.version>0.5</lutinpluginutil.version>
<swingx.version>0.9.6</swingx.version>
<maven.version>2.0.10</maven.version>
</properties>
@@ -177,6 +178,13 @@
<groupId>org.codelutin</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<version>${i18n.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>lutinutil</artifactId>
+ <version>${lutinutil.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
<plugin>
@@ -194,7 +202,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>doxia-module-jrst</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
</dependency>
</dependencies>
</plugin>
@@ -212,9 +220,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/?roo…</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ <url>${maven.scm.url}</url>
</scm>
<!-- Maven Environment : Repositories -->
@@ -253,10 +261,7 @@
<plugin>
<groupId>org.codelutin</groupId>
<artifactId>maven-license-switcher-plugin</artifactId>
- <version>0.7</version>
- <configuration>
- <licenseName>${license-switcher.licenseName}</licenseName>
- </configuration>
+ <version>0.8</version>
<executions>
<execution>
<id>attach-licenses</id>
1
0
r1398 - jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor
by tchemit@users.labs.libre-entreprise.org May 8, 2009
by tchemit@users.labs.libre-entreprise.org May 8, 2009
May 8, 2009
Author: tchemit
Date: 2009-05-08 17:33:16 +0000 (Fri, 08 May 2009)
New Revision: 1398
Modified:
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
Log:
add FIXME :)
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-07 15:20:41 UTC (rev 1397)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-08 17:33:16 UTC (rev 1398)
@@ -76,12 +76,13 @@
editor.getTextField().addMouseListener(new PopupListener());
// Determine si c'est un float
- Class type = getGetter().getReturnType();
+ Class<?> type = getGetter().getReturnType();
+ //FIXME le test n'est pas assez fort (on peut avoir un long, short,...)
editor.setUseFloat(!type.equals(Integer.class) && !type.equals(int.class));
// Initialise le model
if (editor.getModel() == null){
- Number num = (Number)getGetter().invoke(editor.getBean(), null);
+ Number num = (Number)getGetter().invoke(editor.getBean());
editor.setModel(num);
}
@@ -97,13 +98,7 @@
log.error(ex);
} catch (InvocationTargetException ex) {
log.error(ex);
- }
- /*if (editor.getResetButton().getIcon() == null) {
- editor.getResetButton().setIcon(SwingUtil.createActionIcon("numbereditor-reset"));
- }
- if (editor.getButton().getIcon() == null) {
- editor.getButton().setIcon(SwingUtil.createActionIcon("numbereditor-calculator"));
- }*/
+ }
}
/**
1
0
r1397 - in guix/trunk/guix-test: . src/main/java/org/nuiton/guix src/main/java/org/nuiton/guix/demo
by kmorin@users.labs.libre-entreprise.org May 7, 2009
by kmorin@users.labs.libre-entreprise.org May 7, 2009
May 7, 2009
Author: kmorin
Date: 2009-05-07 15:20:41 +0000 (Thu, 07 May 2009)
New Revision: 1397
Added:
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
Removed:
guix/trunk/guix-test/src/main/java/org/nuiton/guix/App.java
Modified:
guix/trunk/guix-test/pom.xml
guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
Log:
Modified: guix/trunk/guix-test/pom.xml
===================================================================
--- guix/trunk/guix-test/pom.xml 2009-05-07 15:20:03 UTC (rev 1396)
+++ guix/trunk/guix-test/pom.xml 2009-05-07 15:20:41 UTC (rev 1397)
@@ -17,10 +17,14 @@
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
+ <artifactId>spring-core</artifactId>
<version>2.0.5</version>
- <scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.5</version>
+ </dependency>
</dependencies>
@@ -54,9 +58,10 @@
<artifactId>guix-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
- <guixFilesDir>/home/morin/NetBeansProjects/guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
- <targetDirectory>/home/morin/NetBeansProjects/guix/trunk/guix-test/target/generatedFiles/</targetDirectory>
+ <guixFilesDir>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/</guixFilesDir>
+ <targetDirectory>/home/kevin/Workspaces/NetBeansProjects/guix/trunk/guix-test/target/generatedFiles/</targetDirectory>
<rootPackage>org.nuiton.guix</rootPackage>
+ <mainClass>org.nuiton.guix.GuixDemo2</mainClass>
</configuration>
<executions>
<execution>
Deleted: guix/trunk/guix-test/src/main/java/org/nuiton/guix/App.java
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/App.java 2009-05-07 15:20:03 UTC (rev 1396)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/App.java 2009-05-07 15:20:41 UTC (rev 1397)
@@ -1,13 +0,0 @@
-package org.nuiton.guix;
-
-/**
- * Hello world!
- *
- */
-public class App
-{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
-}
Modified: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-07 15:20:03 UTC (rev 1396)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo.guix 2009-05-07 15:20:41 UTC (rev 1397)
@@ -1,4 +1,5 @@
<?xml version='1.0' encoding='UTF-8' ?>
+<!-- test javadoc Application -->
<Application title="JAXX Demo" width='1024' height='800' xmlns:swing='javax.swing.*'>
<script><![CDATA[
@@ -47,9 +48,10 @@
;
}
-]]></style>
+]]></style>
+ <!-- test javadoc $JSplitPane1 -->
<swing:JSplitPane>
- <!--JSplitPane dividerLocation='200'-->
+ <!-- JSplitPane dividerLocation='200' -->
<swing:JScrollPane>
<swing:JTree id='list' showsRootHandles='true'
onValueChanged='cardLayout.show(preview, list.getSelectionValue() instanceof DemoPanel ? ((DemoPanel) list.getSelectionValue()).getLabel() : emptyDemo.getLabel())'
@@ -60,7 +62,8 @@
return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
}
- }'>
+ }'>
+ <!-- test javadoc $item1 -->
<item value="Components">
<item value='Buttons'>
<item value='{buttonDemo}'/>
Added: guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix
===================================================================
--- guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix (rev 0)
+++ guix/trunk/guix-test/src/main/java/org/nuiton/guix/demo/GuixDemo2.guix 2009-05-07 15:20:41 UTC (rev 1397)
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!-- test javadoc Application -->
+<Application title="JAXX Demo" width='1024' height='800' xmlns:swing='javax.swing.*'>
+ <swing:JPanel />
+</Application>
1
0
r1396 - guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org May 7, 2009
by kmorin@users.labs.libre-entreprise.org May 7, 2009
May 7, 2009
Author: kmorin
Date: 2009-05-07 15:20:03 +0000 (Thu, 07 May 2009)
New Revision: 1396
Modified:
guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
Log:
ajout de l'attribut mainClass
Modified: guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java
===================================================================
--- guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-05-07 15:19:37 UTC (rev 1395)
+++ guix/trunk/guix-maven-plugin/src/main/java/org/nuiton/guix/GuixMojo.java 2009-05-07 15:20:03 UTC (rev 1396)
@@ -37,6 +37,14 @@
*/
private String rootPackage;
+ /**
+ * Main class of the application to generate.
+ * @parameter expression="${guix.mainClass}"
+ * @required
+ * @since 0.0.1
+ */
+ private String mainClass;
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
GuixInitializer.initialize();
@@ -50,13 +58,17 @@
ArrayList<File> guixFiles = goDeeperInto(guixFilesDir);
GuixLauncher gcl = new GuixLauncher(guixFiles.toArray(
- new File[guixFiles.size()]),targetDirectory,rootPackage,guixFilesDir);
+ new File[guixFiles.size()]),targetDirectory,rootPackage,
+ guixFilesDir,mainClass);
boolean result = gcl.compile();
if(result)
getLog().info("Compilation succeeded !");
else
getLog().error("Compilation failed...");
}
+ else {
+ getLog().error("Sources not found.");
+ }
}
private ArrayList<File> goDeeperInto(File dir) {
1
0
r1395 - in guix/trunk/guix-compiler/src: main/java/org/nuiton/guix main/java/org/nuiton/guix/compiler main/java/org/nuiton/guix/css main/java/org/nuiton/guix/generator main/java/org/nuiton/guix/model main/java/org/nuiton/guix/parser main/java/org/nuiton/guix/tags test/java/org/nuiton/guix test/java/org/nuiton/guix/compiler
by kmorin@users.labs.libre-entreprise.org May 7, 2009
by kmorin@users.labs.libre-entreprise.org May 7, 2009
May 7, 2009
Author: kmorin
Date: 2009-05-07 15:19:37 +0000 (Thu, 07 May 2009)
New Revision: 1395
Added:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java
Modified:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/CompilerException.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedAttributeException.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedTagException.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserConstants.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserTreeConstants.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/JJTCSSParserState.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Node.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/ParseException.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleCharStream.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleNode.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Token.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/TokenMgrError.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/AttributeDescriptor.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Rule.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Selector.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/StyleSheet.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JJTJavaParserState.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserConstants.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserTreeConstants.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Node.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/ParseException.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Token.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/TokenMgrError.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ScriptHandler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagManager.java
guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java
guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java
Log:
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/CompilerException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/CompilerException.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/CompilerException.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -4,10 +4,8 @@
public class CompilerException extends RuntimeException {
/** Creates a new <code>ParseException</code>. */
- public CompilerException() {
- }
+ public CompilerException() {}
-
/**
* Creates a new <code>ParseException</code> with the specified detail message.
*
@@ -17,7 +15,6 @@
super(msg);
}
-
/**
* Creates a new <code>ParseException</code> with the specified cause.
*
@@ -27,7 +24,6 @@
super(initCause);
}
-
/**
* Creates a new <code>ParseException</code> with the specified detail message and cause.
*
@@ -38,10 +34,12 @@
super(msg, initCause);
}
-
public void printStackTrace() {
super.printStackTrace();
System.err.println("CompilerException printed from:");
Thread.dumpStack();
}
-}
\ No newline at end of file
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixInitializer.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,6 +1,7 @@
-
package org.nuiton.guix;
+//~--- non-JDK imports --------------------------------------------------------
+
import org.nuiton.guix.tags.TagManager;
/**
@@ -9,7 +10,6 @@
* @author morin
*/
public class GuixInitializer {
-
public static void initialize() {
TagManager.registerGuixClasse("Button");
TagManager.registerGuixClasse("Panel");
@@ -19,3 +19,6 @@
TagManager.registerGuixClasse("Application");
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -17,6 +17,7 @@
import org.nuiton.guix.generator.AbstractClassGenerator;
import org.nuiton.guix.generator.ImplementationGenerator;
import org.nuiton.guix.generator.InterfaceGenerator;
+import org.nuiton.guix.generator.MainClassGenerator;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.GuixModelObject;
import org.nuiton.guix.model.Rule;
@@ -53,6 +54,7 @@
protected int compilerCount;
private File targetDirectory;
private String rootPackage;
+ private String mainClass;
/**
* Constructor
@@ -60,7 +62,7 @@
* @param files the files to compile
*/
public GuixLauncher(File[] files, File targetDirectory, String rootPackage,
- File baseDir) {
+ File baseDir, String mainClass) {
// Set up a simple configuration that logs on the console.
this.files = files;
this.targetDirectory = targetDirectory;
@@ -86,6 +88,12 @@
else {
classNames = null;
}
+ if (mainClass != null) {
+ this.mainClass = mainClass;
+ }
+ else {
+ mainClass = "";
+ }
}
/**
@@ -98,6 +106,9 @@
compilerCount = 0;
File destDir = targetDirectory;
if (files != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Start compiling");
+ }
guixFiles.addAll(Arrays.asList(files));
guixFileClassNames.addAll(Arrays.asList(classNames));
boolean success = true;
@@ -173,7 +184,7 @@
null);
XmlSerializer serializer = factory.newSerializer();
- File config = new File(targetDirectory,"config.xml");
+ File config = new File(destDir,"config.xml");
serializer.setOutput(new PrintWriter(config));
serializer.startDocument("UTF-8", null);
@@ -185,13 +196,14 @@
serializer.startTag("", "beans");
for (GuixModelObject mo : rootModelObjects.keySet()) {
+ String moClassName = mo.getClassDescriptor().getName();
//File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
- File out = new File(destDir, mo.getClassDescriptor().getName() + ".java");
- File outAbstract = new File(destDir, mo.getClassDescriptor().getName() + "Abstract.java");
- File outImpl = new File(destDir, mo.getClassDescriptor().getName() + "Impl.java");
+ File out = new File(destDir, moClassName + ".java");
+ File outAbstract = new File(destDir, moClassName + "Abstract.java");
+ File outImpl = new File(destDir, moClassName + "Impl.java");
if (log.isInfoEnabled()) {
- log.info(mo.getClassDescriptor().getName() + " last modification : " + new Date(rootModelObjects.get(mo).getLastModification()));
+ log.info(moClassName + " last modification : " + new Date(rootModelObjects.get(mo).getLastModification()));
}
if (rootModelObjects.get(mo).getLastModification() > out.lastModified()) {
@@ -231,32 +243,68 @@
img.generate(outImpl);
serializer.startTag("", "bean");
- serializer.attribute("", "id", out.getName().replace(out.getName().charAt(0),
- Character.toLowerCase(out.getName().charAt(0))));
- serializer.attribute("", "class", out.getName() + "Impl");
+ serializer.attribute("", "id", moClassName.replace(moClassName.charAt(0),
+ Character.toLowerCase(moClassName.charAt(0))));
+ serializer.attribute("", "class",
+ mo.getClassDescriptor().getPackageName() + "." + moClassName + "Impl");
serializer.attribute("", "singleton", "false");
+ serializer.endTag("", "bean");
- /*<bean id = "articlesDao" class
+ if ((mo.getClassDescriptor().getPackageName() + "." + mo.getClassDescriptor().getName()).equals(mainClass)) {
+ MainClassGenerator mcg = new MainClassGenerator(mo, destDir);
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(new File(destDir, "Main.java"));
+ fw.write(mcg.getClassContent());
+ fw.close();
+ }
+ catch (IOException ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ }
+ }
+ finally {
+ try {
+ fw.close();
+ }
+ catch (IOException ex) {
+ log.error(ex);
+ }
+ }
- ="istia.st.articles.dao.ArticlesDaoPlainJdbc">
- <constructor-arg index="0">
- <value>org.firebirdsql.jdbc.FBDriver</value>
- </constructor-arg>
- <constructor-arg index="1">
- <value>jdbc:firebirdsql:localhost/3050:d:/databases/dbarticles.gdb</value>
- </constructor-arg>
- <constructor-arg index="2">
- <value>someone</value>
- </constructor-arg>
- <constructor-arg index="3">
- <value>somepassword</value>
- </constructor-arg>
- </bean>*/
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", "main");
+ serializer.attribute("", "class", mo.getClassDescriptor().getPackageName() + ".Main");
+ serializer.startTag("", "property");
+ serializer.attribute("", "name", moClassName.replace(moClassName.charAt(0),
+ Character.toLowerCase(moClassName.charAt(0))));
+ serializer.startTag("", "ref");
+ serializer.attribute("", "bean", moClassName.replace(moClassName.charAt(0),
+ Character.toLowerCase(moClassName.charAt(0))));
+ serializer.endTag("", "ref");
+ serializer.endTag("", "property");
+ serializer.endTag("", "bean");
+ }
+ /*<bean id = "articlesDao" class
+ ="istia.st.articles.dao.ArticlesDaoPlainJdbc">
+ <constructor-arg index="0">
+ <value>org.firebirdsql.jdbc.FBDriver</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>jdbc:firebirdsql:localhost/3050:d:/databases/dbarticles.gdb</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <value>someone</value>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>somepassword</value>
+ </constructor-arg>
+ </bean>*/
+
}
- else
- if (log.isWarnEnabled()) {
+ else if (log.isWarnEnabled()) {
log.warn(mo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedAttributeException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedAttributeException.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedAttributeException.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -6,10 +6,8 @@
public class UnsupportedAttributeException extends CompilerException {
/** Creates a new <code>UnsupportedAttributeException</code>. */
- public UnsupportedAttributeException() {
- }
+ public UnsupportedAttributeException() {}
-
/**
* Creates a new <code>UnsupportedAttributeException</code> with the specified detail message.
*
@@ -19,7 +17,6 @@
super(msg);
}
-
/**
* Creates a new <code>UnsupportedAttributeException</code> with the specified cause.
*
@@ -29,7 +26,6 @@
super(initCause);
}
-
/**
* Creates a new <code>UnsupportedAttributeException</code> with the specified detail message and cause.
*
@@ -39,4 +35,7 @@
public UnsupportedAttributeException(String msg, Throwable initCause) {
super(msg, initCause);
}
-}
\ No newline at end of file
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedTagException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedTagException.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/UnsupportedTagException.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -4,10 +4,8 @@
public class UnsupportedTagException extends CompilerException {
/** Creates a new <code>UnsupportedTagException</code>. */
- public UnsupportedTagException() {
- }
+ public UnsupportedTagException() {}
-
/**
* Creates a new <code>UnsupportedTagException</code> with the specified detail message.
*
@@ -17,7 +15,6 @@
super(msg);
}
-
/**
* Creates a new <code>UnsupportedTagException</code> with the specified cause.
*
@@ -27,7 +24,6 @@
super(initCause);
}
-
/**
* Creates a new <code>UnsupportedTagException</code> with the specified detail message and cause.
*
@@ -37,4 +33,7 @@
public UnsupportedTagException(String msg, Throwable initCause) {
super(msg, initCause);
}
-}
\ No newline at end of file
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,13 +1,11 @@
package org.nuiton.guix.compiler;
-import org.nuiton.guix.GuixLauncher;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+//~--- non-JDK imports --------------------------------------------------------
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.nuiton.guix.GuixLauncher;
import org.nuiton.guix.model.AttributeDescriptor;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.GuixModelObject;
@@ -15,10 +13,20 @@
import org.nuiton.guix.tags.ScriptHandler;
import org.nuiton.guix.tags.StyleHandler;
import org.nuiton.guix.tags.TagManager;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Compiles Guix files into model tree
*
@@ -28,29 +36,39 @@
/** log */
protected static final Log log = LogFactory.getLog(GuixCompiler.class);
+
+ /**
+ * Integer used to give an id to the objects which don't have one specified
+ * by the user
+ */
+ private int index = 1;
+ private StyleHandler styleHandler = new StyleHandler();
+ private ScriptHandler scriptHandler = new ScriptHandler();
+
+ /** Directory containing the guix files */
+ private File baseDir;
+
/** Flag to detec if an error occurs while compiling guix file */
protected boolean failed;
- /** Directory containing the guix files */
- private File baseDir;
- /** Guix file to compile */
- private File src;
- private String srcPackage;
+
+ /**
+ * Long representing the date and time of the last modification of any file
+ * used during compilation
+ */
+ private long lastModification;
+
/** GuixLauncher instance which launched this compiler */
private GuixLauncher launcher;
- private StyleHandler styleHandler = new StyleHandler();
- private ScriptHandler scriptHandler = new ScriptHandler();
+
/** Root of the model */
private GuixModelObject rootMO;
- /** Long representing the date and time of the last modification of any file
- * used during compilation */
- private long lastModification;
- /** Integer used to give an id to the objects which don't have one specified
- * by the user */
- private int index = 1;
- /*------------------------------------------------------------------------*/
- /*-- Constructor methods -------------------------------------------------*/
- /*------------------------------------------------------------------------*/
+ /** Guix file to compile */
+ private File src;
+ private String srcPackage;
+
+ /* -- Constructor methods ------------------------------------------------- */
+
/**
* Creates a new GuixCompiler.
*
@@ -58,14 +76,17 @@
* @param launcher the launcher of the compiler
*/
public GuixCompiler(File src, GuixLauncher launcher, String srcPackage) {
- this.src = src;
+ this.src = src;
this.launcher = launcher;
- if(srcPackage != null)
+
+ if (srcPackage != null) {
this.srcPackage = srcPackage;
- else
+ } else {
this.srcPackage = "";
+ }
+
if (src != null) {
- baseDir = src.getParentFile();
+ baseDir = src.getParentFile();
lastModification = src.lastModified();
}
}
@@ -76,87 +97,116 @@
* @return the root of the model
*/
public GuixModelObject compile() {
- if (src != null && launcher != null) {
+ if ((src != null) && (launcher != null)) {
try {
- //Creation of the Xml parser
- XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
+
+ // Creation of the Xml parser
+ XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
+
factory.setNamespaceAware(true);
+
XmlPullParser xpp = factory.newPullParser();
+
xpp.setInput(new FileReader(src));
- //Start parsing
+
+ // Start parsing
if (xpp.getEventType() == XmlPullParser.START_DOCUMENT) {
- //javaDoc of the class to create
+
+ // javaDoc of the class to create
StringBuffer doc = new StringBuffer();
+
do {
xpp.nextToken();
+
if (xpp.getEventType() == XmlPullParser.COMMENT) {
doc.append(xpp.getText());
}
} while (xpp.getEventType() != XmlPullParser.START_TAG);
- //resolve the package of teh superclass
+
+ // resolve the package of teh superclass
String tagNameSpace = xpp.getNamespace();
String tagName;
+
if (xpp.getName().lastIndexOf('.') >= 0) {
tagName = xpp.getName().substring(xpp.getName().lastIndexOf('.') + 1);
} else {
tagName = xpp.getName();
}
+
String tagPackageName = resolvePackageName(tagNameSpace, xpp.getName());
- //creation of the root GuixModelObject
- rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), doc.toString(), xpp.getAttributeValue("", "styleClass"));
- //the class name is the name of the file minus the extension
+
+ // creation of the root GuixModelObject
+ rootMO = new GuixModelObject(xpp.getAttributeValue("", "id"), doc.toString(),
+ xpp.getAttributeValue("", "styleClass"));
+
+ // the class name is the name of the file minus the extension
String className = src.getName().substring(0, src.getName().lastIndexOf('.'));
+
rootMO.setClassDescriptor(new ClassDescriptor(className, srcPackage));
rootMO.getClassDescriptor().setSuperClass(new ClassDescriptor(tagName, tagPackageName));
rootMO.setAttributeDescriptors(getAttributes(xpp));
rootMO.setChildren(new ArrayList<GuixModelObject>());
- //add the stylesheet of the CSS file with the same name as the Guix file
+ // add the stylesheet of the CSS file with the same name as the Guix file
File styleFile = new File(src.getParentFile(), className + ".css");
+
if (styleFile.exists()) {
StyleSheet ss = styleHandler.autoDetectStyleFile(styleFile);
+
rootMO.getStyleSheets().add(ss);
lastModification = Math.max(lastModification, styleFile.lastModified());
}
StringBuffer script = new StringBuffer();
- //add the script in the .script file with the same name as the Guix file
+
+ // add the script in the .script file with the same name as the Guix file
File scriptFile = new File(src.getParentFile(), className + ".script");
+
if (scriptFile.exists()) {
script.append(scriptHandler.loadScriptFile(scriptFile));
lastModification = Math.max(lastModification, scriptFile.lastModified());
}
- //reach the next START_TAG
+ // reach the next START_TAG
do {
xpp.nextToken();
- } while (xpp.getEventType() != XmlPullParser.START_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT);
- //if not eof
+ } while ((xpp.getEventType() != XmlPullParser.START_TAG)
+ && (xpp.getEventType() != XmlPullParser.END_DOCUMENT));
+
+ // if not eof
if (xpp.getEventType() == XmlPullParser.START_TAG) {
- //compile the rest of the file
+
+ // compile the rest of the file
script.append(compile(xpp, rootMO, doc.toString()));
}
- //all the script tags have been recorded
+
+ // all the script tags have been recorded
rootMO.getClassDescriptor().setScript(script.toString());
- //register the root ClassDescriptor
+
+ // register the root ClassDescriptor
failed = !launcher.registerClassDescriptor(rootMO.getClassDescriptor());
+
return rootMO;
}
} catch (XmlPullParserException ex) {
- if(log.isErrorEnabled())
+ if (log.isErrorEnabled()) {
log.error(ex);
+ }
} catch (IOException ex) {
- if(log.isErrorEnabled())
+ if (log.isErrorEnabled()) {
log.error(ex);
+ }
}
}
+
failed = true;
+
return null;
}
- /*------------------------------------------------------------------------*/
- /*-- Compile methods -----------------------------------------------------*/
- /*------------------------------------------------------------------------*/
+ /* -- Compile methods ----------------------------------------------------- */
+
/**
*
* @param xpp the parser referencing the tag
@@ -164,106 +214,128 @@
* @param javaDoc the comments above the tag, to add to its javaDoc
* @return the scripts already discovered while parsing the file
*/
- protected StringBuffer compile(final XmlPullParser xpp, GuixModelObject previousMO,
- String javaDoc) {
-
- StringBuffer result = new StringBuffer();
- StringBuffer doc = new StringBuffer();
+ protected StringBuffer compile(final XmlPullParser xpp, GuixModelObject previousMO, String javaDoc) {
+ StringBuffer result = new StringBuffer();
+ StringBuffer doc = new StringBuffer();
GuixModelObject prev;
try {
- //if the tag is a style tag
- if (xpp.getName() != null && xpp.getName().equals("style")) {
+
+ // if the tag is a style tag
+ if ((xpp.getName() != null) && xpp.getName().equals("style")) {
File styleFile = null;
- //the name of the file to load
+
+ // the name of the file to load
String source = xpp.getAttributeValue("", "source");
- //if the source attribute is specified
+
+ // if the source attribute is specified
if (source != null) {
styleFile = new File(baseDir, source.replace('/', File.separatorChar));
}
- //creates a new stylesheet
+
+ // creates a new stylesheet
StyleSheet ss = styleHandler.compileStyle(xpp, styleFile);
+
if (ss != null) {
rootMO.getStyleSheets().add(ss);
}
- if (styleFile != null && styleFile.exists()) {
+
+ if ((styleFile != null) && styleFile.exists()) {
lastModification = Math.max(lastModification, styleFile.lastModified());
}
- //the parent is still the same
+ // the parent is still the same
prev = previousMO;
- } //if the tag is a script tag
- else if (xpp.getName() != null && xpp.getName().equals("script")) {
+ } // if the tag is a script tag
+ else if ((xpp.getName() != null) && xpp.getName().equals("script")) {
File scriptFile = null;
- //the name of the file to load
+
+ // the name of the file to load
String source = xpp.getAttributeValue("", "source");
- //if the source attribute is specified
+
+ // if the source attribute is specified
if (source != null) {
scriptFile = new File(baseDir, source.replace('/', File.separatorChar));
}
- //add the script to the result
+
+ // add the script to the result
result.append(scriptHandler.compileScript(xpp, scriptFile));
- if (scriptFile != null && scriptFile.exists()) {
+
+ if ((scriptFile != null) && scriptFile.exists()) {
lastModification = Math.max(lastModification, scriptFile.lastModified());
}
- //the parent is still the same
+
+ // the parent is still the same
prev = previousMO;
- } //if the tag is a class tag
- else {
- String tagNameSpace = xpp.getNamespace();
+ } // if the tag is a class tag
+ else {
+ String tagNameSpace = xpp.getNamespace();
String tagPackageName = resolvePackageName(tagNameSpace, xpp.getName());
String tagName;
- //if the name of the tag is the fully-qualified class name
+
+ // if the name of the tag is the fully-qualified class name
if (xpp.getName().lastIndexOf('.') >= 0) {
tagName = xpp.getName().substring(xpp.getName().lastIndexOf('.') + 1);
} else {
tagName = xpp.getName();
}
- String id = (xpp.getAttributeValue("", "id") != null ?
- xpp.getAttributeValue("", "id")
- : "$" + tagName + index++);
- //create the GuixModelObject representing the tag
- GuixModelObject mo = new GuixModelObject(id, javaDoc,
- xpp.getAttributeValue("", "styleClass"));
+ String id = ((xpp.getAttributeValue("", "id") != null)
+ ? xpp.getAttributeValue("", "id")
+ : "$" + tagName + index++);
+
+ // create the GuixModelObject representing the tag
+ GuixModelObject mo = new GuixModelObject(id, javaDoc, xpp.getAttributeValue("", "styleClass"));
+
mo.setParent(previousMO);
mo.setClassDescriptor(new ClassDescriptor(tagName, tagPackageName));
mo.setChildren(new ArrayList<GuixModelObject>());
- //add this GuixModelObject to the children of the parent
+
+ // add this GuixModelObject to the children of the parent
previousMO.getChildren().add(mo);
- //register the ClassDescriptor
+ // register the ClassDescriptor
failed = !launcher.registerClassDescriptor(mo.getClassDescriptor());
+
if (!failed) {
- //parse the children of the tag
+
+ // parse the children of the tag
prev = mo;
- do {
- xpp.nextToken();
- //if the tag has no children
- if (xpp.getEventType() == XmlPullParser.END_TAG) {
- prev = prev.getParent();
- } else if (xpp.getEventType() == XmlPullParser.COMMENT) {
- //add the comment to the doc of the next tag
- doc.append(xpp.getText());
- }
- } while (xpp.getEventType() != XmlPullParser.START_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT);
} else {
return null;
}
}
- //if not eof
+ do {
+ xpp.nextToken();
+
+ // if the tag has no children
+ if (xpp.getEventType() == XmlPullParser.END_TAG) {
+ prev = prev.getParent();
+ } else if (xpp.getEventType() == XmlPullParser.COMMENT) {
+
+ // add the comment to the doc of the next tag
+ doc.append(xpp.getText());
+ }
+ } while ((xpp.getEventType() != XmlPullParser.START_TAG)
+ && (xpp.getEventType() != XmlPullParser.END_DOCUMENT));
+
+ // if not eof
if (xpp.getEventType() == XmlPullParser.START_TAG) {
- //compile the rest of the document
+
+ // compile the rest of the document
result.append(compile(xpp, prev, doc.toString()));
}
} catch (XmlPullParserException ex) {
- if(log.isErrorEnabled())
- log.error(ex);
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ }
} catch (IOException ex) {
- if(log.isErrorEnabled())
- log.error(ex);
+ if (log.isErrorEnabled()) {
+ log.error(ex);
+ }
}
+
return result;
}
@@ -277,11 +349,13 @@
*/
private String resolvePackageName(String tagNameSpace, String tagName) {
String packageName = null;
- //if there is a namespace
- if (tagNameSpace != null && tagNameSpace.endsWith("*")) {
+
+ // if there is a namespace
+ if ((tagNameSpace != null) && tagNameSpace.endsWith("*")) {
packageName = tagNameSpace.substring(0, tagNameSpace.length() - 2);
}
- //if the name of the tag is the fully qualified class name
+
+ // if the name of the tag is the fully qualified class name
if (tagName.lastIndexOf('.') >= 0) {
if (packageName == null) {
packageName = tagName.substring(0, tagName.lastIndexOf('.'));
@@ -289,11 +363,16 @@
packageName += tagName.substring(0, tagName.lastIndexOf('.'));
}
}
- //if nor the namespace nor the fully qualified class name is defined
+
+ // if nor the namespace nor the fully qualified class name is defined
if (packageName == null) {
String fullClassName = TagManager.resolveClassName(tagName);
- packageName = (fullClassName == null) ? null : fullClassName.substring(0, fullClassName.lastIndexOf('.'));
+
+ packageName = (fullClassName == null)
+ ? null
+ : fullClassName.substring(0, fullClassName.lastIndexOf('.'));
}
+
return packageName;
}
@@ -307,12 +386,13 @@
*/
private List<AttributeDescriptor> getAttributes(XmlPullParser xpp) {
List<AttributeDescriptor> result = new ArrayList<AttributeDescriptor>();
+
for (int i = 0; i < xpp.getAttributeCount(); i++) {
if (!xpp.getAttributeName(i).equals("id")) {
- result.add(new AttributeDescriptor(
- xpp.getAttributeName(i), xpp.getAttributeValue(i)));
+ result.add(new AttributeDescriptor(xpp.getAttributeName(i), xpp.getAttributeValue(i)));
}
}
+
return result;
}
@@ -329,3 +409,4 @@
return lastModification;
}
}
+
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserConstants.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserConstants.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */
package org.nuiton.guix.css;
@@ -2,69 +3,38 @@
public interface CSSParserConstants {
-
- int EOF = 0;
- int DECIMAL_LITERAL = 7;
- int INTEGER_LITERAL = 8;
- int IDENTIFIER = 9;
- int LETTER = 10;
- int DIGIT = 11;
- int PSEUDOCLASS_IDENTIFIER = 12;
- int PSEUDOCLASS_COLON = 13;
- int COLON = 14;
- int SEMICOLON = 15;
- int LEFT_BRACE = 16;
- int RIGHT_BRACE = 17;
- int JAVA_CODE_START = 18;
- int JAVA_CODE = 19;
- int JAVA_CODE_END = 20;
- int PROGRAMMATIC_PSEUDOCLASS = 21;
- int STRING = 22;
- int HEXCOLOR = 23;
- int HEXDIGIT = 24;
- int EMS = 25;
- int EXS = 26;
- int LENGTH = 27;
-
- int DEFAULT = 0;
- int IN_RULE = 1;
- int JAVA_CODE_RULE = 2;
- int IN_PSEUDOCLASS = 3;
-
- String[] tokenImage = {
- "<EOF>",
- "\" \"",
- "\"\\t\"",
- "\"\\n\"",
- "\"\\r\"",
- "<token of kind 5>",
- "<token of kind 6>",
- "<DECIMAL_LITERAL>",
- "<INTEGER_LITERAL>",
- "<IDENTIFIER>",
- "<LETTER>",
- "<DIGIT>",
- "<PSEUDOCLASS_IDENTIFIER>",
- "\":\"",
- "\":\"",
- "\";\"",
- "\"{\"",
- "\"}\"",
- "<JAVA_CODE_START>",
- "<JAVA_CODE>",
- "<JAVA_CODE_END>",
- "<PROGRAMMATIC_PSEUDOCLASS>",
- "<STRING>",
- "<HEXCOLOR>",
- "<HEXDIGIT>",
- "<EMS>",
- "<EXS>",
- "<LENGTH>",
- "\",\"",
- "\"*\"",
- "\"#\"",
- "\".\"",
- "\"[\"",
- "\"]\"",
- "\"=\"",
+ int COLON = 14;
+ int DECIMAL_LITERAL = 7;
+ int DEFAULT = 0;
+ int DIGIT = 11;
+ int EMS = 25;
+ int EOF = 0;
+ int EXS = 26;
+ int HEXCOLOR = 23;
+ int HEXDIGIT = 24;
+ int IDENTIFIER = 9;
+ int INTEGER_LITERAL = 8;
+ int IN_PSEUDOCLASS = 3;
+ int IN_RULE = 1;
+ int JAVA_CODE = 19;
+ int JAVA_CODE_END = 20;
+ int JAVA_CODE_RULE = 2;
+ int JAVA_CODE_START = 18;
+ int LEFT_BRACE = 16;
+ int LENGTH = 27;
+ int LETTER = 10;
+ int PROGRAMMATIC_PSEUDOCLASS = 21;
+ int PSEUDOCLASS_COLON = 13;
+ int PSEUDOCLASS_IDENTIFIER = 12;
+ int RIGHT_BRACE = 17;
+ int SEMICOLON = 15;
+ int STRING = 22;
+ String[] tokenImage = {
+ "<EOF>", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "<token of kind 5>", "<token of kind 6>",
+ "<DECIMAL_LITERAL>", "<INTEGER_LITERAL>", "<IDENTIFIER>", "<LETTER>", "<DIGIT>", "<PSEUDOCLASS_IDENTIFIER>",
+ "\":\"", "\":\"", "\";\"", "\"{\"", "\"}\"", "<JAVA_CODE_START>", "<JAVA_CODE>", "<JAVA_CODE_END>",
+ "<PROGRAMMATIC_PSEUDOCLASS>", "<STRING>", "<HEXCOLOR>", "<HEXDIGIT>", "<EMS>", "<EXS>", "<LENGTH>", "\",\"",
+ "\"*\"", "\"#\"", "\".\"", "\"[\"", "\"]\"", "\"=\"",
};
-
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserTreeConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserTreeConstants.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/CSSParserTreeConstants.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,40 +1,28 @@
-/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */
+/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */
package org.nuiton.guix.css;
public interface CSSParserTreeConstants {
- public int JJTSTYLESHEET = 0;
- public int JJTRULE = 1;
- public int JJTSELECTORS = 2;
- public int JJTSELECTOR = 3;
- public int JJTJAVACLASS = 4;
- public int JJTID = 5;
- public int JJTCLASS = 6;
- public int JJTPSEUDOCLASS = 7;
- public int JJTANIMATIONPROPERTIES = 8;
- public int JJTANIMATIONPROPERTY = 9;
- public int JJTDECLARATION = 10;
- public int JJTPROPERTY = 11;
- public int JJTEXPRESSION = 12;
- public int JJTJAVACODE = 13;
- public int JJTIDENTIFIER = 14;
-
-
- public String[] jjtNodeName = {
- "Stylesheet",
- "Rule",
- "Selectors",
- "Selector",
- "JavaClass",
- "Id",
- "Class",
- "PseudoClass",
- "AnimationProperties",
- "AnimationProperty",
- "Declaration",
- "Property",
- "Expression",
- "JavaCode",
- "Identifier",
+ public int JJTANIMATIONPROPERTIES = 8;
+ public int JJTANIMATIONPROPERTY = 9;
+ public int JJTCLASS = 6;
+ public int JJTDECLARATION = 10;
+ public int JJTEXPRESSION = 12;
+ public int JJTID = 5;
+ public int JJTIDENTIFIER = 14;
+ public int JJTJAVACLASS = 4;
+ public int JJTJAVACODE = 13;
+ public int JJTPROPERTY = 11;
+ public int JJTPSEUDOCLASS = 7;
+ public int JJTRULE = 1;
+ public int JJTSELECTOR = 3;
+ public int JJTSELECTORS = 2;
+ public int JJTSTYLESHEET = 0;
+ public String[] jjtNodeName = {
+ "Stylesheet", "Rule", "Selectors", "Selector", "JavaClass", "Id", "Class", "PseudoClass", "AnimationProperties",
+ "AnimationProperty", "Declaration", "Property", "Expression", "JavaCode", "Identifier",
};
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/JJTCSSParserState.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/JJTCSSParserState.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/JJTCSSParserState.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,31 +1,34 @@
+
/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */
-
package org.nuiton.guix.css;
class JJTCSSParserState {
- private java.util.Stack<Node> nodes;
private java.util.Stack<Integer> marks;
+ private int mk; // current mark
+ private boolean node_created;
+ private java.util.Stack<Node> nodes;
+ private int sp; // number of nodes on stack
- private int sp; // number of nodes on stack
- private int mk; // current mark
- private boolean node_created;
-
JJTCSSParserState() {
nodes = new java.util.Stack<Node>();
marks = new java.util.Stack<Integer>();
- sp = 0;
- mk = 0;
+ sp = 0;
+ mk = 0;
}
- /* Determines whether the current node was actually closed and
- pushed. This should only be called in the final user action of a
- node scope. */
+ /*
+ * Determines whether the current node was actually closed and
+ * pushed. This should only be called in the final user action of a
+ * node scope.
+ */
boolean nodeCreated() {
return node_created;
}
- /* Call this to reinitialize the node stack. It is called
-automatically by the parser's ReInit() method. */
+ /*
+ * Call this to reinitialize the node stack. It is called
+ * automatically by the parser's ReInit() method.
+ */
void reset() {
nodes.removeAllElements();
marks.removeAllElements();
@@ -33,8 +36,10 @@
mk = 0;
}
- /* Returns the root node of the AST. It only makes sense to call
-this after a successful parse. */
+ /*
+ * Returns the root node of the AST. It only makes sense to call
+ * this after a successful parse.
+ */
Node rootNode() {
return nodes.elementAt(0);
}
@@ -45,12 +50,15 @@
++sp;
}
- /* Returns the node on the top of the stack, and remove it from the
- stack. */
+ /*
+ * Returns the node on the top of the stack, and remove it from the
+ * stack.
+ */
Node popNode() {
if (--sp < mk) {
mk = marks.pop();
}
+
return nodes.pop();
}
@@ -59,65 +67,78 @@
return nodes.peek();
}
- /* Returns the number of children on the stack in the current node
- scope. */
+ /*
+ * Returns the number of children on the stack in the current node
+ * scope.
+ */
int nodeArity() {
return sp - mk;
}
-
void clearNodeScope(Node n) {
while (sp > mk) {
popNode();
}
+
mk = marks.pop();
}
-
void openNodeScope(Node n) {
marks.push(mk);
mk = sp;
n.jjtOpen();
}
-
- /* A definite node is constructed from a specified number of
-children. That number of nodes are popped from the stack and
-made the children of the definite node. Then the definite node
-is pushed on to the stack. */
+ /*
+ * A definite node is constructed from a specified number of
+ * children. That number of nodes are popped from the stack and
+ * made the children of the definite node. Then the definite node
+ * is pushed on to the stack.
+ */
void closeNodeScope(Node n, int num) {
mk = marks.pop();
+
while (num-- > 0) {
Node c = popNode();
+
c.jjtSetParent(n);
n.jjtAddChild(c, num);
}
+
n.jjtClose();
pushNode(n);
node_created = true;
}
-
- /* A conditional node is constructed if its condition is true. All
-the nodes that have been pushed since the node was opened are
-made children of the the conditional node, which is then pushed
-on to the stack. If the condition is false the node is not
-constructed and they are left on the stack. */
+ /*
+ * A conditional node is constructed if its condition is true. All
+ * the nodes that have been pushed since the node was opened are
+ * made children of the the conditional node, which is then pushed
+ * on to the stack. If the condition is false the node is not
+ * constructed and they are left on the stack.
+ */
void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = nodeArity();
+
mk = marks.pop();
+
while (a-- > 0) {
Node c = popNode();
+
c.jjtSetParent(n);
n.jjtAddChild(c, a);
}
+
n.jjtClose();
pushNode(n);
node_created = true;
} else {
- mk = marks.pop();
+ mk = marks.pop();
node_created = false;
}
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Node.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Node.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Node.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,11 +1,10 @@
+
/* Generated By:JJTree: Do not edit this line. Node.java */
-
package org.nuiton.guix.css;
-/* All AST nodes must implement this interface. It provides basic
- machinery for constructing the parent and child relationships
- between nodes. */
-
+/*All AST nodes must implement this interface. It provides basic
+machinery for constructing the parent and child relationships
+between nodes. */
public interface Node {
/**
@@ -49,3 +48,6 @@
/** @return the number of children the node has. */
public int jjtGetNumChildren();
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/ParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/ParseException.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/ParseException.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
package org.nuiton.guix.css;
@@ -8,13 +9,14 @@
super();
}
-
public ParseException(String message) {
super(message);
}
-
public ParseException(String message, int line, int column) {
super(message, line, column);
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleCharStream.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleCharStream.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleCharStream.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */
package org.nuiton.guix.css;
@@ -5,29 +6,71 @@
* An implementation of interface CharStream, where the stream is assumed to
* contain only ASCII characters (without unicode processing).
*/
-
public class SimpleCharStream {
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
- public int bufpos = -1;
- protected int bufline[];
- protected int bufcolumn[];
+ public static final boolean staticFlag = false;
+ public int bufpos = -1;
+ protected int column = 0;
+ protected int inBuf = 0;
+ protected int line = 1;
+ protected int maxNextCharInd = 0;
+ protected boolean prevCharIsCR = false;
+ protected boolean prevCharIsLF = false;
+ protected int tabSize = 8;
+ int available;
+ protected int bufcolumn[];
+ protected char[] buffer;
+ protected int bufline[];
+ int bufsize;
+ protected java.io.Reader inputStream;
+ int tokenBegin;
- protected int column = 0;
- protected int line = 1;
+ public SimpleCharStream(java.io.InputStream dstream) {
+ this(dstream, 1, 1, 4096);
+ }
- protected boolean prevCharIsCR = false;
- protected boolean prevCharIsLF = false;
+ public SimpleCharStream(java.io.Reader dstream) {
+ this(dstream, 1, 1, 4096);
+ }
- protected java.io.Reader inputStream;
+ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException {
+ this(dstream, encoding, 1, 1, 4096);
+ }
- protected char[] buffer;
- protected int maxNextCharInd = 0;
- protected int inBuf = 0;
- protected int tabSize = 8;
+ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn)
+ throws java.io.UnsupportedEncodingException {
+ this(dstream, encoding, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn,
+ int buffersize)
+ throws java.io.UnsupportedEncodingException {
+ this((encoding == null)
+ ? new java.io.InputStreamReader(dstream)
+ : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ }
+
protected void setTabSize(int i) {
tabSize = i;
}
@@ -36,48 +79,38 @@
return tabSize;
}
-
protected void ExpandBuff(boolean wrapAround) {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
try {
if (wrapAround) {
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
+ System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
buffer = newbuffer;
-
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
bufline = newbufline;
-
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
+ bufcolumn = newbufcolumn;
maxNextCharInd = (bufpos += (bufsize - tokenBegin));
} else {
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
buffer = newbuffer;
-
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
bufline = newbufline;
-
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
+ bufcolumn = newbufcolumn;
maxNextCharInd = (bufpos -= tokenBegin);
}
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
throw new Error(t.getMessage());
}
-
- bufsize += 2048;
- available = bufsize;
+ bufsize += 2048;
+ available = bufsize;
tokenBegin = 0;
}
@@ -85,41 +118,49 @@
if (maxNextCharInd == available) {
if (available == bufsize) {
if (tokenBegin > 2048) {
- bufpos = maxNextCharInd = 0;
+ bufpos = maxNextCharInd = 0;
available = tokenBegin;
- } else if (tokenBegin < 0)
+ } else if (tokenBegin < 0) {
bufpos = maxNextCharInd = 0;
- else
+ } else {
ExpandBuff(false);
- } else if (available > tokenBegin)
+ }
+ } else if (available > tokenBegin) {
available = bufsize;
- else if ((tokenBegin - available) < 2048)
+ } else if ((tokenBegin - available) < 2048) {
ExpandBuff(true);
- else
+ } else {
available = tokenBegin;
+ }
}
int i;
+
try {
- if ((i = inputStream.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1) {
+ if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) {
inputStream.close();
+
throw new java.io.IOException();
- } else
+ } else {
maxNextCharInd += i;
- }
- catch (java.io.IOException e) {
+ }
+ } catch (java.io.IOException e) {
--bufpos;
backup(0);
- if (tokenBegin == -1)
+
+ if (tokenBegin == -1) {
tokenBegin = bufpos;
+ }
+
throw e;
}
}
public char BeginToken() throws java.io.IOException {
tokenBegin = -1;
+
char c = readChar();
+
tokenBegin = bufpos;
return c;
@@ -130,31 +171,39 @@
if (prevCharIsLF) {
prevCharIsLF = false;
- line += (column = 1);
+ line += (column = 1);
} else if (prevCharIsCR) {
prevCharIsCR = false;
+
if (c == '\n') {
prevCharIsLF = true;
- } else
+ } else {
line += (column = 1);
+ }
}
switch (c) {
- case '\r':
- prevCharIsCR = true;
- break;
- case '\n':
- prevCharIsLF = true;
- break;
- case '\t':
- column--;
- column += (tabSize - (column % tabSize));
- break;
- default:
- break;
+ case '\r' :
+ prevCharIsCR = true;
+
+ break;
+
+ case '\n' :
+ prevCharIsLF = true;
+
+ break;
+
+ case '\t' :
+ column--;
+ column += (tabSize - (column % tabSize));
+
+ break;
+
+ default :
+ break;
}
- bufline[bufpos] = line;
+ bufline[bufpos] = line;
bufcolumn[bufpos] = column;
}
@@ -162,18 +211,21 @@
if (inBuf > 0) {
--inBuf;
- if (++bufpos == bufsize)
+ if (++bufpos == bufsize) {
bufpos = 0;
+ }
return buffer[bufpos];
}
- if (++bufpos >= maxNextCharInd)
+ if (++bufpos >= maxNextCharInd) {
FillBuff();
+ }
char c = buffer[bufpos];
UpdateLineColumn(c);
+
return (c);
}
@@ -182,7 +234,6 @@
* @see #getEndColumn
* @deprecated
*/
-
public int getColumn() {
return bufcolumn[bufpos];
}
@@ -192,7 +243,6 @@
* @see #getEndLine
* @deprecated
*/
-
public int getLine() {
return bufline[bufpos];
}
@@ -214,52 +264,31 @@
}
public void backup(int amount) {
+ inBuf += amount;
- inBuf += amount;
- if ((bufpos -= amount) < 0)
+ if ((bufpos -= amount) < 0) {
bufpos += bufsize;
+ }
}
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize) {
+ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) {
inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
+ line = startline;
+ column = startcolumn - 1;
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn) {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.Reader dstream) {
- this(dstream, 1, 1, 4096);
- }
-
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize) {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length) {
+ if ((buffer == null) || (buffersize != buffer.length)) {
available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
bufcolumn = new int[buffersize];
}
+
prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
}
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn) {
+ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) {
ReInit(dstream, startline, startcolumn, 4096);
}
@@ -267,41 +296,14 @@
ReInit(dstream, 1, 1, 4096);
}
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException {
- this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize)
+ throws java.io.UnsupportedEncodingException {
+ ReInit((encoding == null)
+ ? new java.io.InputStreamReader(dstream)
+ : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
}
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize) {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException {
- this(dstream, encoding, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn) {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException {
- this(dstream, encoding, 1, 1, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream) {
- this(dstream, 1, 1, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException {
- ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize) {
+ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) {
ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
}
@@ -313,32 +315,30 @@
ReInit(dstream, 1, 1, 4096);
}
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException {
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn)
+ throws java.io.UnsupportedEncodingException {
ReInit(dstream, encoding, startline, startcolumn, 4096);
}
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn) {
+ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) {
ReInit(dstream, startline, startcolumn, 4096);
}
public String GetImage() {
- if (bufpos >= tokenBegin)
+ if (bufpos >= tokenBegin) {
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
+ } else {
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1);
+ }
}
public char[] GetSuffix(int len) {
char[] ret = new char[len];
- if ((bufpos + 1) >= len)
+ if ((bufpos + 1) >= len) {
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
+ } else {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);
System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
}
@@ -346,8 +346,8 @@
}
public void Done() {
- buffer = null;
- bufline = null;
+ buffer = null;
+ bufline = null;
bufcolumn = null;
}
@@ -367,32 +367,36 @@
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
- int i = 0, j = 0, k;
- int nextColDiff, columnDiff = 0;
+ int i = 0,
+ j = 0, k;
+ int nextColDiff,
+ columnDiff = 0;
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ while ((i < len) && (bufline[j = start % bufsize] == bufline[k = ++start % bufsize])) {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
+ columnDiff = nextColDiff;
i++;
}
if (i < len) {
- bufline[j] = newLine++;
+ bufline[j] = newLine++;
bufcolumn[j] = newCol + columnDiff;
while (i++ < len) {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
bufline[j] = newLine++;
- else
+ } else {
bufline[j] = newLine;
+ }
}
}
- line = bufline[j];
+ line = bufline[j];
column = bufcolumn[j];
}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleNode.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleNode.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/SimpleNode.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,16 +1,15 @@
+
/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
-
package org.nuiton.guix.css;
public class SimpleNode implements Node {
- protected Node parent;
- protected Node[] children;
- protected int id;
+ protected Node[] children;
+ public Token firstToken;
+ protected int id;
+ public Token lastToken;
+ protected Node parent;
protected CSSParser parser;
- public Token firstToken;
- public Token lastToken;
-
public SimpleNode(int i) {
id = i;
}
@@ -20,16 +19,13 @@
parser = p;
}
-
public int getId() {
return id;
}
- public void jjtOpen() {
- }
+ public void jjtOpen() {}
- public void jjtClose() {
- }
+ public void jjtClose() {}
public void jjtSetParent(Node n) {
parent = n;
@@ -48,9 +44,11 @@
children = new Node[i + 1];
} else if (i >= children.length) {
Node c[] = new Node[i + 1];
+
System.arraycopy(children, 0, c, 0, children.length);
children = c;
}
+
children[i] = n;
}
@@ -63,15 +61,18 @@
}
public int jjtGetNumChildren() {
- return (children == null) ? 0 : children.length;
+ return (children == null)
+ ? 0
+ : children.length;
}
- /* You can override these two methods in subclasses of SimpleNode to
-customize the way the node appears when the tree is dumped. If
-your output uses more than one line you should override
-toString(String), otherwise overriding toString() is probably all
-you need to do. */
-
+ /*
+ * You can override these two methods in subclasses of SimpleNode to
+ * customize the way the node appears when the tree is dumped. If
+ * your output uses more than one line you should override
+ * toString(String), otherwise overriding toString() is probably all
+ * you need to do.
+ */
@Override
public String toString() {
return getClass().getName() + "[" + getText() + "]";
@@ -81,14 +82,17 @@
return prefix + toString();
}
- /* Override this method if you want to customize how the node dumps
- out its children. */
-
+ /*
+ * Override this method if you want to customize how the node dumps
+ * out its children.
+ */
public void dump(String prefix) {
System.out.println(toString(prefix));
+
if (children != null) {
for (Node aChildren : children) {
SimpleNode n = (SimpleNode) aChildren;
+
if (n != null) {
n.dump(prefix + " ");
}
@@ -103,16 +107,19 @@
}
}
-
/** @return the text of the tokens comprising this node. */
public String getText() {
StringBuffer text = new StringBuffer();
- Token t = firstToken;
+ Token t = firstToken;
+
while (t != null) {
appendSpecialTokens(text, t.specialToken);
text.append(t.image);
- if (t == lastToken)
+
+ if (t == lastToken) {
break;
+ }
+
t = t.next;
}
@@ -120,3 +127,5 @@
}
}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Token.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Token.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/Token.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
package org.nuiton.guix.css;
@@ -2,13 +3,5 @@
/** Describes the input token stream. */
-
public class Token {
/**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
* beginLine and beginColumn describe the position of the first character
@@ -23,6 +16,13 @@
public String image;
/**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
* A reference to the next regular (non-special) token from the input
* stream. If this is the last token from the input stream, or if the
* token manager has not read tokens beyond this one, this field is
@@ -68,9 +68,11 @@
*/
public static Token newToken(int ofKind) {
switch (ofKind) {
- default:
- return new Token();
+ default :
+ return new Token();
}
}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/TokenMgrError.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/TokenMgrError.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/css/TokenMgrError.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
package org.nuiton.guix.css;
@@ -2,18 +3,20 @@
public class TokenMgrError extends Error {
+
+ /** Tried to change to an invalid lexical state. */
+ static final int INVALID_LEXICAL_STATE = 2;
+
/*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
/** Lexical error occured. */
static final int LEXICAL_ERROR = 0;
- /** An attempt wass made to create a second instance of a static token manager. */
- static final int STATIC_LEXER_ERROR = 1;
-
- /** Tried to change to an invalid lexical state. */
- static final int INVALID_LEXICAL_STATE = 2;
-
/** Detected (and bailed out of) an infinite loop in the token manager. */
static final int LOOP_DETECTED = 3;
+ /** An attempt wass made to create a second instance of a static token manager. */
+ static final int STATIC_LEXER_ERROR = 1;
+ private static final long serialVersionUID = -4308847190164230336L;
+
/**
@@ -23,8 +26,22 @@
* one of the above 4 values.
*/
int errorCode;
- private static final long serialVersionUID = -4308847190164230336L;
+ /*
+ * Constructors of various flavors follow.
+ */
+ public TokenMgrError() {}
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter,
+ char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+
/**
* Replaces unprintable characters by their espaced (or unicode escaped)
* equivalents in the given string
@@ -34,44 +51,55 @@
*/
protected static String addEscapes(String str) {
StringBuffer retval = new StringBuffer();
- char ch;
+ char ch;
+
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
- case 0:
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
+ case 0 :
+ continue;
+ case '\b' :
+ retval.append("\\b");
+
+ continue;
+ case '\t' :
+ retval.append("\\t");
+
+ continue;
+ case '\n' :
+ retval.append("\\n");
+
+ continue;
+ case '\f' :
+ retval.append("\\f");
+
+ continue;
+ case '\r' :
+ retval.append("\\r");
+
+ continue;
+ case '\"' :
+ retval.append("\\\"");
+
+ continue;
+ case '\'' :
+ retval.append("\\\'");
+
+ continue;
+ case '\\' :
+ retval.append("\\\\");
+
+ continue;
+ default :
+ if ((ch = str.charAt(i)) < 0x20 || (ch > 0x7e)) {
+ String s = "0000" + Integer.toString(ch, 16);
+
+ retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
}
}
+
return retval.toString();
}
@@ -86,12 +114,12 @@
* @return a detailed message for the Error when it is thrown by the
* token manager to indicate a lexical error.
*/
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return ("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn,
+ String errorAfter, char curChar) {
+ return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen
+ ? "<EOF> "
+ : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \""
+ + addEscapes(errorAfter) + "\"");
}
/**
@@ -107,20 +135,7 @@
public String getMessage() {
return super.getMessage();
}
+}
- /*
- * Constructors of various flavors follow.
- */
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,21 +1,18 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.guix.generator;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
+//~--- non-JDK imports --------------------------------------------------------
+
import org.nuiton.guix.model.GuixModelObject;
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+
/**
*
* @author morin
*/
public class AbstractClassGenerator extends GuixGenerator {
-
public AbstractClassGenerator(GuixModelObject gmo) {
super(gmo);
}
@@ -24,35 +21,39 @@
public void generate(File out) {
super.generate();
+ if (!gmo.getJavadoc().equals("")) {
+ sb.append("\n/**\n* ");
+ sb.append(gmo.getJavadoc());
+ sb.append("\n*/");
+ }
+
sb.append("\npublic abstract class ");
sb.append(gmo.getClassDescriptor().getName());
- sb.append("Abstract {\n");
-
+ sb.append("Abstract implements ");
+ sb.append(gmo.getClassDescriptor().getName());
+ sb.append(" {\n");
addAttributes(gmo);
-
+ sb.append("\n\n\t//Getters and Setters");
addGettersAndSetters(gmo);
-
- sb.append("\n\n}");
-
+ sb.append("\n\npublic abstract void test();\n\n}");
saveFile(out);
}
@Override
protected void addGettersAndSetters(GuixModelObject gmo) {
for (GuixModelObject child : gmo.getChildren()) {
- sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("\n\n\tpublic ");
sb.append(child.getClassDescriptor().getName());
sb.append(" get");
- sb.append(child.getId().replace(child.getId().charAt(0),
- Character.toUpperCase(child.getId().charAt(0))));
+ sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
sb.append("() {\n\t\treturn this.");
- sb.append((child.getId() != null && !child.getId().equals("")) ? child.getId() : "test");
+ sb.append(((child.getId() != null) &&!child.getId().equals(""))
+ ? child.getId()
+ : "test");
sb.append(";\n\t}");
-
- sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("\n\n\tpublic ");
sb.append("void set");
- sb.append(child.getId().replace(child.getId().charAt(0),
- Character.toUpperCase(child.getId().charAt(0))));
+ sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
sb.append("(");
sb.append(child.getClassDescriptor().getName());
sb.append(" ");
@@ -62,14 +63,19 @@
sb.append(" = ");
sb.append(child.getId());
sb.append(";\n\t}");
-
addGettersAndSetters(child);
}
}
private void addAttributes(GuixModelObject gmo) {
for (GuixModelObject child : gmo.getChildren()) {
- sb.append("\tprivate ");
+ if (!child.getJavadoc().equals("")) {
+ sb.append("\n\t/**\n\t * ");
+ sb.append(child.getJavadoc());
+ sb.append("\n\t */");
+ }
+
+ sb.append("\n\tprivate ");
sb.append(child.getClassDescriptor().getName());
sb.append(" ");
sb.append(child.getId());
@@ -77,5 +83,5 @@
addAttributes(child);
}
}
+}
-}
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,15 +1,20 @@
package org.nuiton.guix.generator;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.guix.model.GuixModelObject;
/**
* GuixGenerator
@@ -18,10 +23,10 @@
public abstract class GuixGenerator {
/** log */
- protected Log log = LogFactory.getLog(GuixGenerator.class);
+ protected Log log = LogFactory.getLog(GuixGenerator.class);
+ protected StringBuffer sb = new StringBuffer();
+ protected List<String> classes = new ArrayList<String>();
protected GuixModelObject gmo;
- protected StringBuffer sb = new StringBuffer();
- protected List<String> classes = new ArrayList<String>();
public GuixGenerator(GuixModelObject gmo) {
this.gmo = gmo;
@@ -33,7 +38,6 @@
sb.append("package ");
sb.append(gmo.getClassDescriptor().getPackageName());
sb.append(";\n\n");
-
addImports(gmo);
}
@@ -42,29 +46,36 @@
protected void addImports(GuixModelObject gmo) {
for (GuixModelObject child : gmo.getChildren()) {
String fqn = child.getClassDescriptor().getPackageName() + "." + child.getClassDescriptor().getName();
+
if (!classes.contains(fqn)) {
classes.add(fqn);
sb.append("import " + fqn + ";\n");
}
+
addImports(child);
}
}
protected void saveFile(File out) {
FileWriter fw = null;
+
try {
fw = new FileWriter(out);
fw.write(sb.toString());
fw.close();
} catch (IOException ex) {
- if(log.isErrorEnabled())
+ if (log.isErrorEnabled()) {
log.error(ex);
+ }
} finally {
try {
fw.close();
} catch (IOException ex) {
- Logger.getLogger(GuixGenerator.class.getName()).log(Level.SEVERE, null, ex);
+ log.error(ex);
}
}
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,20 +1,24 @@
+
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+* To change this template, choose Tools | Templates
+* and open the template in the editor.
*/
-
package org.nuiton.guix.generator;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
import java.io.File;
import java.io.IOException;
-import org.nuiton.guix.model.GuixModelObject;
/**
*
* @author morin
*/
public class ImplementationGenerator extends GuixGenerator {
-
public ImplementationGenerator(GuixModelObject gmo) {
super(gmo);
}
@@ -23,19 +27,25 @@
public void generate(File out) {
super.generate();
+ if (!gmo.getJavadoc().equals("")) {
+ sb.append("\n/**\n * ");
+ sb.append(gmo.getJavadoc());
+ sb.append("\n */");
+ }
+
sb.append("\npublic class ");
sb.append(gmo.getClassDescriptor().getName());
sb.append("Impl extends ");
sb.append(gmo.getClassDescriptor().getName());
sb.append("Abstract {\n");
-
+ sb.append("public void test() {System.out.println(\"ca marche\");}");
sb.append("\n\n}");
-
saveFile(out);
}
@Override
- protected void addGettersAndSetters(GuixModelObject gmo) {
- }
+ protected void addGettersAndSetters(GuixModelObject gmo) {}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,13 +1,19 @@
package org.nuiton.guix.generator;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.nuiton.guix.model.GuixModelObject;
/**
* Generator of interfaces
@@ -15,7 +21,6 @@
* @author morin
*/
public class InterfaceGenerator extends GuixGenerator {
-
public InterfaceGenerator(GuixModelObject gmo) {
super(gmo);
}
@@ -23,40 +28,35 @@
@Override
public void generate(File out) {
super.generate();
-
sb.append("\npublic interface ");
sb.append(gmo.getClassDescriptor().getName());
sb.append(" {\n");
-
+ sb.append("\n\t//Getters and Setters");
addGettersAndSetters(gmo);
-
- sb.append("\n\n}");
-
+ sb.append("\n\npublic void test();\n\n}");
saveFile(out);
}
@Override
protected void addGettersAndSetters(GuixModelObject gmo) {
for (GuixModelObject child : gmo.getChildren()) {
- sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("\n\n\tpublic ");
sb.append(child.getClassDescriptor().getName());
sb.append(" get");
- sb.append(child.getId().replace(child.getId().charAt(0),
- Character.toUpperCase(child.getId().charAt(0))));
+ sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
sb.append("();");
-
- sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("\n\n\tpublic ");
sb.append("void set");
- sb.append(child.getId().replace(child.getId().charAt(0),
- Character.toUpperCase(child.getId().charAt(0))));
+ sb.append(child.getId().replace(child.getId().charAt(0), Character.toUpperCase(child.getId().charAt(0))));
sb.append("(");
sb.append(child.getClassDescriptor().getName());
sb.append(" ");
sb.append(child.getId());
sb.append(");");
-
addGettersAndSetters(child);
}
}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/MainClassGenerator.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -0,0 +1,60 @@
+package org.nuiton.guix.generator;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.nuiton.guix.model.GuixModelObject;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Generator of interfaces
+ *
+ * @author morin
+ */
+public class MainClassGenerator {
+ private StringBuffer clazz = new StringBuffer();
+
+ public MainClassGenerator(GuixModelObject gmo, File destDir) {
+ String gmoClassName = gmo.getClassDescriptor().getName();
+ String gmoAttributeName = gmoClassName.replace(gmoClassName.charAt(0),
+ Character.toLowerCase(gmoClassName.charAt(0)));
+
+ clazz.append("package ");
+ clazz.append(gmo.getClassDescriptor().getPackageName());
+ clazz.append(";\n\nimport java.io.File;\n"
+ + "import org.springframework.beans.factory.ListableBeanFactory;\n"
+ + "import org.springframework.beans.factory.xml.XmlBeanFactory;\n"
+ + "import org.springframework.core.io.FileSystemResource;\n"
+ + "\npublic class Main {"
+ + "\n\n\tpublic static void main(String[] args) {\n" + "\t\t//usine à beans\n"
+ + "\t\tListableBeanFactory bf = new XmlBeanFactory(" +
+ "new FileSystemResource(new File(\"");
+ clazz.append(destDir.getAbsolutePath());
+ clazz.append("/config.xml\")));\n\t\t");
+ clazz.append(gmoClassName);
+ clazz.append(" ");
+ clazz.append(gmoAttributeName);
+ clazz.append(" = (");
+ clazz.append(gmoClassName);
+ clazz.append(") bf.getBean(\"");
+ clazz.append(gmoAttributeName);
+ clazz.append("\");\n\t\t");
+ clazz.append(gmoAttributeName);
+ clazz.append(".test();"
+ + "\n\t}\n\n}");
+ }
+
+ public String getClassContent() {
+ return clazz.toString();
+ }
+}
+
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/AttributeDescriptor.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/AttributeDescriptor.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/AttributeDescriptor.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -9,6 +9,7 @@
/** Name of the attribute */
private String name;
+
/** Value of the attribute */
private String value;
@@ -19,7 +20,7 @@
* @param value value of the attribute
*/
public AttributeDescriptor(String name, String value) {
- this.name = name;
+ this.name = name;
this.value = value;
}
@@ -42,5 +43,7 @@
public String toString() {
return name + " : " + value;
}
-
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/ClassDescriptor.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -9,13 +9,20 @@
/** Name of the class */
private String name;
- /** Package of the class (must ends with '.*')*/
+
+ /** Package of the class (must ends with '.*') */
private String packageName;
- /** Script declared in the guix file.
- * Available only for the root GuixModelObject class.*/
+
+ /**
+ * Script declared in the guix file.
+ * Available only for the root GuixModelObject class.
+ */
private String script;
- /** Superclass of the class
- * Available only for the root GuixModelObject class.*/
+
+ /**
+ * Superclass of the class
+ * Available only for the root GuixModelObject class.
+ */
private ClassDescriptor superClass;
/**
@@ -24,8 +31,8 @@
* @param name name of the class
* @param packageName name of the package
*/
- public ClassDescriptor(String name, String packageName){
- this.name = name;
+ public ClassDescriptor(String name, String packageName) {
+ this.name = name;
this.packageName = packageName;
}
@@ -62,6 +69,11 @@
}
public String toString() {
- return (packageName != null) ? packageName + "." + name : name;
+ return (packageName != null)
+ ? packageName + "." + name
+ : name;
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/GuixModelObject.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,5 +1,7 @@
package org.nuiton.guix.model;
+//~--- JDK imports ------------------------------------------------------------
+
import java.util.ArrayList;
import java.util.List;
@@ -10,22 +12,30 @@
*/
public class GuixModelObject {
- /** The id of the object */
- private String id;
- /** The component containing the object */
- private GuixModelObject parent;
/** The children that the object contains */
private List<GuixModelObject> children = new ArrayList<GuixModelObject>();
+
+ /** The descriptor of the attributes of the object */
+ private List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>();
+
+ /**
+ * The stylesheets associated to the object
+ * (in case the object is a root model object)
+ */
+ private List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
+
/** The descriptor the class of the object */
private ClassDescriptor classDescriptor;
- /** The descriptor of the attributes of the object */
- private List<AttributeDescriptor> attributeDescriptors
- = new ArrayList<AttributeDescriptor>();
- /** The stylesheets associated to the object
- * (in case the object is a root model object) */
- private List<StyleSheet> styleSheets = new ArrayList<StyleSheet>();
+
+ /** The id of the object */
+ private String id;
+
/** The javaDoc of the object */
private String javadoc;
+
+ /** The component containing the object */
+ private GuixModelObject parent;
+
/** The style class of the object */
private String styleClass;
@@ -37,8 +47,8 @@
* @param styleClass the styleclass of the object
*/
public GuixModelObject(String id, String javadoc, String styleClass) {
- this.id = id;
- this.javadoc = javadoc;
+ this.id = id;
+ this.javadoc = javadoc;
this.styleClass = styleClass;
}
@@ -105,5 +115,7 @@
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
-
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Rule.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Rule.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Rule.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,9 +1,11 @@
package org.nuiton.guix.model;
+//~--- JDK imports ------------------------------------------------------------
+
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.List;
/**
* Representation of a rule of a CSS file
@@ -12,9 +14,12 @@
*/
public class Rule {
- /** Properties of the rule :
- * Maps the name of the property to its value.*/
- private Map<String,String> properties = new HashMap<String,String>();
+ /**
+ * Properties of the rule :
+ * Maps the name of the property to its value.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+
/** Selectors which the rule is applied to */
private List<Selector> selectors = new ArrayList<Selector>();
@@ -33,5 +38,7 @@
public void setSelectors(List<Selector> selectors) {
this.selectors = selectors;
}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Selector.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Selector.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/Selector.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,5 +1,7 @@
package org.nuiton.guix.model;
+//~--- JDK imports ------------------------------------------------------------
+
import java.util.ArrayList;
import java.util.List;
@@ -9,28 +11,40 @@
* @author morin
*/
public class Selector implements java.io.Serializable, Comparable<Selector> {
- public static final int NEVER_APPLIES = 0;
+ public static final int ALWAYS_APPLIES = 4;
+ public static final int ALWAYS_APPLIES_INHERIT_ONLY = 3;
+ public static final int NEVER_APPLIES = 0;
+ public static final int PSEUDOCLASS_APPLIES = 2;
public static final int PSEUDOCLASS_APPLIES_INHERIT_ONLY = 1;
- public static final int PSEUDOCLASS_APPLIES = 2;
- public static final int ALWAYS_APPLIES_INHERIT_ONLY = 3;
- public static final int ALWAYS_APPLIES = 4;
- /** Class which rules are applied to
- * e.g. Label */
- private String javaClassName;
- /** Styleclass which rules are applied to
- * e.g. .bold */
- private String styleClass;
- /** Pseudoclass which rules are applied to
- * e.g. :hover */
- private String pseudoClass;
- /** Id of the object which rules are applied to
- * e.g. #label5 */
- private String id;
/** List of the rules applied to the selector */
private List<Rule> rules = new ArrayList<Rule>();
/**
+ * Id of the object which rules are applied to
+ * e.g. #label5
+ */
+ private String id;
+
+ /**
+ * Class which rules are applied to
+ * e.g. Label
+ */
+ private String javaClassName;
+
+ /**
+ * Pseudoclass which rules are applied to
+ * e.g. :hover
+ */
+ private String pseudoClass;
+
+ /**
+ * Styleclass which rules are applied to
+ * e.g. .bold
+ */
+ private String styleClass;
+
+ /**
* Constructor
*
* @param javaClassName class which rules are applied to
@@ -40,9 +54,9 @@
*/
public Selector(String javaClassName, String styleClass, String pseudoClass, String id) {
this.javaClassName = javaClassName;
- this.styleClass = styleClass;
- this.pseudoClass = pseudoClass;
- this.id = id;
+ this.styleClass = styleClass;
+ this.pseudoClass = pseudoClass;
+ this.id = id;
}
public String getId() {
@@ -87,31 +101,38 @@
@Override
public int compareTo(Selector selector) {
-
- if (pseudoClass != null && selector.pseudoClass == null) {
+ if ((pseudoClass != null) && (selector.pseudoClass == null)) {
return 1;
}
- if (pseudoClass == null && selector.pseudoClass != null) {
+
+ if ((pseudoClass == null) && (selector.pseudoClass != null)) {
return -1;
}
- if (id != null && selector.id == null) {
+
+ if ((id != null) && (selector.id == null)) {
return 1;
}
- if (id == null && selector.id != null) {
+
+ if ((id == null) && (selector.id != null)) {
return -1;
}
- if (styleClass != null && selector.styleClass == null) {
+
+ if ((styleClass != null) && (selector.styleClass == null)) {
return 1;
}
- if (styleClass == null && selector.styleClass != null) {
+
+ if ((styleClass == null) && (selector.styleClass != null)) {
return -1;
}
- if (javaClassName != null && selector.javaClassName == null) {
+
+ if ((javaClassName != null) && (selector.javaClassName == null)) {
return 1;
}
- if (javaClassName == null && selector.javaClassName != null) {
+
+ if ((javaClassName == null) && (selector.javaClassName != null)) {
return -1;
}
+
return 0;
}
@@ -120,3 +141,6 @@
return "Selector[" + javaClassName + ", " + styleClass + ", " + pseudoClass + ", " + id + "]";
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/StyleSheet.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/StyleSheet.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/model/StyleSheet.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,6 +1,7 @@
-
package org.nuiton.guix.model;
+//~--- JDK imports ------------------------------------------------------------
+
import java.util.ArrayList;
import java.util.List;
@@ -32,5 +33,7 @@
public void setSelectors(List<Selector> selectors) {
this.selectors = selectors;
}
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JJTJavaParserState.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JJTJavaParserState.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JJTJavaParserState.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,31 +1,34 @@
+
/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */
-
package org.nuiton.guix.parser;
class JJTJavaParserState {
- private java.util.Stack<Node> nodes;
private java.util.Stack<Integer> marks;
+ private int mk; // current mark
+ private boolean node_created;
+ private java.util.Stack<Node> nodes;
+ private int sp; // number of nodes on stack
- private int sp; // number of nodes on stack
- private int mk; // current mark
- private boolean node_created;
-
JJTJavaParserState() {
nodes = new java.util.Stack<Node>();
marks = new java.util.Stack<Integer>();
- sp = 0;
- mk = 0;
+ sp = 0;
+ mk = 0;
}
- /* Determines whether the current node was actually closed and
- pushed. This should only be called in the final user action of a
- node scope. */
+ /*
+ * Determines whether the current node was actually closed and
+ * pushed. This should only be called in the final user action of a
+ * node scope.
+ */
boolean nodeCreated() {
return node_created;
}
- /* Call this to reinitialize the node stack. It is called
-automatically by the parser's ReInit() method. */
+ /*
+ * Call this to reinitialize the node stack. It is called
+ * automatically by the parser's ReInit() method.
+ */
void reset() {
nodes.removeAllElements();
marks.removeAllElements();
@@ -33,8 +36,10 @@
mk = 0;
}
- /* Returns the root node of the AST. It only makes sense to call
-this after a successful parse. */
+ /*
+ * Returns the root node of the AST. It only makes sense to call
+ * this after a successful parse.
+ */
Node rootNode() {
return nodes.elementAt(0);
}
@@ -45,12 +50,15 @@
++sp;
}
- /* Returns the node on the top of the stack, and remove it from the
- stack. */
+ /*
+ * Returns the node on the top of the stack, and remove it from the
+ * stack.
+ */
Node popNode() {
if (--sp < mk) {
mk = marks.pop();
}
+
return nodes.pop();
}
@@ -59,65 +67,78 @@
return nodes.peek();
}
- /* Returns the number of children on the stack in the current node
- scope. */
+ /*
+ * Returns the number of children on the stack in the current node
+ * scope.
+ */
int nodeArity() {
return sp - mk;
}
-
void clearNodeScope(Node n) {
while (sp > mk) {
popNode();
}
+
mk = marks.pop();
}
-
void openNodeScope(Node n) {
marks.push(mk);
mk = sp;
n.jjtOpen();
}
-
- /* A definite node is constructed from a specified number of
-children. That number of nodes are popped from the stack and
-made the children of the definite node. Then the definite node
-is pushed on to the stack. */
+ /*
+ * A definite node is constructed from a specified number of
+ * children. That number of nodes are popped from the stack and
+ * made the children of the definite node. Then the definite node
+ * is pushed on to the stack.
+ */
void closeNodeScope(Node n, int num) {
mk = marks.pop();
+
while (num-- > 0) {
Node c = popNode();
+
c.jjtSetParent(n);
n.jjtAddChild(c, num);
}
+
n.jjtClose();
pushNode(n);
node_created = true;
}
-
- /* A conditional node is constructed if its condition is true. All
-the nodes that have been pushed since the node was opened are
-made children of the the conditional node, which is then pushed
-on to the stack. If the condition is false the node is not
-constructed and they are left on the stack. */
+ /*
+ * A conditional node is constructed if its condition is true. All
+ * the nodes that have been pushed since the node was opened are
+ * made children of the the conditional node, which is then pushed
+ * on to the stack. If the condition is false the node is not
+ * constructed and they are left on the stack.
+ */
void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = nodeArity();
+
mk = marks.pop();
+
while (a-- > 0) {
Node c = popNode();
+
c.jjtSetParent(n);
n.jjtAddChild(c, a);
}
+
n.jjtClose();
pushNode(n);
node_created = true;
} else {
- mk = marks.pop();
+ mk = marks.pop();
node_created = false;
}
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserConstants.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserConstants.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */
package org.nuiton.guix.parser;
@@ -2,257 +3,147 @@
public interface JavaParserConstants {
-
- int EOF = 0;
- int WHITE_SPACE = 3;
- int SINGLE_LINE_COMMENT = 4;
- int FORMAL_COMMENT = 5;
- int MULTI_LINE_COMMENT = 6;
- int ABSTRACT = 8;
- int ASSERT = 9;
- int BOOLEAN = 10;
- int BREAK = 11;
- int BYTE = 12;
- int CASE = 13;
- int CATCH = 14;
- int CHAR = 15;
- int CLASS = 16;
- int CONST = 17;
- int CONTINUE = 18;
- int _DEFAULT = 19;
- int DO = 20;
- int DOUBLE = 21;
- int ELSE = 22;
- int ENUM = 23;
- int EXTENDS = 24;
- int FALSE = 25;
- int FINAL = 26;
- int FINALLY = 27;
- int FLOAT = 28;
- int FOR = 29;
- int GOTO = 30;
- int IF = 31;
- int IMPLEMENTS = 32;
- int IMPORT = 33;
- int INSTANCEOF = 34;
- int INT = 35;
- int INTERFACE = 36;
- int LONG = 37;
- int NATIVE = 38;
- int NEW = 39;
- int NULL = 40;
- int PACKAGE = 41;
- int PRIVATE = 42;
- int PROTECTED = 43;
- int PUBLIC = 44;
- int RETURN = 45;
- int SHORT = 46;
- int STATIC = 47;
- int STRICTFP = 48;
- int SUPER = 49;
- int SWITCH = 50;
- int SYNCHRONIZED = 51;
- int THIS = 52;
- int THROW = 53;
- int THROWS = 54;
- int TRANSIENT = 55;
- int TRUE = 56;
- int TRY = 57;
- int VOID = 58;
- int VOLATILE = 59;
- int WHILE = 60;
- int INTEGER_LITERAL = 61;
- int DECIMAL_LITERAL = 62;
- int HEX_LITERAL = 63;
- int OCTAL_LITERAL = 64;
- int FLOATING_POINT_LITERAL = 65;
- int DECIMAL_FLOATING_POINT_LITERAL = 66;
- int DECIMAL_EXPONENT = 67;
- int HEXADECIMAL_FLOATING_POINT_LITERAL = 68;
- int HEXADECIMAL_EXPONENT = 69;
- int CHARACTER_LITERAL = 70;
- int STRING_LITERAL = 71;
- int IDENTIFIER = 72;
- int LETTER = 73;
- int PART_LETTER = 74;
- int LPAREN = 75;
- int RPAREN = 76;
- int LBRACE = 77;
- int RBRACE = 78;
- int LBRACKET = 79;
- int RBRACKET = 80;
- int SEMICOLON = 81;
- int COMMA = 82;
- int DOT = 83;
- int AT = 84;
- int ASSIGN = 85;
- int LT = 86;
- int BANG = 87;
- int TILDE = 88;
- int HOOK = 89;
- int COLON = 90;
- int EQ = 91;
- int LE = 92;
- int GE = 93;
- int NE = 94;
- int SC_OR = 95;
- int SC_AND = 96;
- int INCR = 97;
- int DECR = 98;
- int PLUS = 99;
- int MINUS = 100;
- int STAR = 101;
- int SLASH = 102;
- int BIT_AND = 103;
- int BIT_OR = 104;
- int XOR = 105;
- int REM = 106;
- int LSHIFT = 107;
- int PLUSASSIGN = 108;
- int MINUSASSIGN = 109;
- int STARASSIGN = 110;
- int SLASHASSIGN = 111;
- int ANDASSIGN = 112;
- int ORASSIGN = 113;
- int XORASSIGN = 114;
- int REMASSIGN = 115;
- int LSHIFTASSIGN = 116;
- int RSIGNEDSHIFTASSIGN = 117;
- int RUNSIGNEDSHIFTASSIGN = 118;
- int ELLIPSIS = 119;
- int RUNSIGNEDSHIFT = 120;
- int RSIGNEDSHIFT = 121;
- int GT = 122;
- int STUFF_TO_IGNORE = 124;
-
- int DEFAULT = 0;
- int IN_FORMAL_COMMENT = 1;
- int IN_MULTI_LINE_COMMENT = 2;
-
- String[] tokenImage = {
- "<EOF>",
- "<token of kind 1>",
- "\"/*\"",
- "<WHITE_SPACE>",
- "<SINGLE_LINE_COMMENT>",
- "\"*/\"",
- "\"*/\"",
- "<token of kind 7>",
- "\"abstract\"",
- "\"assert\"",
- "\"boolean\"",
- "\"break\"",
- "\"byte\"",
- "\"case\"",
- "\"catch\"",
- "\"char\"",
- "\"class\"",
- "\"const\"",
- "\"continue\"",
- "\"default\"",
- "\"do\"",
- "\"double\"",
- "\"else\"",
- "\"enum\"",
- "\"extends\"",
- "\"false\"",
- "\"final\"",
- "\"finally\"",
- "\"float\"",
- "\"for\"",
- "\"goto\"",
- "\"if\"",
- "\"implements\"",
- "\"import\"",
- "\"instanceof\"",
- "\"int\"",
- "\"interface\"",
- "\"long\"",
- "\"native\"",
- "\"new\"",
- "\"null\"",
- "\"package\"",
- "\"private\"",
- "\"protected\"",
- "\"public\"",
- "\"return\"",
- "\"short\"",
- "\"static\"",
- "\"strictfp\"",
- "\"super\"",
- "\"switch\"",
- "\"synchronized\"",
- "\"this\"",
- "\"throw\"",
- "\"throws\"",
- "\"transient\"",
- "\"true\"",
- "\"try\"",
- "\"void\"",
- "\"volatile\"",
- "\"while\"",
- "<INTEGER_LITERAL>",
- "<DECIMAL_LITERAL>",
- "<HEX_LITERAL>",
- "<OCTAL_LITERAL>",
- "<FLOATING_POINT_LITERAL>",
- "<DECIMAL_FLOATING_POINT_LITERAL>",
- "<DECIMAL_EXPONENT>",
- "<HEXADECIMAL_FLOATING_POINT_LITERAL>",
- "<HEXADECIMAL_EXPONENT>",
- "<CHARACTER_LITERAL>",
- "<STRING_LITERAL>",
- "<IDENTIFIER>",
- "<LETTER>",
- "<PART_LETTER>",
- "\"(\"",
- "\")\"",
- "\"{\"",
- "\"}\"",
- "\"[\"",
- "\"]\"",
- "\";\"",
- "\",\"",
- "\".\"",
- "\"@\"",
- "\"=\"",
- "\"<\"",
- "\"!\"",
- "\"~\"",
- "\"?\"",
- "\":\"",
- "\"==\"",
- "\"<=\"",
- "\">=\"",
- "\"!=\"",
- "\"||\"",
- "\"&&\"",
- "\"++\"",
- "\"--\"",
- "\"+\"",
- "\"-\"",
- "\"*\"",
- "\"/\"",
- "\"&\"",
- "\"|\"",
- "\"^\"",
- "\"%\"",
- "\"<<\"",
- "\"+=\"",
- "\"-=\"",
- "\"*=\"",
- "\"/=\"",
- "\"&=\"",
- "\"|=\"",
- "\"^=\"",
- "\"%=\"",
- "\"<<=\"",
- "\">>=\"",
- "\">>>=\"",
- "\"...\"",
- "\">>>\"",
- "\">>\"",
- "\">\"",
- "\"\\u001a\"",
- "<STUFF_TO_IGNORE>",
+ int ABSTRACT = 8;
+ int ANDASSIGN = 112;
+ int ASSERT = 9;
+ int ASSIGN = 85;
+ int AT = 84;
+ int BANG = 87;
+ int BIT_AND = 103;
+ int BIT_OR = 104;
+ int BOOLEAN = 10;
+ int BREAK = 11;
+ int BYTE = 12;
+ int CASE = 13;
+ int CATCH = 14;
+ int CHAR = 15;
+ int CHARACTER_LITERAL = 70;
+ int CLASS = 16;
+ int COLON = 90;
+ int COMMA = 82;
+ int CONST = 17;
+ int CONTINUE = 18;
+ int DECIMAL_EXPONENT = 67;
+ int DECIMAL_FLOATING_POINT_LITERAL = 66;
+ int DECIMAL_LITERAL = 62;
+ int DECR = 98;
+ int DEFAULT = 0;
+ int DO = 20;
+ int DOT = 83;
+ int DOUBLE = 21;
+ int ELLIPSIS = 119;
+ int ELSE = 22;
+ int ENUM = 23;
+ int EOF = 0;
+ int EQ = 91;
+ int EXTENDS = 24;
+ int FALSE = 25;
+ int FINAL = 26;
+ int FINALLY = 27;
+ int FLOAT = 28;
+ int FLOATING_POINT_LITERAL = 65;
+ int FOR = 29;
+ int FORMAL_COMMENT = 5;
+ int GE = 93;
+ int GOTO = 30;
+ int GT = 122;
+ int HEXADECIMAL_EXPONENT = 69;
+ int HEXADECIMAL_FLOATING_POINT_LITERAL = 68;
+ int HEX_LITERAL = 63;
+ int HOOK = 89;
+ int IDENTIFIER = 72;
+ int IF = 31;
+ int IMPLEMENTS = 32;
+ int IMPORT = 33;
+ int INCR = 97;
+ int INSTANCEOF = 34;
+ int INT = 35;
+ int INTEGER_LITERAL = 61;
+ int INTERFACE = 36;
+ int IN_FORMAL_COMMENT = 1;
+ int IN_MULTI_LINE_COMMENT = 2;
+ int LBRACE = 77;
+ int LBRACKET = 79;
+ int LE = 92;
+ int LETTER = 73;
+ int LONG = 37;
+ int LPAREN = 75;
+ int LSHIFT = 107;
+ int LSHIFTASSIGN = 116;
+ int LT = 86;
+ int MINUS = 100;
+ int MINUSASSIGN = 109;
+ int MULTI_LINE_COMMENT = 6;
+ int NATIVE = 38;
+ int NE = 94;
+ int NEW = 39;
+ int NULL = 40;
+ int OCTAL_LITERAL = 64;
+ int ORASSIGN = 113;
+ int PACKAGE = 41;
+ int PART_LETTER = 74;
+ int PLUS = 99;
+ int PLUSASSIGN = 108;
+ int PRIVATE = 42;
+ int PROTECTED = 43;
+ int PUBLIC = 44;
+ int RBRACE = 78;
+ int RBRACKET = 80;
+ int REM = 106;
+ int REMASSIGN = 115;
+ int RETURN = 45;
+ int RPAREN = 76;
+ int RSIGNEDSHIFT = 121;
+ int RSIGNEDSHIFTASSIGN = 117;
+ int RUNSIGNEDSHIFT = 120;
+ int RUNSIGNEDSHIFTASSIGN = 118;
+ int SC_AND = 96;
+ int SC_OR = 95;
+ int SEMICOLON = 81;
+ int SHORT = 46;
+ int SINGLE_LINE_COMMENT = 4;
+ int SLASH = 102;
+ int SLASHASSIGN = 111;
+ int STAR = 101;
+ int STARASSIGN = 110;
+ int STATIC = 47;
+ int STRICTFP = 48;
+ int STRING_LITERAL = 71;
+ int STUFF_TO_IGNORE = 124;
+ int SUPER = 49;
+ int SWITCH = 50;
+ int SYNCHRONIZED = 51;
+ int THIS = 52;
+ int THROW = 53;
+ int THROWS = 54;
+ int TILDE = 88;
+ int TRANSIENT = 55;
+ int TRUE = 56;
+ int TRY = 57;
+ int VOID = 58;
+ int VOLATILE = 59;
+ int WHILE = 60;
+ int WHITE_SPACE = 3;
+ int XOR = 105;
+ int XORASSIGN = 114;
+ int _DEFAULT = 19;
+ String[] tokenImage = {
+ "<EOF>", "<token of kind 1>", "\"/*\"", "<WHITE_SPACE>", "<SINGLE_LINE_COMMENT>", "\"*/\"", "\"*/\"",
+ "<token of kind 7>", "\"abstract\"", "\"assert\"", "\"boolean\"", "\"break\"", "\"byte\"", "\"case\"",
+ "\"catch\"", "\"char\"", "\"class\"", "\"const\"", "\"continue\"", "\"default\"", "\"do\"", "\"double\"",
+ "\"else\"", "\"enum\"", "\"extends\"", "\"false\"", "\"final\"", "\"finally\"", "\"float\"", "\"for\"",
+ "\"goto\"", "\"if\"", "\"implements\"", "\"import\"", "\"instanceof\"", "\"int\"", "\"interface\"", "\"long\"",
+ "\"native\"", "\"new\"", "\"null\"", "\"package\"", "\"private\"", "\"protected\"", "\"public\"", "\"return\"",
+ "\"short\"", "\"static\"", "\"strictfp\"", "\"super\"", "\"switch\"", "\"synchronized\"", "\"this\"",
+ "\"throw\"", "\"throws\"", "\"transient\"", "\"true\"", "\"try\"", "\"void\"", "\"volatile\"", "\"while\"",
+ "<INTEGER_LITERAL>", "<DECIMAL_LITERAL>", "<HEX_LITERAL>", "<OCTAL_LITERAL>", "<FLOATING_POINT_LITERAL>",
+ "<DECIMAL_FLOATING_POINT_LITERAL>", "<DECIMAL_EXPONENT>", "<HEXADECIMAL_FLOATING_POINT_LITERAL>",
+ "<HEXADECIMAL_EXPONENT>", "<CHARACTER_LITERAL>", "<STRING_LITERAL>", "<IDENTIFIER>", "<LETTER>",
+ "<PART_LETTER>", "\"(\"", "\")\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\";\"", "\",\"", "\".\"", "\"@\"",
+ "\"=\"", "\"<\"", "\"!\"", "\"~\"", "\"?\"", "\":\"", "\"==\"", "\"<=\"", "\">=\"", "\"!=\"", "\"||\"",
+ "\"&&\"", "\"++\"", "\"--\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", "\"&\"", "\"|\"", "\"^\"", "\"%\"", "\"<<\"",
+ "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"&=\"", "\"|=\"", "\"^=\"", "\"%=\"", "\"<<=\"", "\">>=\"",
+ "\">>>=\"", "\"...\"", "\">>>\"", "\">>\"", "\">\"", "\"\\u001a\"", "<STUFF_TO_IGNORE>",
};
-
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserTreeConstants.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserTreeConstants.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/JavaParserTreeConstants.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,230 +1,142 @@
-/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */
+/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */
package org.nuiton.guix.parser;
public interface JavaParserTreeConstants {
- public int JJTLINE = 0;
- public int JJTCOMPILATIONUNIT = 1;
- public int JJTPACKAGEDECLARATION = 2;
- public int JJTIMPORTDECLARATION = 3;
- public int JJTMODIFIERS = 4;
- public int JJTTYPEDECLARATION = 5;
- public int JJTCLASSORINTERFACEDECLARATION = 6;
- public int JJTEXTENDSLIST = 7;
- public int JJTIMPLEMENTSLIST = 8;
- public int JJTENUMDECLARATION = 9;
- public int JJTENUMBODY = 10;
- public int JJTENUMCONSTANT = 11;
- public int JJTTYPEPARAMETERS = 12;
- public int JJTTYPEPARAMETER = 13;
- public int JJTTYPEBOUND = 14;
- public int JJTCLASSORINTERFACEBODY = 15;
- public int JJTCLASSORINTERFACEBODYDECLARATION = 16;
- public int JJTFIELDDECLARATION = 17;
- public int JJTVARIABLEDECLARATOR = 18;
- public int JJTVARIABLEDECLARATORID = 19;
- public int JJTVARIABLEINITIALIZER = 20;
- public int JJTARRAYINITIALIZER = 21;
- public int JJTMETHODDECLARATION = 22;
- public int JJTMETHODDECLARATOR = 23;
- public int JJTFORMALPARAMETERS = 24;
- public int JJTFORMALPARAMETER = 25;
- public int JJTCONSTRUCTORDECLARATION = 26;
- public int JJTEXPLICITCONSTRUCTORINVOCATION = 27;
- public int JJTINITIALIZER = 28;
- public int JJTTYPE = 29;
- public int JJTREFERENCETYPE = 30;
- public int JJTCLASSORINTERFACETYPE = 31;
- public int JJTTYPEARGUMENTS = 32;
- public int JJTTYPEARGUMENT = 33;
- public int JJTWILDCARDBOUNDS = 34;
- public int JJTPRIMITIVETYPE = 35;
- public int JJTRESULTTYPE = 36;
- public int JJTNAME = 37;
- public int JJTNAMELIST = 38;
- public int JJTEXPRESSION = 39;
- public int JJTASSIGNMENTOPERATOR = 40;
- public int JJTASSIGNMENTEXPRESSION = 41;
- public int JJTCONDITIONALEXPRESSION = 42;
- public int JJTCONDITIONALOREXPRESSION = 43;
- public int JJTCONDITIONALANDEXPRESSION = 44;
- public int JJTINCLUSIVEOREXPRESSION = 45;
- public int JJTEXCLUSIVEOREXPRESSION = 46;
- public int JJTANDEXPRESSION = 47;
- public int JJTEQUALITYEXPRESSION = 48;
- public int JJTINSTANCEOFEXPRESSION = 49;
- public int JJTRELATIONALEXPRESSION = 50;
- public int JJTSHIFTEXPRESSION = 51;
- public int JJTADDITIVEEXPRESSION = 52;
- public int JJTMULTIPLICATIVEEXPRESSION = 53;
- public int JJTUNARYEXPRESSION = 54;
- public int JJTPREINCREMENTEXPRESSION = 55;
- public int JJTPREDECREMENTEXPRESSION = 56;
- public int JJTUNARYEXPRESSIONNOTPLUSMINUS = 57;
- public int JJTCASTLOOKAHEAD = 58;
- public int JJTPOSTFIXEXPRESSION = 59;
- public int JJTPOSTFIXOPERATOR = 60;
- public int JJTCASTEXPRESSION = 61;
- public int JJTPRIMARYEXPRESSION = 62;
- public int JJTMEMBERSELECTOR = 63;
- public int JJTPRIMARYPREFIX = 64;
- public int JJTPRIMARYSUFFIX = 65;
- public int JJTLITERAL = 66;
- public int JJTBOOLEANLITERAL = 67;
- public int JJTNULLLITERAL = 68;
- public int JJTARGUMENTS = 69;
- public int JJTARGUMENTLIST = 70;
- public int JJTALLOCATIONEXPRESSION = 71;
- public int JJTARRAYDIMSANDINITS = 72;
- public int JJTSTATEMENT = 73;
- public int JJTASSERTSTATEMENT = 74;
- public int JJTLABELEDSTATEMENT = 75;
- public int JJTBLOCK = 76;
- public int JJTBLOCKSTATEMENT = 77;
- public int JJTLOCALVARIABLEDECLARATION = 78;
- public int JJTEMPTYSTATEMENT = 79;
- public int JJTSTATEMENTEXPRESSION = 80;
- public int JJTSWITCHSTATEMENT = 81;
- public int JJTSWITCHLABEL = 82;
- public int JJTIFSTATEMENT = 83;
- public int JJTWHILESTATEMENT = 84;
- public int JJTDOSTATEMENT = 85;
- public int JJTFORSTATEMENT = 86;
- public int JJTFORINIT = 87;
- public int JJTSTATEMENTEXPRESSIONLIST = 88;
- public int JJTFORUPDATE = 89;
- public int JJTBREAKSTATEMENT = 90;
- public int JJTCONTINUESTATEMENT = 91;
- public int JJTRETURNSTATEMENT = 92;
- public int JJTTHROWSTATEMENT = 93;
- public int JJTSYNCHRONIZEDSTATEMENT = 94;
- public int JJTTRYSTATEMENT = 95;
- public int JJTRUNSIGNEDSHIFT = 96;
- public int JJTRSIGNEDSHIFT = 97;
- public int JJTANNOTATION = 98;
- public int JJTNORMALANNOTATION = 99;
- public int JJTMARKERANNOTATION = 100;
- public int JJTSINGLEMEMBERANNOTATION = 101;
- public int JJTMEMBERVALUEPAIRS = 102;
- public int JJTMEMBERVALUEPAIR = 103;
- public int JJTMEMBERVALUE = 104;
- public int JJTMEMBERVALUEARRAYINITIALIZER = 105;
- public int JJTANNOTATIONTYPEDECLARATION = 106;
- public int JJTANNOTATIONTYPEBODY = 107;
- public int JJTANNOTATIONTYPEMEMBERDECLARATION = 108;
- public int JJTDEFAULTVALUE = 109;
-
-
- public String[] jjtNodeName = {
- "Line",
- "CompilationUnit",
- "PackageDeclaration",
- "ImportDeclaration",
- "Modifiers",
- "TypeDeclaration",
- "ClassOrInterfaceDeclaration",
- "ExtendsList",
- "ImplementsList",
- "EnumDeclaration",
- "EnumBody",
- "EnumConstant",
- "TypeParameters",
- "TypeParameter",
- "TypeBound",
- "ClassOrInterfaceBody",
- "ClassOrInterfaceBodyDeclaration",
- "FieldDeclaration",
- "VariableDeclarator",
- "VariableDeclaratorId",
- "VariableInitializer",
- "ArrayInitializer",
- "MethodDeclaration",
- "MethodDeclarator",
- "FormalParameters",
- "FormalParameter",
- "ConstructorDeclaration",
- "ExplicitConstructorInvocation",
- "Initializer",
- "Type",
- "ReferenceType",
- "ClassOrInterfaceType",
- "TypeArguments",
- "TypeArgument",
- "WildcardBounds",
- "PrimitiveType",
- "ResultType",
- "Name",
- "NameList",
- "Expression",
- "AssignmentOperator",
- "AssignmentExpression",
- "ConditionalExpression",
- "ConditionalOrExpression",
- "ConditionalAndExpression",
- "InclusiveOrExpression",
- "ExclusiveOrExpression",
- "AndExpression",
- "EqualityExpression",
- "InstanceOfExpression",
- "RelationalExpression",
- "ShiftExpression",
- "AdditiveExpression",
- "MultiplicativeExpression",
- "UnaryExpression",
- "PreIncrementExpression",
- "PreDecrementExpression",
- "UnaryExpressionNotPlusMinus",
- "CastLookahead",
- "PostfixExpression",
- "PostfixOperator",
- "CastExpression",
- "PrimaryExpression",
- "MemberSelector",
- "PrimaryPrefix",
- "PrimarySuffix",
- "Literal",
- "BooleanLiteral",
- "NullLiteral",
- "Arguments",
- "ArgumentList",
- "AllocationExpression",
- "ArrayDimsAndInits",
- "Statement",
- "AssertStatement",
- "LabeledStatement",
- "Block",
- "BlockStatement",
- "LocalVariableDeclaration",
- "EmptyStatement",
- "StatementExpression",
- "SwitchStatement",
- "SwitchLabel",
- "IfStatement",
- "WhileStatement",
- "DoStatement",
- "ForStatement",
- "ForInit",
- "StatementExpressionList",
- "ForUpdate",
- "BreakStatement",
- "ContinueStatement",
- "ReturnStatement",
- "ThrowStatement",
- "SynchronizedStatement",
- "TryStatement",
- "RUNSIGNEDSHIFT",
- "RSIGNEDSHIFT",
- "Annotation",
- "NormalAnnotation",
- "MarkerAnnotation",
- "SingleMemberAnnotation",
- "MemberValuePairs",
- "MemberValuePair",
- "MemberValue",
- "MemberValueArrayInitializer",
- "AnnotationTypeDeclaration",
- "AnnotationTypeBody",
- "AnnotationTypeMemberDeclaration",
- "DefaultValue",
+ public int JJTADDITIVEEXPRESSION = 52;
+ public int JJTALLOCATIONEXPRESSION = 71;
+ public int JJTANDEXPRESSION = 47;
+ public int JJTANNOTATION = 98;
+ public int JJTANNOTATIONTYPEBODY = 107;
+ public int JJTANNOTATIONTYPEDECLARATION = 106;
+ public int JJTANNOTATIONTYPEMEMBERDECLARATION = 108;
+ public int JJTARGUMENTLIST = 70;
+ public int JJTARGUMENTS = 69;
+ public int JJTARRAYDIMSANDINITS = 72;
+ public int JJTARRAYINITIALIZER = 21;
+ public int JJTASSERTSTATEMENT = 74;
+ public int JJTASSIGNMENTEXPRESSION = 41;
+ public int JJTASSIGNMENTOPERATOR = 40;
+ public int JJTBLOCK = 76;
+ public int JJTBLOCKSTATEMENT = 77;
+ public int JJTBOOLEANLITERAL = 67;
+ public int JJTBREAKSTATEMENT = 90;
+ public int JJTCASTEXPRESSION = 61;
+ public int JJTCASTLOOKAHEAD = 58;
+ public int JJTCLASSORINTERFACEBODY = 15;
+ public int JJTCLASSORINTERFACEBODYDECLARATION = 16;
+ public int JJTCLASSORINTERFACEDECLARATION = 6;
+ public int JJTCLASSORINTERFACETYPE = 31;
+ public int JJTCOMPILATIONUNIT = 1;
+ public int JJTCONDITIONALANDEXPRESSION = 44;
+ public int JJTCONDITIONALEXPRESSION = 42;
+ public int JJTCONDITIONALOREXPRESSION = 43;
+ public int JJTCONSTRUCTORDECLARATION = 26;
+ public int JJTCONTINUESTATEMENT = 91;
+ public int JJTDEFAULTVALUE = 109;
+ public int JJTDOSTATEMENT = 85;
+ public int JJTEMPTYSTATEMENT = 79;
+ public int JJTENUMBODY = 10;
+ public int JJTENUMCONSTANT = 11;
+ public int JJTENUMDECLARATION = 9;
+ public int JJTEQUALITYEXPRESSION = 48;
+ public int JJTEXCLUSIVEOREXPRESSION = 46;
+ public int JJTEXPLICITCONSTRUCTORINVOCATION = 27;
+ public int JJTEXPRESSION = 39;
+ public int JJTEXTENDSLIST = 7;
+ public int JJTFIELDDECLARATION = 17;
+ public int JJTFORINIT = 87;
+ public int JJTFORMALPARAMETER = 25;
+ public int JJTFORMALPARAMETERS = 24;
+ public int JJTFORSTATEMENT = 86;
+ public int JJTFORUPDATE = 89;
+ public int JJTIFSTATEMENT = 83;
+ public int JJTIMPLEMENTSLIST = 8;
+ public int JJTIMPORTDECLARATION = 3;
+ public int JJTINCLUSIVEOREXPRESSION = 45;
+ public int JJTINITIALIZER = 28;
+ public int JJTINSTANCEOFEXPRESSION = 49;
+ public int JJTLABELEDSTATEMENT = 75;
+ public int JJTLINE = 0;
+ public int JJTLITERAL = 66;
+ public int JJTLOCALVARIABLEDECLARATION = 78;
+ public int JJTMARKERANNOTATION = 100;
+ public int JJTMEMBERSELECTOR = 63;
+ public int JJTMEMBERVALUE = 104;
+ public int JJTMEMBERVALUEARRAYINITIALIZER = 105;
+ public int JJTMEMBERVALUEPAIR = 103;
+ public int JJTMEMBERVALUEPAIRS = 102;
+ public int JJTMETHODDECLARATION = 22;
+ public int JJTMETHODDECLARATOR = 23;
+ public int JJTMODIFIERS = 4;
+ public int JJTMULTIPLICATIVEEXPRESSION = 53;
+ public int JJTNAME = 37;
+ public int JJTNAMELIST = 38;
+ public int JJTNORMALANNOTATION = 99;
+ public int JJTNULLLITERAL = 68;
+ public int JJTPACKAGEDECLARATION = 2;
+ public int JJTPOSTFIXEXPRESSION = 59;
+ public int JJTPOSTFIXOPERATOR = 60;
+ public int JJTPREDECREMENTEXPRESSION = 56;
+ public int JJTPREINCREMENTEXPRESSION = 55;
+ public int JJTPRIMARYEXPRESSION = 62;
+ public int JJTPRIMARYPREFIX = 64;
+ public int JJTPRIMARYSUFFIX = 65;
+ public int JJTPRIMITIVETYPE = 35;
+ public int JJTREFERENCETYPE = 30;
+ public int JJTRELATIONALEXPRESSION = 50;
+ public int JJTRESULTTYPE = 36;
+ public int JJTRETURNSTATEMENT = 92;
+ public int JJTRSIGNEDSHIFT = 97;
+ public int JJTRUNSIGNEDSHIFT = 96;
+ public int JJTSHIFTEXPRESSION = 51;
+ public int JJTSINGLEMEMBERANNOTATION = 101;
+ public int JJTSTATEMENT = 73;
+ public int JJTSTATEMENTEXPRESSION = 80;
+ public int JJTSTATEMENTEXPRESSIONLIST = 88;
+ public int JJTSWITCHLABEL = 82;
+ public int JJTSWITCHSTATEMENT = 81;
+ public int JJTSYNCHRONIZEDSTATEMENT = 94;
+ public int JJTTHROWSTATEMENT = 93;
+ public int JJTTRYSTATEMENT = 95;
+ public int JJTTYPE = 29;
+ public int JJTTYPEARGUMENT = 33;
+ public int JJTTYPEARGUMENTS = 32;
+ public int JJTTYPEBOUND = 14;
+ public int JJTTYPEDECLARATION = 5;
+ public int JJTTYPEPARAMETER = 13;
+ public int JJTTYPEPARAMETERS = 12;
+ public int JJTUNARYEXPRESSION = 54;
+ public int JJTUNARYEXPRESSIONNOTPLUSMINUS = 57;
+ public int JJTVARIABLEDECLARATOR = 18;
+ public int JJTVARIABLEDECLARATORID = 19;
+ public int JJTVARIABLEINITIALIZER = 20;
+ public int JJTWHILESTATEMENT = 84;
+ public int JJTWILDCARDBOUNDS = 34;
+ public String[] jjtNodeName = {
+ "Line", "CompilationUnit", "PackageDeclaration", "ImportDeclaration", "Modifiers", "TypeDeclaration",
+ "ClassOrInterfaceDeclaration", "ExtendsList", "ImplementsList", "EnumDeclaration", "EnumBody", "EnumConstant",
+ "TypeParameters", "TypeParameter", "TypeBound", "ClassOrInterfaceBody", "ClassOrInterfaceBodyDeclaration",
+ "FieldDeclaration", "VariableDeclarator", "VariableDeclaratorId", "VariableInitializer", "ArrayInitializer",
+ "MethodDeclaration", "MethodDeclarator", "FormalParameters", "FormalParameter", "ConstructorDeclaration",
+ "ExplicitConstructorInvocation", "Initializer", "Type", "ReferenceType", "ClassOrInterfaceType",
+ "TypeArguments", "TypeArgument", "WildcardBounds", "PrimitiveType", "ResultType", "Name", "NameList",
+ "Expression", "AssignmentOperator", "AssignmentExpression", "ConditionalExpression", "ConditionalOrExpression",
+ "ConditionalAndExpression", "InclusiveOrExpression", "ExclusiveOrExpression", "AndExpression",
+ "EqualityExpression", "InstanceOfExpression", "RelationalExpression", "ShiftExpression", "AdditiveExpression",
+ "MultiplicativeExpression", "UnaryExpression", "PreIncrementExpression", "PreDecrementExpression",
+ "UnaryExpressionNotPlusMinus", "CastLookahead", "PostfixExpression", "PostfixOperator", "CastExpression",
+ "PrimaryExpression", "MemberSelector", "PrimaryPrefix", "PrimarySuffix", "Literal", "BooleanLiteral",
+ "NullLiteral", "Arguments", "ArgumentList", "AllocationExpression", "ArrayDimsAndInits", "Statement",
+ "AssertStatement", "LabeledStatement", "Block", "BlockStatement", "LocalVariableDeclaration", "EmptyStatement",
+ "StatementExpression", "SwitchStatement", "SwitchLabel", "IfStatement", "WhileStatement", "DoStatement",
+ "ForStatement", "ForInit", "StatementExpressionList", "ForUpdate", "BreakStatement", "ContinueStatement",
+ "ReturnStatement", "ThrowStatement", "SynchronizedStatement", "TryStatement", "RUNSIGNEDSHIFT", "RSIGNEDSHIFT",
+ "Annotation", "NormalAnnotation", "MarkerAnnotation", "SingleMemberAnnotation", "MemberValuePairs",
+ "MemberValuePair", "MemberValue", "MemberValueArrayInitializer", "AnnotationTypeDeclaration",
+ "AnnotationTypeBody", "AnnotationTypeMemberDeclaration", "DefaultValue",
};
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Node.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Node.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Node.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,11 +1,10 @@
+
/* Generated By:JJTree: Do not edit this line. Node.java */
-
package org.nuiton.guix.parser;
-/* All AST nodes must implement this interface. It provides basic
- machinery for constructing the parent and child relationships
- between nodes. */
-
+/*All AST nodes must implement this interface. It provides basic
+machinery for constructing the parent and child relationships
+between nodes. */
public interface Node {
/**
@@ -49,3 +48,6 @@
/** @return the number of children the node has. */
public int jjtGetNumChildren();
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/ParseException.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/ParseException.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/ParseException.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
package org.nuiton.guix.parser;
@@ -11,38 +12,42 @@
* mechanisms so long as you retain the public fields.
*/
public class ParseException extends org.nuiton.guix.CompilerException {
- int line;
- int column;
private static final long serialVersionUID = 6179854408401024700L;
+ /** The end of line string for this machine. */
+ protected String eol = System.getProperty("line.separator", "\n");
+ int column;
+
/**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set. The boolean
- * flag "specialConstructor" is also set to true to indicate that
- * this constructor was used to create this object.
- * This constructor calls its super class with the empty string
- * to force the "toString" method of parent class "Throwable" to
- * print the error message in the form:
- * ParseException: <result of getMessage>
- *
- * @param currentTokenVal ?
- * @param expectedTokenSequencesVal ?
- * @param tokenImageVal ?
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
*/
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- ) {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
+ public Token currentToken;
/**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+ int line;
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
* The following constructors are for use by you for whatever
* purpose you can think of. Constructing the exception in this
* manner makes the exception behave in the normal way - i.e., as
@@ -51,7 +56,6 @@
* relevant information. The JavaCC generated code does not use
* these constructors.
*/
-
public ParseException() {
super();
specialConstructor = false;
@@ -65,40 +69,35 @@
public ParseException(String message, int line, int column) {
super(message);
specialConstructor = false;
- this.line = line;
- this.column = column;
+ this.line = line;
+ this.column = column;
}
-
/**
- * This variable determines which constructor was used to create
- * this object and thereby affects the semantics of the
- * "getMessage" method (see below).
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ *
+ * @param currentTokenVal ?
+ * @param expectedTokenSequencesVal ?
+ * @param tokenImageVal ?
*/
- protected boolean specialConstructor;
+ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
/**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
* This method has the standard behavior when this object has been
* created using the standard constructors. Otherwise, it uses
* "currentToken" and "expectedTokenSequences" to generate a parse
@@ -112,43 +111,58 @@
if (!specialConstructor) {
return super.getMessage();
}
+
StringBuffer expected = new StringBuffer();
- int maxSize = 0;
+ int maxSize = 0;
+
for (int[] expectedTokenSequence : expectedTokenSequences) {
if (maxSize < expectedTokenSequence.length) {
maxSize = expectedTokenSequence.length;
}
+
for (int anExpectedTokenSequence : expectedTokenSequence) {
expected.append(tokenImage[anExpectedTokenSequence]).append(" ");
}
+
if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) {
expected.append("...");
}
+
expected.append(eol).append(" ");
}
+
String retval = "Encountered \"";
- Token tok = currentToken.next;
+ Token tok = currentToken.next;
+
for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
+ if (i != 0) {
+ retval += " ";
+ }
+
if (tok.kind == 0) {
retval += tokenImage[0];
+
break;
}
+
retval += add_escapes(tok.image);
- tok = tok.next;
+ tok = tok.next;
}
+
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
+
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
} else {
retval += "Was expecting one of:" + eol + " ";
}
+
retval += expected.toString();
+
return retval;
}
-
public int getLine() {
return line;
}
@@ -157,9 +171,6 @@
return column;
}
- /** The end of line string for this machine. */
- protected String eol = System.getProperty("line.separator", "\n");
-
/**
* Used to convert raw characters to their escaped version
* when these raw version cannot be used as part of an ASCII
@@ -170,45 +181,58 @@
*/
protected String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
- char ch;
+ char ch;
+
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
- case 0:
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
+ case 0 :
+ continue;
+ case '\b' :
+ retval.append("\\b");
+
+ continue;
+ case '\t' :
+ retval.append("\\t");
+
+ continue;
+ case '\n' :
+ retval.append("\\n");
+
+ continue;
+ case '\f' :
+ retval.append("\\f");
+
+ continue;
+ case '\r' :
+ retval.append("\\r");
+
+ continue;
+ case '\"' :
+ retval.append("\\\"");
+
+ continue;
+ case '\'' :
+ retval.append("\\\'");
+
+ continue;
+ case '\\' :
+ retval.append("\\\\");
+
+ continue;
+ default :
+ if ((ch = str.charAt(i)) < 0x20 || (ch > 0x7e)) {
+ String s = "0000" + Integer.toString(ch, 16);
+
+ retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
}
}
+
return retval.toString();
- }
+ }
+}
-}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/SimpleNode.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,19 +1,20 @@
+
/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
-
package org.nuiton.guix.parser;
+//~--- non-JDK imports --------------------------------------------------------
+
import org.nuiton.guix.model.ClassDescriptor;
public class SimpleNode implements Node {
- protected Node parent;
- protected Node[] children;
- protected int id;
- protected JavaParser parser;
- public Token firstToken;
- public Token lastToken;
+ protected Node[] children;
+ public Token firstToken;
+ protected int id;
private ClassDescriptor javaType;
+ public Token lastToken;
+ protected Node parent;
+ protected JavaParser parser;
-
public SimpleNode(int i) {
id = i;
}
@@ -23,16 +24,13 @@
parser = p;
}
-
public int getId() {
return id;
}
- public void jjtOpen() {
- }
+ public void jjtOpen() {}
- public void jjtClose() {
- }
+ public void jjtClose() {}
public void jjtSetParent(Node n) {
parent = n;
@@ -46,12 +44,10 @@
return (SimpleNode) parent;
}
-
public ClassDescriptor getJavaType() {
return javaType;
}
-
public void setJavaType(ClassDescriptor javaType) {
this.javaType = javaType;
}
@@ -61,9 +57,11 @@
children = new Node[i + 1];
} else if (i >= children.length) {
Node c[] = new Node[i + 1];
+
System.arraycopy(children, 0, c, 0, children.length);
children = c;
}
+
children[i] = n;
}
@@ -76,15 +74,18 @@
}
public int jjtGetNumChildren() {
- return (children == null) ? 0 : children.length;
+ return (children == null)
+ ? 0
+ : children.length;
}
- /* You can override these two methods in subclasses of SimpleNode to
-customize the way the node appears when the tree is dumped. If
-your output uses more than one line you should override
-toString(String), otherwise overriding toString() is probably all
-you need to do. */
-
+ /*
+ * You can override these two methods in subclasses of SimpleNode to
+ * customize the way the node appears when the tree is dumped. If
+ * your output uses more than one line you should override
+ * toString(String), otherwise overriding toString() is probably all
+ * you need to do.
+ */
@Override
public String toString() {
return getClass().getName() + "[" + getText() + "]";
@@ -94,14 +95,17 @@
return prefix + toString();
}
- /* Override this method if you want to customize how the node dumps
- out its children. */
-
+ /*
+ * Override this method if you want to customize how the node dumps
+ * out its children.
+ */
public void dump(String prefix) {
System.out.println(toString(prefix));
+
if (children != null) {
for (Node aChildren : children) {
SimpleNode n = (SimpleNode) aChildren;
+
if (n != null) {
n.dump(prefix + " ");
}
@@ -116,16 +120,19 @@
}
}
-
/** @return the text of the tokens comprising this node. */
public String getText() {
StringBuffer text = new StringBuffer();
- Token t = firstToken;
+ Token t = firstToken;
+
while (t != null) {
appendSpecialTokens(text, t.specialToken);
text.append(t.image);
- if (t == lastToken)
+
+ if (t == lastToken) {
break;
+ }
+
t = t.next;
}
@@ -133,3 +140,5 @@
}
}
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Token.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Token.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/Token.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
package org.nuiton.guix.parser;
@@ -2,10 +3,3 @@
/** Describes the input token stream. */
-
public class Token {
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
@@ -22,6 +16,13 @@
public String image;
/**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
* A reference to the next regular (non-special) token from the input
* stream. If this is the last token from the input stream, or if the
* token manager has not read tokens beyond this one, this field is
@@ -64,12 +65,13 @@
*/
public static final Token newToken(int ofKind) {
switch (ofKind) {
- default:
- return new Token();
- case JavaParserConstants.RUNSIGNEDSHIFT:
- case JavaParserConstants.RSIGNEDSHIFT:
- case JavaParserConstants.GT:
- return new GTToken();
+ default :
+ return new Token();
+
+ case JavaParserConstants.RUNSIGNEDSHIFT :
+ case JavaParserConstants.RSIGNEDSHIFT :
+ case JavaParserConstants.GT :
+ return new GTToken();
}
}
@@ -77,3 +79,6 @@
int realKind = JavaParserConstants.GT;
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/TokenMgrError.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/TokenMgrError.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/parser/TokenMgrError.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,3 +1,4 @@
+
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
package org.nuiton.guix.parser;
@@ -2,18 +3,20 @@
public class TokenMgrError extends Error {
+
+ /** Tried to change to an invalid lexical state. */
+ static final int INVALID_LEXICAL_STATE = 2;
+
/*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
/** Lexical error occured. */
static final int LEXICAL_ERROR = 0;
- /** An attempt wass made to create a second instance of a static token manager. */
- static final int STATIC_LEXER_ERROR = 1;
-
- /** Tried to change to an invalid lexical state. */
- static final int INVALID_LEXICAL_STATE = 2;
-
/** Detected (and bailed out of) an infinite loop in the token manager. */
static final int LOOP_DETECTED = 3;
+ /** An attempt wass made to create a second instance of a static token manager. */
+ static final int STATIC_LEXER_ERROR = 1;
+ private static final long serialVersionUID = -9131500865453532454L;
+
/**
@@ -23,8 +26,22 @@
* one of the above 4 values.
*/
int errorCode;
- private static final long serialVersionUID = -9131500865453532454L;
+ /*
+ * Constructors of various flavors follow.
+ */
+ public TokenMgrError() {}
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter,
+ char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+
/**
* Replaces unprintable characters by their espaced (or unicode escaped)
* equivalents in the given string
@@ -34,44 +51,55 @@
*/
protected static String addEscapes(String str) {
StringBuffer retval = new StringBuffer();
- char ch;
+ char ch;
+
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
- case 0:
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
+ case 0 :
+ continue;
+ case '\b' :
+ retval.append("\\b");
+
+ continue;
+ case '\t' :
+ retval.append("\\t");
+
+ continue;
+ case '\n' :
+ retval.append("\\n");
+
+ continue;
+ case '\f' :
+ retval.append("\\f");
+
+ continue;
+ case '\r' :
+ retval.append("\\r");
+
+ continue;
+ case '\"' :
+ retval.append("\\\"");
+
+ continue;
+ case '\'' :
+ retval.append("\\\'");
+
+ continue;
+ case '\\' :
+ retval.append("\\\\");
+
+ continue;
+ default :
+ if ((ch = str.charAt(i)) < 0x20 || (ch > 0x7e)) {
+ String s = "0000" + Integer.toString(ch, 16);
+
+ retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
}
}
+
return retval.toString();
}
@@ -86,12 +114,12 @@
* @return a detailed message for the Error when it is thrown by the
* token manager to indicate a lexical error.
*/
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return ("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn,
+ String errorAfter, char curChar) {
+ return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen
+ ? "<EOF> "
+ : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \""
+ + addEscapes(errorAfter) + "\"");
}
/**
@@ -107,20 +135,7 @@
public String getMessage() {
return super.getMessage();
}
+}
- /*
- * Constructors of various flavors follow.
- */
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ScriptHandler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ScriptHandler.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/ScriptHandler.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,11 +1,16 @@
package org.nuiton.guix.tags;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+//~--- JDK imports ------------------------------------------------------------
+
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringWriter;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
/**
* Handles the <code><script></code> tag.
@@ -23,12 +28,14 @@
*/
public String loadScriptFile(File scriptFile) throws IOException {
StringWriter scriptBuffer = new StringWriter();
- FileReader in = new FileReader(scriptFile);
- char[] readBuffer = new char[2048];
- int c;
+ FileReader in = new FileReader(scriptFile);
+ char[] readBuffer = new char[2048];
+ int c;
+
while ((c = in.read(readBuffer)) > 0) {
scriptBuffer.write(readBuffer, 0, c);
}
+
return scriptBuffer.toString();
}
@@ -42,24 +49,26 @@
* @throws IOException
* @throws XmlPullParserException
*/
- public String compileScript(XmlPullParser xpp, File scriptFile)
- throws IOException, XmlPullParserException {
-
+ public String compileScript(XmlPullParser xpp, File scriptFile) throws IOException, XmlPullParserException {
StringBuffer script = new StringBuffer();
- if(scriptFile != null && scriptFile.exists())
+
+ if ((scriptFile != null) && scriptFile.exists()) {
script.append(loadScriptFile(scriptFile));
+ }
xpp.nextToken();
+
if (xpp.getEventType() == XmlPullParser.CDSECT) {
script.append(xpp.getText());
}
+
while ((xpp.getEventType() != XmlPullParser.END_TAG) || (!xpp.getName().equals("script"))) {
xpp.nextToken();
}
- do {
- xpp.nextToken();
- } while (xpp.getEventType() != XmlPullParser.START_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT);
-
+
return script.toString();
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/StyleHandler.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,18 +1,10 @@
-
package org.nuiton.guix.tags;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+//~--- non-JDK imports --------------------------------------------------------
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.nuiton.guix.css.CSSParser;
import org.nuiton.guix.css.CSSParserConstants;
import org.nuiton.guix.css.CSSParserTreeConstants;
@@ -21,9 +13,24 @@
import org.nuiton.guix.model.Rule;
import org.nuiton.guix.model.Selector;
import org.nuiton.guix.model.StyleSheet;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Handles the <code><style></code> tag.
*
@@ -32,8 +39,9 @@
public class StyleHandler {
/** log */
- protected static final Log log = LogFactory.getLog(TagManager.class);
- /** List of the selectors */
+ protected static final Log log = LogFactory.getLog(TagManager.class);
+
+ /** List of the selectors */
private List<Selector> selectors = new ArrayList<Selector>();
/**
@@ -46,12 +54,14 @@
*/
private String loadStyleFile(File styleFile) throws FileNotFoundException, IOException {
StringWriter styleBuffer = new StringWriter();
- FileReader in = new FileReader(styleFile);
- char[] readBuffer = new char[2048];
- int c;
+ FileReader in = new FileReader(styleFile);
+ char[] readBuffer = new char[2048];
+ int c;
+
while ((c = in.read(readBuffer)) > 0) {
styleBuffer.write(readBuffer, 0, c);
}
+
return styleBuffer.toString();
}
@@ -85,81 +95,94 @@
* while parsing the guix file
*/
public StyleSheet compileStyle(XmlPullParser xpp, File styleFile) throws IOException, XmlPullParserException {
- StyleSheet result = null;
+ StyleSheet result = null;
+ StringBuffer style = new StringBuffer();
- StringBuffer style = new StringBuffer();
- if(styleFile != null && styleFile.exists())
+ if ((styleFile != null) && styleFile.exists()) {
style.append(loadStyleFile(styleFile));
+ }
xpp.nextToken();
+
do {
switch (xpp.getEventType()) {
- case XmlPullParser.START_TAG:
- if(log.isWarnEnabled())
- log.warn("<style> tag may not contain child elements: " + xpp.getName());
- break;
- case XmlPullParser.TEXT:
- break;// fall through
- case XmlPullParser.CDSECT:
- style.append(xpp.getText());
- xpp.nextToken();
- break;
+ case XmlPullParser.START_TAG :
+ if (log.isWarnEnabled()) {
+ log.warn("<style> tag may not contain child elements: " + xpp.getName());
+ }
+
+ break;
+
+ case XmlPullParser.TEXT :
+ break; // fall through
+
+ case XmlPullParser.CDSECT :
+ style.append(xpp.getText());
+ xpp.nextToken();
+
+ break;
}
} while ((xpp.getEventType() != XmlPullParser.END_TAG) && (!xpp.getName().equals("style")));
-
- //analyze the content of the CSS
+
+ // analyze the content of the CSS
result = processStylesheet(style.toString());
- //reaches next START_TAG
- do {
- xpp.nextToken();
- } while (xpp.getEventType() != XmlPullParser.START_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT);
-
return result;
-
}
/**
* Analyses a selector node
- *
+ *
* @param selector the selector node to analyse
* @return a Selector with the class, styleclass, pseudoclass and/or id
* which rules will be applied to
*/
protected Selector processSelector(SimpleNode selector) {
- //chack if it is a selector
+
+ // chack if it is a selector
if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) {
throw new IllegalArgumentException("argument node is not a Selector");
}
+
String javaClassName = null;
- String styleClass = null;
- String pseudoClass = null;
- String id = null;
+ String styleClass = null;
+ String pseudoClass = null;
+ String id = null;
for (int i = 0; i < selector.jjtGetNumChildren(); i++) {
SimpleNode child = selector.getChild(i);
+
switch (child.getId()) {
- //class
- case CSSParserTreeConstants.JJTJAVACLASS:
- if (!child.getText().trim().equals("*")) {
- javaClassName = child.getText();
- }
- break;
- //styleclass
- case CSSParserTreeConstants.JJTCLASS:
- styleClass = child.getText().substring(1);
- break;
- //pseudoclass
- case CSSParserTreeConstants.JJTPSEUDOCLASS:
- pseudoClass = child.getText().substring(1);
- break;
- //id
- case CSSParserTreeConstants.JJTID:
- id = child.getText().substring(1);
- break;
- //error if other
- default:
- throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
+
+ // class
+ case CSSParserTreeConstants.JJTJAVACLASS :
+ if (!child.getText().trim().equals("*")) {
+ javaClassName = child.getText();
+ }
+
+ break;
+
+ // styleclass
+ case CSSParserTreeConstants.JJTCLASS :
+ styleClass = child.getText().substring(1);
+
+ break;
+
+ // pseudoclass
+ case CSSParserTreeConstants.JJTPSEUDOCLASS :
+ pseudoClass = child.getText().substring(1);
+
+ break;
+
+ // id
+ case CSSParserTreeConstants.JJTID :
+ id = child.getText().substring(1);
+
+ break;
+
+ // error if other
+ default :
+ throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId());
}
}
@@ -173,60 +196,76 @@
* @return a Rule containing the properties and the selectors of the rule
*/
protected Rule processRule(SimpleNode ruleNode) {
- //checks if it is a rule
+
+ // checks if it is a rule
if (ruleNode.getId() != CSSParserTreeConstants.JJTRULE) {
throw new IllegalArgumentException("argument node is not a Rule");
}
SimpleNode selectorsNode = ruleNode.getChild(0);
+
assert selectorsNode.getId() == CSSParserTreeConstants.JJTSELECTORS : "expected node to be of type Selectors";
List<Selector> ruleSelectors = new ArrayList<Selector>();
- //analyses each selector
+
+ // analyses each selector
for (int i = 0; i < selectorsNode.jjtGetNumChildren(); i++) {
SimpleNode selectorNode = selectorsNode.getChild(i);
- Selector selector = processSelector(selectorNode);
+ Selector selector = processSelector(selectorNode);
+
ruleSelectors.add(selector);
- //records the selector if it has not been recorded yet
+
+ // records the selector if it has not been recorded yet
if (!selectorRecorded(selector)) {
selectors.add(selector);
}
}
Map<String, String> properties = new HashMap<String, String>();
- //records the properties
+
+ // records the properties
for (int i = 1; i < ruleNode.jjtGetNumChildren(); i++) {
SimpleNode declarationNode = ruleNode.getChild(i);
+
if (declarationNode.getId() == CSSParserTreeConstants.JJTDECLARATION) {
- String key = declarationNode.getChild(0).getText();
+ String key = declarationNode.getChild(0).getText();
SimpleNode valueNode = declarationNode.getChild(1);
- String value = valueNode.getText();
+ String value = valueNode.getText();
+
if (valueNode.firstToken.kind == CSSParserConstants.STRING) {
value = value.substring(1, value.length() - 1);
}
+
properties.put(key, value);
}
}
- //creates the new rule
+
+ // creates the new rule
Rule rule = new Rule();
+
rule.setSelectors(ruleSelectors);
+
for (Selector selector : ruleSelectors) {
selector.getRules().add(rule);
}
+
rule.setProperties(properties);
+
return rule;
}
/**
* Analyses the CSS
- *
+ *
* @param stylesheetText the content of the CSS file or the style tag
* @return the StyleSheet containing the rules of the CSS file or the style tag
*/
protected StyleSheet processStylesheet(String stylesheetText) {
- //parses the CSS
- CSSParser p = new CSSParser(new StringReader(stylesheetText));
+
+ // parses the CSS
+ CSSParser p = new CSSParser(new StringReader(stylesheetText));
SimpleNode node;
+
try {
node = p.Stylesheet();
} catch (ParseException ex) {
@@ -234,16 +273,20 @@
}
List<Rule> rules = new ArrayList<Rule>();
- //analyses each rule
+
+ // analyses each rule
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
SimpleNode ruleNode = node.getChild(i);
- Rule rule = processRule(ruleNode);
+ Rule rule = processRule(ruleNode);
+
rules.add(rule);
}
-
+
StyleSheet styleSheet = new StyleSheet();
+
styleSheet.setRules(rules);
styleSheet.setSelectors(selectors);
+
return styleSheet;
}
@@ -255,18 +298,37 @@
*/
private boolean selectorRecorded(Selector newSelector) {
for (Selector selector : selectors) {
- boolean areJavaClassNamesNull = newSelector.getJavaClassName() == null && selector.getJavaClassName() == null;
- boolean areJavaClassNamesNotNull = newSelector.getJavaClassName() != null && selector.getJavaClassName() != null;
- boolean areStyleClassesNull = newSelector.getStyleClass() == null && selector.getStyleClass() == null;
- boolean areStyleClassesNotNull = newSelector.getStyleClass() != null && selector.getStyleClass() != null;
- boolean arePseudoClassesNull = newSelector.getPseudoClass() == null && selector.getPseudoClass() == null;
- boolean arePseudoClassesNotNull = newSelector.getPseudoClass() != null && selector.getPseudoClass() != null;
- boolean areIdsNull = newSelector.getId() == null && selector.getId() == null;
- boolean areIdsNotNull = newSelector.getId() != null && selector.getId() != null;
- if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName().equals(selector.getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector.getStyleClass().equals(selector.getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector.getPseudoClass().equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector.getId().equals(selector.getId())))) {
+ boolean areJavaClassNamesNull = (newSelector.getJavaClassName() == null)
+ && (selector.getJavaClassName() == null);
+ boolean areJavaClassNamesNotNull = (newSelector.getJavaClassName() != null)
+ && (selector.getJavaClassName() != null);
+ boolean areStyleClassesNull = (newSelector.getStyleClass() == null)
+ && (selector.getStyleClass() == null);
+ boolean areStyleClassesNotNull = (newSelector.getStyleClass() != null)
+ && (selector.getStyleClass() != null);
+ boolean arePseudoClassesNull = (newSelector.getPseudoClass() == null)
+ && (selector.getPseudoClass() == null);
+ boolean arePseudoClassesNotNull = (newSelector.getPseudoClass() != null)
+ && (selector.getPseudoClass() != null);
+ boolean areIdsNull = (newSelector.getId() == null) && (selector.getId() == null);
+ boolean areIdsNotNull = (newSelector.getId() != null) && (selector.getId() != null);
+
+ if ((areJavaClassNamesNull || (areJavaClassNamesNotNull && newSelector.getJavaClassName()
+ .equals(selector
+ .getJavaClassName()))) && (areStyleClassesNull || (areStyleClassesNotNull && newSelector
+ .getStyleClass()
+ .equals(selector
+ .getStyleClass()))) && (arePseudoClassesNull || (arePseudoClassesNotNull && newSelector
+ .getPseudoClass()
+ .equals(selector.getPseudoClass()))) && (areIdsNull || (areIdsNotNull && newSelector
+ .getId().equals(selector.getId())))) {
return true;
}
}
+
return false;
}
}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagManager.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagManager.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/tags/TagManager.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -1,258 +1,286 @@
package org.nuiton.guix.tags;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+//~--- JDK imports ------------------------------------------------------------
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* Manages tags of the .guix files.
*/
public class TagManager {
- /** log */
- protected static final Log log = LogFactory.getLog(TagManager.class);
- /**
- * Namespace for Guix's non-class tags, such as <Button;>. The namespace normally does not
- * need to be specified but can be used to resolve ambiguities.
- */
- public static final String GUIX_NAMESPACE = "org.nuiton.guix.*";
- /** Maps simple tag names to their default namespaces (package names). */
- private static Map<String, String> defaultNamespaces = new HashMap<String, String>();
+ /**
+ * Namespace for Guix's non-class tags, such as <Button;>. The namespace normally does not
+ * need to be specified but can be used to resolve ambiguities.
+ */
+ public static final String GUIX_NAMESPACE = "org.nuiton.guix.*";
- /** Keeps track of whether or not named classes exist. */
- private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>();
+ /** log */
+ protected static final Log log = LogFactory.getLog(TagManager.class);
/** List of the Guix classes such as <Button;> */
protected static List<String> guixClasses = new ArrayList<String>();
+ /** Maps simple tag names to their default namespaces (package names). */
+ private static Map<String, String> defaultNamespaces = new HashMap<String, String>();
- private TagManager() { /* not instantiable */ }
+ /** Keeps track of whether or not named classes exist. */
+ private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>();
+ private TagManager() { /* not instantiable */
+ }
- /*public static void reset(boolean verbose) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
- registeredBeans.clear();
- registeredTags.clear();
- defaultNamespaces.clear();
- CompiledObjectDecorator.reset();
- JAXXCompilerLaunchor.loadLibraries(verbose);
- }*/
+ /*
+ * public static void reset(boolean verbose) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
+ * registeredBeans.clear();
+ * registeredTags.clear();
+ * defaultNamespaces.clear();
+ * CompiledObjectDecorator.reset();
+ * JAXXCompilerLaunchor.loadLibraries(verbose);
+ * }
+ */
+ /**
+ * Maps a class tag to a specific <code>TagHandler</code>. When a tag representing the bean class is
+ * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified
+ * <code>TagHandler</code> will be invoked to compile it.
+ *
+ * @param beanClass the class to associate with a <code>TagHandler</code>
+ * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code>
+ * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code>
+ */
- /**
- * Maps a class tag to a specific <code>TagHandler</code>. When a tag representing the bean class is
- * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified
- * <code>TagHandler</code> will be invoked to compile it.
- *
- * @param beanClass the class to associate with a <code>TagHandler</code>
- * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code>
- * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code>
- */
- /*public static <T extends TagHandler> void registerBean(ClassDescriptor beanClass, Class<T> handler) {
- if (!DefaultObjectHandler.class.isAssignableFrom(handler)) {
- throw new IllegalArgumentException("handler class must be a subclass of DefaultObjectHandler");
- }
- registeredBeans.put(beanClass, handler);
- if (log.isDebugEnabled()) {
- log.debug(beanClass + " : " + handler);
- }
- String name = beanClass.getName();
- int dotPos = name.lastIndexOf(".");
- String namespace = name.substring(0, dotPos + 1) + "*";
- name = name.substring(dotPos + 1);
- registerDefaultNamespace(name, namespace);
- }*/
+ /*
+ * public static <T extends TagHandler> void registerBean(ClassDescriptor beanClass, Class<T> handler) {
+ * if (!DefaultObjectHandler.class.isAssignableFrom(handler)) {
+ * throw new IllegalArgumentException("handler class must be a subclass of DefaultObjectHandler");
+ * }
+ * registeredBeans.put(beanClass, handler);
+ * if (log.isDebugEnabled()) {
+ * log.debug(beanClass + " : " + handler);
+ * }
+ * String name = beanClass.getName();
+ * int dotPos = name.lastIndexOf(".");
+ * String namespace = name.substring(0, dotPos + 1) + "*";
+ * name = name.substring(dotPos + 1);
+ * registerDefaultNamespace(name, namespace);
+ * }
+ */
+ /**
+ * Sets the default namespace for a tag. When the tag is encountered with no namespace specified,
+ * the specified namespace will be assumed. Mapping the same tag to two or more default namespaces
+ * removes the mapping and marks the entry as being ambiguous (by putting a <code>null</code>
+ * value into the map); this causes an error to be thrown if the tag is used without a namespace being
+ * specified.
+ * <p/>
+ * Java package names on tags are automatically converted into namespaces (e.g. <javax.swing.JButton/>
+ * and <JButton xmlns="javax.swing.*"/> are equivalent), so tags with package names are considered
+ * to have namespaces specified.
+ *
+ * @param tag tag name
+ * @param namespace namespace
+ */
+ public static void registerDefaultNamespace(String tag, String namespace) {
+ if (defaultNamespaces.containsKey(tag) && (defaultNamespaces.get(tag) != null)
+ &&!defaultNamespaces.get(tag).equals(namespace)) {
+ defaultNamespaces.put(tag, null); // tag name is now ambiguous
+ } else {
+ defaultNamespaces.put(tag, namespace);
+ }
+ }
- /**
- * Sets the default namespace for a tag. When the tag is encountered with no namespace specified,
- * the specified namespace will be assumed. Mapping the same tag to two or more default namespaces
- * removes the mapping and marks the entry as being ambiguous (by putting a <code>null</code>
- * value into the map); this causes an error to be thrown if the tag is used without a namespace being
- * specified.
- * <p/>
- * Java package names on tags are automatically converted into namespaces (e.g. <javax.swing.JButton/>
- * and <JButton xmlns="javax.swing.*"/> are equivalent), so tags with package names are considered
- * to have namespaces specified.
- *
- * @param tag tag name
- * @param namespace namespace
- */
- public static void registerDefaultNamespace(String tag, String namespace) {
- if (defaultNamespaces.containsKey(tag)
- && defaultNamespaces.get(tag) != null
- && !defaultNamespaces.get(tag).equals(namespace)) {
- defaultNamespaces.put(tag, null); // tag name is now ambiguous
- } else {
- defaultNamespaces.put(tag, namespace);
- }
- }
-
/**
- *
+ *
* @param className
*/
public static void registerGuixClasse(String className) {
guixClasses.add(className);
}
- /**
- * Registers a <code>TagHandler</code> for a tag. When a tag with the given name and namespace
- * is encountered, the <code>TagHandler's compileFirstPass</code> and <code>compileSecondPass</code>
- * methods will be invoked to handle it.
- * <p/>
- * It is not an error to register an already-registered tag and namespace combination. The new mapping
- * will replace the old mapping.
- *
- * @param namespace the tag's namespace
- * @param tag the simple name of the tag
- * @param handler the <code>TagHandler</code> which should process the tag
- */
- /*public static <T extends TagHandler> void registerTag(String namespace, String tag, T handler) {
- if (namespace == null) {
- namespace = "*";
- }
- //System.out.println("registerTag "+namespace+" : "+tag+" : "+handler);
- if (log.isDebugEnabled()) {
- log.debug(tag + " : " + handler);
- }
- registeredTags.put(new QName(namespace, tag), handler);
- registerDefaultNamespace(tag, namespace);
- }*/
+ /**
+ * Registers a <code>TagHandler</code> for a tag. When a tag with the given name and namespace
+ * is encountered, the <code>TagHandler's compileFirstPass</code> and <code>compileSecondPass</code>
+ * methods will be invoked to handle it.
+ * <p/>
+ * It is not an error to register an already-registered tag and namespace combination. The new mapping
+ * will replace the old mapping.
+ *
+ * @param namespace the tag's namespace
+ * @param tag the simple name of the tag
+ * @param handler the <code>TagHandler</code> which should process the tag
+ */
+ /*
+ * public static <T extends TagHandler> void registerTag(String namespace, String tag, T handler) {
+ * if (namespace == null) {
+ * namespace = "*";
+ * }
+ * //System.out.println("registerTag "+namespace+" : "+tag+" : "+handler);
+ * if (log.isDebugEnabled()) {
+ * log.debug(tag + " : " + handler);
+ * }
+ * registeredTags.put(new QName(namespace, tag), handler);
+ * registerDefaultNamespace(tag, namespace);
+ * }
+ */
- /**
- * Returns the <code>TagHandler</code> that should be used to process the specified tag.
- * If the tag represents the class name of an uncompiled <code>.jaxx</code> file, the
- * <code>.jaxx</code> is first compiled.
- *
- * @param namespace the tag's namespace (may be <code>null</code>)
- * @param tag the tag's simple name
- * @param compiler the current <code>JAXXCompiler</code>
- * @return the <code>TagHandler</code> for the tag
- * @throws jaxx.CompilerException ?
- */
- /*public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException {
- return getTagHandler(namespace, tag, false, compiler);
- }*/
+ /**
+ * Returns the <code>TagHandler</code> that should be used to process the specified tag.
+ * If the tag represents the class name of an uncompiled <code>.jaxx</code> file, the
+ * <code>.jaxx</code> is first compiled.
+ *
+ * @param namespace the tag's namespace (may be <code>null</code>)
+ * @param tag the tag's simple name
+ * @param compiler the current <code>JAXXCompiler</code>
+ * @return the <code>TagHandler</code> for the tag
+ * @throws jaxx.CompilerException ?
+ */
+ /*
+ * public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException {
+ * return getTagHandler(namespace, tag, false, compiler);
+ * }
+ */
- /*private static String getNamespace(ClassDescriptor beanClass) {
- String packageName = beanClass.getPackageName();
- return packageName != null ? packageName + ".*" : "*";
+ /*
+ * private static String getNamespace(ClassDescriptor beanClass) {
+ * String packageName = beanClass.getPackageName();
+ * return packageName != null ? packageName + ".*" : "*";
+ *
+ * }
+ */
- }*/
+ /*
+ * private static String getSimpleName(ClassDescriptor beanClass) {
+ * String packageName = beanClass.getPackageName();
+ * if (packageName != null) {
+ * assert beanClass.getName().startsWith(packageName);
+ * return beanClass.getName().substring(packageName.length() + 1);
+ * }
+ * return beanClass.getName();
+ * }
+ */
+ /**
+ * @param beanClass the tag class
+ * @return the <code>TagHandler</code> that should be used to process the specified class.
+ * Only <code>TagHandlers</code> previously registered with <code>registerBean</code>
+ * are considered.
+ * @throws jaxx.CompilerException ?
+ */
- /*private static String getSimpleName(ClassDescriptor beanClass) {
- String packageName = beanClass.getPackageName();
- if (packageName != null) {
- assert beanClass.getName().startsWith(packageName);
- return beanClass.getName().substring(packageName.length() + 1);
- }
- return beanClass.getName();
- }*/
+ /*
+ * public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException {
+ * try {
+ * if (beanClass == null) {
+ * throw new NullPointerException();
+ * }
+ * String namespace = getNamespace(beanClass);
+ * String tag = getSimpleName(beanClass);
+ * DefaultObjectHandler handler = (DefaultObjectHandler) registeredTags.get(new QName(namespace, tag));
+ * if (handler == null) {
+ * Class<? extends TagHandler> handlerClass = registeredBeans.get(beanClass);
+ * if (handlerClass == null) {
+ * throw new CompilerException("unable to find handler for " + beanClass);
+ * }
+ * Constructor<? extends TagHandler> constructor = handlerClass.getConstructor(ClassDescriptor.class);
+ * handler = (DefaultObjectHandler) constructor.newInstance(beanClass);
+ * registerTag(namespace, tag, handler);
+ * }
+ * return handler;
+ * }
+ * catch (InstantiationException e) {
+ * throw new RuntimeException(e);
+ * }
+ * catch (NoSuchMethodException e) {
+ * throw new RuntimeException(e);
+ * }
+ * catch (IllegalAccessException e) {
+ * throw new RuntimeException(e);
+ * }
+ * catch (InvocationTargetException e) {
+ * throw new RuntimeException(e);
+ * }
+ * }
+ */
-
- /**
- * @param beanClass the tag class
- * @return the <code>TagHandler</code> that should be used to process the specified class.
- * Only <code>TagHandlers</code> previously registered with <code>registerBean</code>
- * are considered.
- * @throws jaxx.CompilerException ?
- */
- /*public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException {
- try {
- if (beanClass == null) {
- throw new NullPointerException();
- }
- String namespace = getNamespace(beanClass);
- String tag = getSimpleName(beanClass);
- DefaultObjectHandler handler = (DefaultObjectHandler) registeredTags.get(new QName(namespace, tag));
- if (handler == null) {
- Class<? extends TagHandler> handlerClass = registeredBeans.get(beanClass);
- if (handlerClass == null) {
- throw new CompilerException("unable to find handler for " + beanClass);
- }
- Constructor<? extends TagHandler> constructor = handlerClass.getConstructor(ClassDescriptor.class);
- handler = (DefaultObjectHandler) constructor.newInstance(beanClass);
- registerTag(namespace, tag, handler);
- }
- return handler;
- }
- catch (InstantiationException e) {
- throw new RuntimeException(e);
- }
- catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }*/
-
/**
* Tests if a class exists
*
* @param className name of the class we want to know if it exists
* @return true if the class exists
*/
- private static boolean classExists(String className) {
- if (classExistenceCache.containsKey(className)) {
- return classExistenceCache.get(className);
- }
+ private static boolean classExists(String className) {
+ if (classExistenceCache.containsKey(className)) {
+ return classExistenceCache.get(className);
+ }
- boolean found = false;
+ boolean found = false;
- try {
- Class.forName(className);
- found = true;
- }catch (ClassNotFoundException e) {
+ try {
+ Class.forName(className);
+ found = true;
+ } catch (ClassNotFoundException e) {
+
// ignore ?
+ } catch (NoClassDefFoundError e) { // we get this instead of ClassNotFoundException on case-insensitive file systems when
+
+ // looking up a class with the wrong case
}
- catch (NoClassDefFoundError e) { // we get this instead of ClassNotFoundException on case-insensitive file systems when
- // looking up a class with the wrong case
- }
-
- classExistenceCache.put(className, found);
- return found;
- }
+ classExistenceCache.put(className, found);
- /**
- * Resolves a simple class name (like <code>Object</code> or <code>String</code>) to its fully-qualified name. Inner
- * classes should be represented as they would appear in Java source code (e.g. JPopupMenu.Separator). Fully-qualified names,
- * such as <code>java.lang.Object</code> are legal and will be returned unmodified (and in fact it is generally impossible to
- * even know whether a given reference is fully qualified until it has been resolved). Returns <code>null</code> if no matching
- * class could be found.
- *
- * @param name name to resolve
- * @param compiler compile to use
- * @return the resolved fqn class name
- */
- public static String resolveClassName(String name) {
- if (name.endsWith("[]"))
- return resolveClassName(name.substring(0, name.length() - 2)) + "[]";
- if (name.indexOf("<") != -1)
- name = name.substring(0, name.indexOf("<")); // strip off generic types
- name = name.intern();
- if (name.equals("boolean") || name.equals("byte") || name.equals("short") || name.equals("int") ||
- name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char"))
- return name;
-
- if (guixClasses.contains(name)) {
+ return found;
+ }
+
+ /**
+ * Resolves a simple class name (like <code>Object</code> or <code>String</code>) to its fully-qualified name. Inner
+ * classes should be represented as they would appear in Java source code (e.g. JPopupMenu.Separator). Fully-qualified names,
+ * such as <code>java.lang.Object</code> are legal and will be returned unmodified (and in fact it is generally impossible to
+ * even know whether a given reference is fully qualified until it has been resolved). Returns <code>null</code> if no matching
+ * class could be found.
+ *
+ * @param name name to resolve
+ * @param compiler compile to use
+ * @return the resolved fqn class name
+ */
+ public static String resolveClassName(String name) {
+ if (name.endsWith("[]")) {
+ return resolveClassName(name.substring(0, name.length() - 2)) + "[]";
+ }
+
+ if (name.indexOf("<") != -1) {
+ name = name.substring(0, name.indexOf("<")); // strip off generic types
+ }
+
+ name = name.intern();
+
+ if (name.equals("boolean") || name.equals("byte") || name.equals("short") || name.equals("int")
+ || name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char")) {
+ return name;
+ }
+
+ if (guixClasses.contains(name)) {
return GUIX_NAMESPACE.substring(0, GUIX_NAMESPACE.lastIndexOf('*')) + name;
- }
- //if the name of the tag is the fully qualified class name
- if(name.lastIndexOf('.') >= 0) {
+ }
+
+ // if the name of the tag is the fully qualified class name
+ if (name.lastIndexOf('.') >= 0) {
return name;
}
- return null;
- }
-}
\ No newline at end of file
+ return null;
+ }
+}
+
+
+//~ Formatted by Jindent --- http://www.jindent.com
Modified: guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java
===================================================================
--- guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/GuixLauncherTest.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -22,7 +22,7 @@
public void compileTest() {
GuixInitializer.initialize();
- GuixLauncher gl = new GuixLauncher(null,null,null,null);
+ GuixLauncher gl = new GuixLauncher(null,null,null,null,null);
assertTrue(gl.files == null || gl.classNames.length == gl.files.length);
assertTrue(gl.compile());
assertTrue(gl.files == null || gl.rootModelObjects.size() == gl.files.length);
@@ -31,7 +31,7 @@
File f2 = new File(f.getAbsolutePath());
File dir = new File("target/test");
File dir2 = new File(dir.getAbsolutePath());
- gl = new GuixLauncher(new File[]{f2},dir2,"org.nuiton.guix",f2.getParentFile());
+ gl = new GuixLauncher(new File[]{f2},dir2,"org.nuiton.guix",f2.getParentFile(), null);
assertTrue(gl.files == null || gl.classNames.length == gl.files.length);
assertTrue(gl.compile());
}
@@ -41,7 +41,7 @@
*/
@Test
public void registerClassDescriptorTest() {
- GuixLauncher gl = new GuixLauncher(null,null,null,null);
+ GuixLauncher gl = new GuixLauncher(null,null,null,null,null);
assertFalse(gl.registerClassDescriptor(null));
assertFalse(gl.registerClassDescriptor(new ClassDescriptor(null, null)));
Modified: guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java
===================================================================
--- guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java 2009-05-06 16:33:39 UTC (rev 1394)
+++ guix/trunk/guix-compiler/src/test/java/org/nuiton/guix/compiler/GuixCompilerTest.java 2009-05-07 15:19:37 UTC (rev 1395)
@@ -17,7 +17,7 @@
File f = new File("src/test/test.guix");
File f2 = new File(f.getAbsolutePath());
GuixLauncher gl = new GuixLauncher(new File[]{f2}, null,
- "org.nuiton.guix",f2.getParentFile());
+ "org.nuiton.guix",f2.getParentFile(),null);
GuixCompiler gc = new GuixCompiler(null, null,null);
assertNull(gc.compile());
1
0
r1394 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org May 6, 2009
by sletellier@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: sletellier
Date: 2009-05-06 16:33:39 +0000 (Wed, 06 May 2009)
New Revision: 1394
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-api</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-api</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-api</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-api</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -50,8 +50,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -62,8 +62,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-validator</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-validator</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-compiler-validator</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -156,9 +156,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-example</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-example</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-example</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-example</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
<profiles>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -62,8 +62,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-api</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-api</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-api</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-api</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -114,9 +114,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing-widget</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-swing-widget</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -67,8 +67,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -65,8 +65,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator-swing</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator-swing</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-runtime-validator-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -81,9 +81,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-swing-action</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-swing-action</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-swing-action</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/jaxx-swing-action</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/jaxx…</url>
</scm>
</project>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -144,9 +144,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/maven-jaxx-plugin</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/maven-jaxx-plugin</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/maven-jaxx-plugin</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk/maven-jaxx-plugin</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/mave…</url>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-06 16:33:33 UTC (rev 1393)
+++ jaxx/trunk/pom.xml 2009-05-06 16:33:39 UTC (rev 1394)
@@ -14,7 +14,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5</version>
+ <version>1.6-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -212,9 +212,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/trunk</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/trunk/?roo…</url>
</scm>
<!-- Maven Environment : Repositories -->
1
0
r1393 - in jaxx/tags: . jaxx-1.5/jaxx-runtime-swing-widget/src/main/resources/i18n
by sletellier@users.labs.libre-entreprise.org May 6, 2009
by sletellier@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: sletellier
Date: 2009-05-06 16:33:33 +0000 (Wed, 06 May 2009)
New Revision: 1393
Added:
jaxx/tags/jaxx-1.5/
Modified:
jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
Log:
[maven-release-plugin] copy for tag jaxx-1.5
Copied: jaxx/tags/jaxx-1.5 (from rev 1392, jaxx/trunk)
Modified: jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-06 15:36:03 UTC (rev 1392)
+++ jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-06 16:33:33 UTC (rev 1393)
@@ -24,4 +24,4 @@
numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
-numbereditor.toggleSign=+/-
\ No newline at end of file
+numbereditor.toggleSign=+/-
1
0
r1392 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-swing-widget jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org May 6, 2009
by sletellier@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: sletellier
Date: 2009-05-06 15:36:03 +0000 (Wed, 06 May 2009)
New Revision: 1392
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.5
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-api</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-api</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -50,8 +50,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -62,8 +62,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-compiler-validator</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -156,9 +156,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-example</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-example</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
<profiles>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -62,8 +62,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-api</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-api</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-runtime-swing-widget/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -114,9 +114,9 @@
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-swing-widget</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -67,8 +67,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -65,8 +65,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-runtime-validator-swing</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -81,9 +81,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-swing-action</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/jaxx-swing-action</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -144,9 +144,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
- <url>${maven.scm.url.child}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/maven-jaxx-plugin</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5/maven-jaxx-plugin</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-05-06 15:01:17 UTC (rev 1391)
+++ jaxx/trunk/pom.xml 2009-05-06 15:36:03 UTC (rev 1392)
@@ -14,7 +14,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.5-SNAPSHOT</version>
+ <version>1.5</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -212,9 +212,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.5</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
<!-- Maven Environment : Repositories -->
1
0
r1391 - in jaxx/trunk: jaxx-example/src/main/java/jaxx/demo jaxx-runtime-swing/src/main/java/jaxx/runtime jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor jaxx-runtime-swing-widget/src/main/resources/i18n
by sletellier@users.labs.libre-entreprise.org May 6, 2009
by sletellier@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: sletellier
Date: 2009-05-06 15:01:17 +0000 (Wed, 06 May 2009)
New Revision: 1391
Removed:
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/widget/
Modified:
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
Log:
Updating NumberEditor model automatiquely
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx 2009-05-06 14:43:09 UTC (rev 1390)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx 2009-05-06 15:01:17 UTC (rev 1391)
@@ -40,7 +40,6 @@
property='positifInteger'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getPositifInteger()}'
autoPopup='false'
showPopupButton='true'
showReset='true'/>
@@ -50,7 +49,6 @@
property='positifInteger'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getPositifInteger()}'
autoPopup='true'
showPopupButton='true'
showReset='true'/>
@@ -65,7 +63,6 @@
property='normalInteger'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getNormalInteger()}'
autoPopup='false'
showPopupButton='true'
showReset='true'
@@ -76,7 +73,6 @@
property='normalInteger'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getNormalInteger()}'
autoPopup='true'
showPopupButton='true'
showReset='true'
@@ -92,7 +88,6 @@
property='positifFloat'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getPositifFloat()}'
autoPopup='false'
showPopupButton='true'
showReset='true'/>
@@ -102,7 +97,6 @@
property='positifFloat'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getPositifFloat()}'
autoPopup='true'
showPopupButton='true'
showReset='true'/>
@@ -117,7 +111,6 @@
property='normalFloat'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getNormalFloat()}'
autoPopup='false'
showPopupButton='true'
showReset='true'
@@ -128,7 +121,6 @@
property='normalFloat'
constructorParams='this'
bean='{demoModel}'
- model='{demoModel.getNormalFloat()}'
autoPopup='true'
showPopupButton='true'
showReset='true'
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-05-06 14:43:09 UTC (rev 1390)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-05-06 15:01:17 UTC (rev 1391)
@@ -149,8 +149,10 @@
// evince the model
model.removeListDataListener(combo);
model.removeAllElements();
- for (Object o : data) {
- model.addElement(o);
+ if (data != null){
+ for (Object o : data) {
+ model.addElement(o);
+ }
}
// attach the model
model.addListDataListener(combo);
@@ -170,8 +172,10 @@
if (firstNull) {
items.add(new Item("null", " ", null, false));
}
- for (Object d : data) {
- items.add(new Item(d.toString(), d.toString(), d, d.equals(select)));
+ if (data != null){
+ for (Object d : data) {
+ items.add(new Item(d.toString(), d.toString(), d, d.equals(select)));
+ }
}
combo.setItems(items);
}
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx 2009-05-06 14:43:09 UTC (rev 1390)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx 2009-05-06 15:01:17 UTC (rev 1391)
@@ -25,7 +25,7 @@
<Boolean id='autoPopup' javaBean='false'/>
<!-- showPopupButton property -->
- <Boolean id='showPopupButton' javaBean='true'/>
+ <Boolean id='showPopupButton' javaBean='false'/>
<!-- show reset property -->
<Boolean id='showReset' javaBean='false'/>
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-06 14:43:09 UTC (rev 1390)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-06 15:01:17 UTC (rev 1391)
@@ -1,6 +1,7 @@
package jaxx.runtime.swing.editor;
import java.awt.Dimension;
+import java.lang.reflect.InvocationTargetException;
import javax.swing.JTextField;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.math.NumberUtils;
@@ -51,34 +52,52 @@
/** initialise l'ui et les listeners d'évènements. */
public void init() {
+ try {
+ if (editor.getBean() == null) {
+ throw new NullPointerException("can not have a null bean in ui " + editor);
+ }
+ editor.addPropertyChangeListener(MODEL_PROPERTY, new PropertyChangeListener() {
- if (editor.getBean() == null) {
- throw new NullPointerException("can not have a null bean in ui " + editor);
- }
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug("set new model " + evt.getNewValue() + " for " + editor.getProperty());
+ }
+ setModel((Number) evt.getOldValue(), (Number) evt.getNewValue());
+ }
+ });
+ editor.addPropertyChangeListener(POPUP_VISIBLE_PROPERTY, new PropertyChangeListener() {
- editor.addPropertyChangeListener(MODEL_PROPERTY, new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug("set new model " + evt.getNewValue() + " for " + editor.getProperty());
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ setPopupVisible((Boolean) evt.getNewValue());
}
- setModel((Number) evt.getOldValue(), (Number) evt.getNewValue());
- }
- });
- editor.addPropertyChangeListener(POPUP_VISIBLE_PROPERTY, new PropertyChangeListener() {
+ });
+ editor.getTextField().addMouseListener(new PopupListener());
+
+ // Determine si c'est un float
+ Class type = getGetter().getReturnType();
+ editor.setUseFloat(!type.equals(Integer.class) && !type.equals(int.class));
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- setPopupVisible((Boolean) evt.getNewValue());
+ // Initialise le model
+ if (editor.getModel() == null){
+ Number num = (Number)getGetter().invoke(editor.getBean(), null);
+ editor.setModel(num);
}
- });
- editor.getTextField().addMouseListener(new PopupListener());
-
- // Determine si c'est un float
- Class type = getGetter().getReturnType();
- editor.setUseFloat(!type.equals(Integer.class) && !type.equals(int.class));
-
+
+ /*if (editor.getResetButton().getIcon() == null) {
+ editor.getResetButton().setIcon(SwingUtil.createActionIcon("numbereditor-reset"));
+ }
+ if (editor.getButton().getIcon() == null) {
+ editor.getButton().setIcon(SwingUtil.createActionIcon("numbereditor-calculator"));
+ }*/
+ } catch (IllegalAccessException ex) {
+ log.error(ex);
+ } catch (IllegalArgumentException ex) {
+ log.error(ex);
+ } catch (InvocationTargetException ex) {
+ log.error(ex);
+ }
/*if (editor.getResetButton().getIcon() == null) {
editor.getResetButton().setIcon(SwingUtil.createActionIcon("numbereditor-reset"));
}
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-06 14:43:09 UTC (rev 1390)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties 2009-05-06 15:01:17 UTC (rev 1391)
@@ -24,4 +24,4 @@
numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
-numbereditor.toggleSign=+/-
+numbereditor.toggleSign=+/-
\ No newline at end of file
1
0
Author: kmorin
Date: 2009-05-06 14:43:09 +0000 (Wed, 06 May 2009)
New Revision: 1390
Modified:
guix/trunk/guix-test/pom.xml
Log:
Modified: guix/trunk/guix-test/pom.xml
===================================================================
--- guix/trunk/guix-test/pom.xml 2009-05-06 14:42:53 UTC (rev 1389)
+++ guix/trunk/guix-test/pom.xml 2009-05-06 14:43:09 UTC (rev 1390)
@@ -1,19 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
<!-- ************************************************************* -->
<!-- *** POM Relationships *************************************** -->
<!-- ************************************************************* -->
- <parent>
+ <parent>
<groupId>org.nuiton.guix</groupId>
<artifactId>guix</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
- <artifactId>guix-test</artifactId>
+ <artifactId>guix-test</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0.5</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+
<!-- ************************************************************* -->
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
1
0
r1389 - guix/trunk/guix-compiler/src/main/java/org/nuiton/guix
by kmorin@users.labs.libre-entreprise.org May 6, 2009
by kmorin@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: kmorin
Date: 2009-05-06 14:42:53 +0000 (Wed, 06 May 2009)
New Revision: 1389
Modified:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
Log:
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-06 07:29:23 UTC (rev 1388)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-06 14:42:53 UTC (rev 1389)
@@ -4,6 +4,7 @@
import org.nuiton.guix.compiler.GuixCompiler;
import java.io.File;
import java.io.FileWriter;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -65,7 +66,8 @@
this.targetDirectory = targetDirectory;
if (rootPackage != null) {
this.rootPackage = rootPackage;
- } else {
+ }
+ else {
this.rootPackage = "";
}
if (files != null) {
@@ -75,11 +77,13 @@
if (baseDir != null) {
classNames[i] = rootPackage + "." + path.substring(baseDir.getAbsolutePath().length() + 1,
path.lastIndexOf('.')).replace(File.separatorChar, '.');
- } else {
+ }
+ else {
classNames[i] = path.substring(0, path.lastIndexOf('.'));
}
}
- } else {
+ }
+ else {
classNames = null;
}
}
@@ -118,7 +122,8 @@
if (dotPos != -1) {
destDir = new File(targetDirectory, className.substring(0, dotPos).replace('.', File.separatorChar));
classPackage = className.substring(0, dotPos);
- } else {
+ }
+ else {
destDir = new File(targetDirectory, className);
classPackage = className;
}
@@ -128,7 +133,8 @@
}
continue;
}
- } else {
+ }
+ else {
destDir = file.getParentFile();
classPackage = destDir.getAbsolutePath().replace(File.separatorChar, '.');
}
@@ -141,7 +147,8 @@
if (compiler.isFailed()) {
success = false;
}
- } else {
+ }
+ else {
if (log.isWarnEnabled()) {
log.warn(file.getName() + " has already been compiled.");
}
@@ -160,11 +167,23 @@
}
}
if (success || true) {
- /*XmlPullParserFactory factory =
- XmlPullParserFactory.newInstance(
- System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
- null);*/
+ XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(
+ System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
+ null);
+ XmlSerializer serializer = factory.newSerializer();
+ File config = new File(targetDirectory,"config.xml");
+
+ serializer.setOutput(new PrintWriter(config));
+ serializer.startDocument("UTF-8", null);
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n");
+ serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "\t");
+ serializer.text("\n");
+ serializer.docdecl(" beans SYSTEM \"http://www.springframework.org/dtd/spring-beans.dtd\"");
+ serializer.text("\n");
+ serializer.startTag("", "beans");
+
for (GuixModelObject mo : rootModelObjects.keySet()) {
//File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
File out = new File(destDir, mo.getClassDescriptor().getName() + ".java");
@@ -174,6 +193,7 @@
if (log.isInfoEnabled()) {
log.info(mo.getClassDescriptor().getName() + " last modification : " + new Date(rootModelObjects.get(mo).getLastModification()));
}
+
if (rootModelObjects.get(mo).getLastModification() > out.lastModified()) {
if (log.isInfoEnabled()) {
log.info("Generation of " + mo.getClassDescriptor().getName());
@@ -210,10 +230,38 @@
ImplementationGenerator img = new ImplementationGenerator(mo);
img.generate(outImpl);
- } else if (log.isWarnEnabled()) {
+ serializer.startTag("", "bean");
+ serializer.attribute("", "id", out.getName().replace(out.getName().charAt(0),
+ Character.toLowerCase(out.getName().charAt(0))));
+ serializer.attribute("", "class", out.getName() + "Impl");
+ serializer.attribute("", "singleton", "false");
+
+ /*<bean id = "articlesDao" class
+
+ ="istia.st.articles.dao.ArticlesDaoPlainJdbc">
+ <constructor-arg index="0">
+ <value>org.firebirdsql.jdbc.FBDriver</value>
+ </constructor-arg>
+ <constructor-arg index="1">
+ <value>jdbc:firebirdsql:localhost/3050:d:/databases/dbarticles.gdb</value>
+ </constructor-arg>
+ <constructor-arg index="2">
+ <value>someone</value>
+ </constructor-arg>
+ <constructor-arg index="3">
+ <value>somepassword</value>
+ </constructor-arg>
+ </bean>*/
+
+
+ }
+ else
+ if (log.isWarnEnabled()) {
log.warn(mo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
}
+ serializer.endTag("", "beans");
+ serializer.endDocument();
/*// pass 2
if (!nextStep(LifeCycle.compile_second_pass, success)) {
@@ -299,12 +347,14 @@
e.printStackTrace();
return false;*/
}
- } catch (Throwable e) {
+ }
+ catch (Throwable e) {
e.printStackTrace();
return false;
}
return success;
- } else {
+ }
+ else {
if (log.isWarnEnabled()) {
log.warn("No file to compile");
}
@@ -438,7 +488,8 @@
if (log.isDebugEnabled()) {
log.debug("add script to ClassDescriptor " + classDescriptor);
}
- } else if (!classDescriptors.get(i).getScript().equals(classDescriptor.getScript())) {
+ }
+ else if (!classDescriptors.get(i).getScript().equals(classDescriptor.getScript())) {
if (log.isDebugEnabled()) {
log.error("ClassDescriptor " + classDescriptor + " script already defined and different !");
}
@@ -451,7 +502,8 @@
if (log.isDebugEnabled()) {
log.debug("add superclass to ClassDescriptor " + classDescriptor);
}
- } else if (!classDescriptors.get(i).getSuperClass().equals(classDescriptor.getSuperClass())) {
+ }
+ else if (!classDescriptors.get(i).getSuperClass().equals(classDescriptor.getSuperClass())) {
if (log.isErrorEnabled()) {
log.error("ClassDescriptor " + classDescriptor + " superclass already defined and different !");
}
1
0
r1388 - in guix/trunk/guix-compiler/src/main/java/org/nuiton/guix: . compiler generator
by kmorin@users.labs.libre-entreprise.org May 6, 2009
by kmorin@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: kmorin
Date: 2009-05-06 07:29:23 +0000 (Wed, 06 May 2009)
New Revision: 1388
Added:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
Modified:
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
Log:
Site
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-06 07:28:41 UTC (rev 1387)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/GuixLauncher.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -4,7 +4,6 @@
import org.nuiton.guix.compiler.GuixCompiler;
import java.io.File;
import java.io.FileWriter;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -14,6 +13,9 @@
import java.util.Map.Entry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.generator.AbstractClassGenerator;
+import org.nuiton.guix.generator.ImplementationGenerator;
+import org.nuiton.guix.generator.InterfaceGenerator;
import org.nuiton.guix.model.ClassDescriptor;
import org.nuiton.guix.model.GuixModelObject;
import org.nuiton.guix.model.Rule;
@@ -61,19 +63,21 @@
// Set up a simple configuration that logs on the console.
this.files = files;
this.targetDirectory = targetDirectory;
- if(rootPackage != null)
+ if (rootPackage != null) {
this.rootPackage = rootPackage;
- else
+ } else {
this.rootPackage = "";
+ }
if (files != null) {
classNames = new String[files.length];
for (int i = 0; i < files.length; i++) {
String path = files[i].getAbsolutePath();
- if(baseDir != null)
+ if (baseDir != null) {
classNames[i] = rootPackage + "." + path.substring(baseDir.getAbsolutePath().length() + 1,
- path.lastIndexOf('.')).replace(File.separatorChar,'.');
- else
- classNames[i] = path.substring(0,path.lastIndexOf('.'));
+ path.lastIndexOf('.')).replace(File.separatorChar, '.');
+ } else {
+ classNames[i] = path.substring(0, path.lastIndexOf('.'));
+ }
}
} else {
classNames = null;
@@ -93,7 +97,7 @@
guixFiles.addAll(Arrays.asList(files));
guixFileClassNames.addAll(Arrays.asList(classNames));
boolean success = true;
-
+
try {
assert guixFiles.size() == guixFileClassNames.size();
@@ -126,7 +130,7 @@
}
} else {
destDir = file.getParentFile();
- classPackage = destDir.getAbsolutePath().replace(File.separatorChar,'.');
+ classPackage = destDir.getAbsolutePath().replace(File.separatorChar, '.');
}
//compile the file
GuixCompiler compiler = new GuixCompiler(file, this, classPackage);
@@ -156,24 +160,34 @@
}
}
if (success || true) {
- XmlPullParserFactory factory =
- XmlPullParserFactory.newInstance(
- System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
- null);
+ /*XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(
+ System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
+ null);*/
for (GuixModelObject mo : rootModelObjects.keySet()) {
- File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
+ //File f = new File(destDir, mo.getClassDescriptor().getName() + "ModelTree.xml");
+ File out = new File(destDir, mo.getClassDescriptor().getName() + ".java");
+ File outAbstract = new File(destDir, mo.getClassDescriptor().getName() + "Abstract.java");
+ File outImpl = new File(destDir, mo.getClassDescriptor().getName() + "Impl.java");
+
if (log.isInfoEnabled()) {
log.info(mo.getClassDescriptor().getName() + " last modification : " + new Date(rootModelObjects.get(mo).getLastModification()));
}
- if (rootModelObjects.get(mo).getLastModification() > f.lastModified()) {
+ if (rootModelObjects.get(mo).getLastModification() > out.lastModified()) {
if (log.isInfoEnabled()) {
log.info("Generation of " + mo.getClassDescriptor().getName());
}
- if (!f.exists()) {
- f.createNewFile();
+ if (!out.exists()) {
+ out.createNewFile();
}
- XmlSerializer serializer = factory.newSerializer();
+ if (!outAbstract.exists()) {
+ outAbstract.createNewFile();
+ }
+ if (!outImpl.exists()) {
+ outImpl.createNewFile();
+ }
+ /*XmlSerializer serializer = factory.newSerializer();
XmlSerializer cssSerializer = factory.newSerializer();
serializer.setOutput(new PrintWriter(f));
@@ -185,7 +199,17 @@
writeModelTree(serializer, mo, cssSerializer, destDir);
- serializer.endDocument();
+ serializer.endDocument();*/
+
+ InterfaceGenerator ing = new InterfaceGenerator(mo);
+ ing.generate(out);
+
+ AbstractClassGenerator acg = new AbstractClassGenerator(mo);
+ acg.generate(outAbstract);
+
+ ImplementationGenerator img = new ImplementationGenerator(mo);
+ img.generate(outImpl);
+
} else if (log.isWarnEnabled()) {
log.warn(mo.getClassDescriptor().getName() + " has already been generated and is up to date.");
}
@@ -393,14 +417,11 @@
* and package has a different script or superclass
*/
public boolean registerClassDescriptor(ClassDescriptor classDescriptor) {
- if(classDescriptor == null || classDescriptor.getName() == null)
+ if (classDescriptor == null || classDescriptor.getName() == null) {
return false;
+ }
int i = 0;
- while (i < classDescriptors.size()
- && (!classDescriptors.get(i).getName().equals(classDescriptor.getName())
- || (classDescriptors.get(i).getPackageName() != null
- && classDescriptor.getPackageName() != null
- && !classDescriptors.get(i).getPackageName().equals(classDescriptor.getPackageName())))) {
+ while (i < classDescriptors.size() && (!classDescriptors.get(i).getName().equals(classDescriptor.getName()) || (classDescriptors.get(i).getPackageName() != null && classDescriptor.getPackageName() != null && !classDescriptors.get(i).getPackageName().equals(classDescriptor.getPackageName())))) {
i++;
}
//if the ClassDescriptor does not exist
Modified: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-06 07:28:41 UTC (rev 1387)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/compiler/GuixCompiler.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -41,8 +41,12 @@
private ScriptHandler scriptHandler = new ScriptHandler();
/** Root of the model */
private GuixModelObject rootMO;
- /** */
+ /** Long representing the date and time of the last modification of any file
+ * used during compilation */
private long lastModification;
+ /** Integer used to give an id to the objects which don't have one specified
+ * by the user */
+ private int index = 1;
/*------------------------------------------------------------------------*/
/*-- Constructor methods -------------------------------------------------*/
@@ -216,9 +220,12 @@
tagName = xpp.getName();
}
+ String id = (xpp.getAttributeValue("", "id") != null ?
+ xpp.getAttributeValue("", "id")
+ : "$" + tagName + index++);
//create the GuixModelObject representing the tag
- GuixModelObject mo = new GuixModelObject(xpp.getAttributeValue("", "id"),
- javaDoc, xpp.getAttributeValue("", "styleClass"));
+ GuixModelObject mo = new GuixModelObject(id, javaDoc,
+ xpp.getAttributeValue("", "styleClass"));
mo.setParent(previousMO);
mo.setClassDescriptor(new ClassDescriptor(tagName, tagPackageName));
mo.setChildren(new ArrayList<GuixModelObject>());
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/AbstractClassGenerator.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -0,0 +1,81 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.generator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.nuiton.guix.model.GuixModelObject;
+
+/**
+ *
+ * @author morin
+ */
+public class AbstractClassGenerator extends GuixGenerator {
+
+ public AbstractClassGenerator(GuixModelObject gmo) {
+ super(gmo);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+
+ sb.append("\npublic abstract class ");
+ sb.append(gmo.getClassDescriptor().getName());
+ sb.append("Abstract {\n");
+
+ addAttributes(gmo);
+
+ addGettersAndSetters(gmo);
+
+ sb.append("\n\n}");
+
+ saveFile(out);
+ }
+
+ @Override
+ protected void addGettersAndSetters(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append(child.getClassDescriptor().getName());
+ sb.append(" get");
+ sb.append(child.getId().replace(child.getId().charAt(0),
+ Character.toUpperCase(child.getId().charAt(0))));
+ sb.append("() {\n\t\treturn this.");
+ sb.append((child.getId() != null && !child.getId().equals("")) ? child.getId() : "test");
+ sb.append(";\n\t}");
+
+ sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("void set");
+ sb.append(child.getId().replace(child.getId().charAt(0),
+ Character.toUpperCase(child.getId().charAt(0))));
+ sb.append("(");
+ sb.append(child.getClassDescriptor().getName());
+ sb.append(" ");
+ sb.append(child.getId());
+ sb.append("){\n\t\tthis.");
+ sb.append(child.getId());
+ sb.append(" = ");
+ sb.append(child.getId());
+ sb.append(";\n\t}");
+
+ addGettersAndSetters(child);
+ }
+ }
+
+ private void addAttributes(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ sb.append("\tprivate ");
+ sb.append(child.getClassDescriptor().getName());
+ sb.append(" ");
+ sb.append(child.getId());
+ sb.append(";\n");
+ addAttributes(child);
+ }
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/GuixGenerator.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -0,0 +1,70 @@
+package org.nuiton.guix.generator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.guix.model.GuixModelObject;
+
+/**
+ * GuixGenerator
+ *
+ */
+public abstract class GuixGenerator {
+
+ /** log */
+ protected Log log = LogFactory.getLog(GuixGenerator.class);
+ protected GuixModelObject gmo;
+ protected StringBuffer sb = new StringBuffer();
+ protected List<String> classes = new ArrayList<String>();
+
+ public GuixGenerator(GuixModelObject gmo) {
+ this.gmo = gmo;
+ }
+
+ public abstract void generate(File out);
+
+ protected void generate() {
+ sb.append("package ");
+ sb.append(gmo.getClassDescriptor().getPackageName());
+ sb.append(";\n\n");
+
+ addImports(gmo);
+ }
+
+ protected abstract void addGettersAndSetters(GuixModelObject gmo);
+
+ protected void addImports(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ String fqn = child.getClassDescriptor().getPackageName() + "." + child.getClassDescriptor().getName();
+ if (!classes.contains(fqn)) {
+ classes.add(fqn);
+ sb.append("import " + fqn + ";\n");
+ }
+ addImports(child);
+ }
+ }
+
+ protected void saveFile(File out) {
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(out);
+ fw.write(sb.toString());
+ fw.close();
+ } catch (IOException ex) {
+ if(log.isErrorEnabled())
+ log.error(ex);
+ } finally {
+ try {
+ fw.close();
+ } catch (IOException ex) {
+ Logger.getLogger(GuixGenerator.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+}
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/ImplementationGenerator.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -0,0 +1,41 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.guix.generator;
+
+import java.io.File;
+import java.io.IOException;
+import org.nuiton.guix.model.GuixModelObject;
+
+/**
+ *
+ * @author morin
+ */
+public class ImplementationGenerator extends GuixGenerator {
+
+ public ImplementationGenerator(GuixModelObject gmo) {
+ super(gmo);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+
+ sb.append("\npublic class ");
+ sb.append(gmo.getClassDescriptor().getName());
+ sb.append("Impl extends ");
+ sb.append(gmo.getClassDescriptor().getName());
+ sb.append("Abstract {\n");
+
+ sb.append("\n\n}");
+
+ saveFile(out);
+ }
+
+ @Override
+ protected void addGettersAndSetters(GuixModelObject gmo) {
+ }
+
+}
Added: guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java
===================================================================
--- guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java (rev 0)
+++ guix/trunk/guix-compiler/src/main/java/org/nuiton/guix/generator/InterfaceGenerator.java 2009-05-06 07:29:23 UTC (rev 1388)
@@ -0,0 +1,62 @@
+package org.nuiton.guix.generator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.nuiton.guix.model.GuixModelObject;
+
+/**
+ * Generator of interfaces
+ *
+ * @author morin
+ */
+public class InterfaceGenerator extends GuixGenerator {
+
+ public InterfaceGenerator(GuixModelObject gmo) {
+ super(gmo);
+ }
+
+ @Override
+ public void generate(File out) {
+ super.generate();
+
+ sb.append("\npublic interface ");
+ sb.append(gmo.getClassDescriptor().getName());
+ sb.append(" {\n");
+
+ addGettersAndSetters(gmo);
+
+ sb.append("\n\n}");
+
+ saveFile(out);
+ }
+
+ @Override
+ protected void addGettersAndSetters(GuixModelObject gmo) {
+ for (GuixModelObject child : gmo.getChildren()) {
+ sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append(child.getClassDescriptor().getName());
+ sb.append(" get");
+ sb.append(child.getId().replace(child.getId().charAt(0),
+ Character.toUpperCase(child.getId().charAt(0))));
+ sb.append("();");
+
+ sb.append(child.getId().startsWith("$") ? "\n\n\tprotected " : "\n\n\tpublic ");
+ sb.append("void set");
+ sb.append(child.getId().replace(child.getId().charAt(0),
+ Character.toUpperCase(child.getId().charAt(0))));
+ sb.append("(");
+ sb.append(child.getClassDescriptor().getName());
+ sb.append(" ");
+ sb.append(child.getId());
+ sb.append(");");
+
+ addGettersAndSetters(child);
+ }
+ }
+
+}
1
0
Author: kmorin
Date: 2009-05-06 07:28:41 +0000 (Wed, 06 May 2009)
New Revision: 1387
Modified:
guix/trunk/pom.xml
Log:
Site
Modified: guix/trunk/pom.xml
===================================================================
--- guix/trunk/pom.xml 2009-05-06 05:44:44 UTC (rev 1386)
+++ guix/trunk/pom.xml 2009-05-06 07:28:41 UTC (rev 1387)
@@ -21,15 +21,9 @@
<module>guix-compiler</module>
<module>guix-maven-plugin</module>
<module>guix-test</module>
- </modules>
+
+ </modules>
- <!--dependencies>
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
- </dependency>
- </dependencies-->
-
<dependencyManagement>
<dependencies>
@@ -178,10 +172,6 @@
</plugins>
</pluginManagement>
- <plugins>
-
- </plugins>
-
</build>
<!-- ************************************************************* -->
@@ -246,4 +236,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
1
0
r1383 - jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor
by sletellier@users.labs.libre-entreprise.org May 6, 2009
by sletellier@users.labs.libre-entreprise.org May 6, 2009
May 6, 2009
Author: sletellier
Date: 2009-05-04 23:09:13 +0000 (Mon, 04 May 2009)
New Revision: 1383
Modified:
jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
Log:
Bug input start with "-" fixed
Modified: jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-04 19:39:58 UTC (rev 1382)
+++ jaxx/trunk/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2009-05-04 23:09:13 UTC (rev 1383)
@@ -130,6 +130,8 @@
boolean endWithDot = false;
+ boolean isLess = false;
+
Number newValue = null;
if (s.trim().isEmpty()) {
@@ -139,6 +141,9 @@
} else if (s.endsWith(".")) {
s += "0";
endWithDot = true;
+ } else if (s.length() == 1 && s.startsWith("-")) {
+ s += "0";
+ isLess = true;
}
if (s != null && NumberUtils.isNumber(s)) {
@@ -181,8 +186,10 @@
if (log.isDebugEnabled()) {
log.debug("can apply new model value : " + newValue);
}
- // on peut mettre a jour le model
- editor.setModel(newValue);
+ if (!isLess){
+ // on peut mettre a jour le model
+ editor.setModel(newValue);
+ }
if (endWithDot) {
editor.setModelText(s.substring(0, s.length() - 1));
field.setCaretPosition(oldPosition);
2
1