Jaxx-commits
Threads by month
- ----- 2026 -----
- 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
November 2012
- 1 participants
- 11 discussions
r2516 - in trunk: . jaxx-compiler/src/main/java/jaxx/compiler/css jaxx-compiler/src/main/java/jaxx/compiler/tags jaxx-compiler/src/main/java/jaxx/compiler/tags/swing jaxx-maven-plugin
by tchemitï¼ users.nuiton.org 11 Nov '12
by tchemitï¼ users.nuiton.org 11 Nov '12
11 Nov '12
Author: tchemit
Date: 2012-11-11 20:54:31 +0100 (Sun, 11 Nov 2012)
New Revision: 2516
Url: http://nuiton.org/repositories/revision/jaxx/2516
Log:
fixes #2429: Updates to helper-m-p 2.0
refs #2428: Updates to mavenpom 3.4.4
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java
trunk/jaxx-maven-plugin/pom.xml
trunk/pom.xml
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2012-10-30 07:43:45 UTC (rev 2515)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2012-11-11 19:54:31 UTC (rev 2516)
@@ -27,6 +27,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
+import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.binding.DataBinding;
import jaxx.compiler.binding.DataBindingHelper;
@@ -38,6 +39,7 @@
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
@@ -257,8 +259,13 @@
value.equals(Rule.DATA_BINDING)) {
continue;
}
+
+ if (handler instanceof DefaultComponentHandler)
handler.setAttribute(object, e.getKey(), e.getValue(),
false, compiler);
+ else {
+ handler.setAttributeFromCss(object, e.getKey(), value, compiler);
+ }
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2012-10-30 07:43:45 UTC (rev 2515)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2012-11-11 19:54:31 UTC (rev 2516)
@@ -28,6 +28,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.CompilerException;
+import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.UnsupportedAttributeException;
import jaxx.compiler.beans.JAXXBeanInfo;
@@ -759,6 +760,76 @@
* @param object the object on which to set the property
* @param propertyName the name of the property to set
* @param stringValue the raw string value of the property from the XML
+ * @param compiler the current <code>JAXXCompiler</code>
+ */
+ public void setAttributeFromCss(CompiledObject object,
+ String propertyName,
+ String stringValue,
+ JAXXCompiler compiler) {
+
+ try {
+
+ object.addProperty(propertyName, stringValue);
+ ClassDescriptor type = getPropertyType(object, propertyName, compiler);
+ String binding = DataBindingHelper.processDataBindings(stringValue);
+ boolean withBinding = binding != null;
+
+ if (!withBinding) {
+ // no bindings, convert from string
+
+ // add support for i18n attributes (otherwise already done in DefaultComponentHandler)
+ if (I18nHelper.isI18nableAttribute(propertyName, compiler)) {
+ stringValue = I18nHelper.addI18nInvocation(object.getId(), propertyName, stringValue, compiler);
+ }
+
+ try {
+ Class<?> typeClass = type != null ?
+ ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) :
+ null;
+ Object value = convertFromString(propertyName,
+ stringValue,
+ typeClass
+ );
+ setProperty(object, propertyName, value, compiler);
+ return;
+ } catch (NumberFormatException e) {
+ compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName());
+ } catch (IllegalArgumentException e) {
+ compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName());
+ } catch (ClassNotFoundException e) {
+ compiler.reportError("could not find class " + type.getName());
+ }
+ }
+ String setPropertyCode = getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler);
+ if (propertyName.equals(LAYOUT_ATTRIBUTE)) {
+
+ // try to add the layout class in imports
+ if (setPropertyCode.contains(BORDER_LAYOUT_PREFIX)) {
+ compiler.addImport(BorderLayout.class);
+ } else if (setPropertyCode.contains(GRID_LAYOUT_PREFIX)) {
+ compiler.addImport(GridLayout.class);
+ }
+ // handle containerDelegate (e.g. contentPane on JFrame)
+ // have to set layout early, before children are added
+ object.appendInitializationCode(setPropertyCode);
+ }
+ compiler.getBindingHelper().registerDataBinding(
+ object.getId() + "." + propertyName,
+ binding,
+ setPropertyCode
+ );
+ } catch (UnsupportedAttributeException e) {
+ compiler.reportError("class " + object.getObjectClass().getName() + " does not support attribute '" + propertyName + "'");
+ }
+ }
+
+ /**
+ * Set a single property on an object. The value may be either a simple value or contain data binding expressions.
+ * Simple values are first converted to the property's type using {@link #convertFromString(String, String, Class)}.
+ *
+ * @param object the object on which to set the property
+ * @param propertyName the name of the property to set
+ * @param stringValue the raw string value of the property from the XML
* @param inline <code>true</code> if the value was directly specified as an inline class tag attribute, <code>false</code> otherwise (a default value, specified in CSS, etc.)
* @param compiler the current <code>JAXXCompiler</code>
*/
@@ -1108,7 +1179,7 @@
StringBuilder message =
new StringBuilder("value of '" +
- key + "' must be one of: [");
+ key + "' must be one of: [");
for (int j = 0; j < values.length - 2; j += 3) {
if (j != 0) {
message.append(", ");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java 2012-10-30 07:43:45 UTC (rev 2515)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java 2012-11-11 19:54:31 UTC (rev 2516)
@@ -93,16 +93,7 @@
// id = compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(TabInfo.class));
}
TabInfo tabInfo = new TabInfo(id);
- CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(TabInfo.class), compiler) {
-
- @Override
- public void addProperty(String property, String value) {
- if (I18nHelper.isI18nableAttribute(property, compiler)) {
- value = I18nHelper.addI18nInvocation(getId(), property, value, compiler);
- }
- super.addProperty(property, value);
- }
- };
+ CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(TabInfo.class), compiler);
compiler.registerCompiledObject(compiledTabInfo);
//id = tabInfo.getId();
tabs.tabInfo = tabInfo;
Modified: trunk/jaxx-maven-plugin/pom.xml
===================================================================
--- trunk/jaxx-maven-plugin/pom.xml 2012-10-30 07:43:45 UTC (rev 2515)
+++ trunk/jaxx-maven-plugin/pom.xml 2012-11-11 19:54:31 UTC (rev 2516)
@@ -87,7 +87,7 @@
<dependency>
<groupId>org.nuiton</groupId>
- <artifactId>helper-maven-plugin</artifactId>
+ <artifactId>helper-maven-plugin-api</artifactId>
</dependency>
<dependency>
@@ -147,7 +147,7 @@
<dependency>
<groupId>org.nuiton</groupId>
- <artifactId>helper-maven-plugin</artifactId>
+ <artifactId>helper-maven-plugin-api</artifactId>
<classifier>tests</classifier>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-10-30 07:43:45 UTC (rev 2515)
+++ trunk/pom.xml 2012-11-11 19:54:31 UTC (rev 2516)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>3.4.3</version>
+ <version>3.4.4-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -199,80 +199,27 @@
<dependency>
<groupId>org.nuiton</groupId>
- <artifactId>helper-maven-plugin</artifactId>
+ <artifactId>helper-maven-plugin-api</artifactId>
<version>${helperPluginVersion}</version>
<scope>compile</scope>
<exclusions>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- </exclusion>
<exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact-manager</artifactId>
- </exclusion>
-
- <exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
</exclusion>
<exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-profile</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-settings</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-simple</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-api</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-javamail</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.sonatype.plexus</groupId>
- <artifactId>plexus-cipher</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.sonatype.plexus</groupId>
- <artifactId>plexus-sec-dispatcher</artifactId>
- </exclusion>
-
</exclusions>
</dependency>
<dependency>
<groupId>org.nuiton</groupId>
- <artifactId>helper-maven-plugin</artifactId>
+ <artifactId>helper-maven-plugin-api</artifactId>
<version>${helperPluginVersion}</version>
<scope>test</scope>
<classifier>tests</classifier>
@@ -284,40 +231,10 @@
</exclusion>
<exclusion>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
</exclusion>
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-simple</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-api</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>plexus</groupId>
- <artifactId>plexus-mail-sender-javamail</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.sonatype.plexus</groupId>
- <artifactId>plexus-cipher</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.sonatype.plexus</groupId>
- <artifactId>plexus-sec-dispatcher</artifactId>
- </exclusion>
-
</exclusions>
</dependency>
1
0