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
March 2011
- 1 participants
- 8 discussions
r2245 - trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers
by tchemit@users.nuiton.org 18 Mar '11
by tchemit@users.nuiton.org 18 Mar '11
18 Mar '11
Author: tchemit
Date: 2011-03-18 12:45:43 +0100 (Fri, 18 Mar 2011)
New Revision: 2245
Url: http://nuiton.org/repositories/revision/jaxx/2245
Log:
Evolution #1405: Improve import manager usage
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2011-03-18 11:20:11 UTC (rev 2244)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2011-03-18 11:45:43 UTC (rev 2245)
@@ -388,7 +388,7 @@
PUBLIC,
JAXXBinding.class.getName() + "[]",
"getDataBindings",
- "return " + FIELD_NAME_$BINDINGS + ".values().toArray(new " + JAXXBinding.class.getSimpleName() + "[" + FIELD_NAME_$BINDINGS + ".size()]);",
+ "return " + FIELD_NAME_$BINDINGS + ".values().toArray(new %s[" + FIELD_NAME_$BINDINGS + ".size()]);",
true
);
@@ -668,8 +668,8 @@
addSimpleField(javaFile, ACTIVE_BINDINGS_FIELD);
addSimpleField(javaFile, BINDINGS_FIELD);
javaFile.addMethod(GET_OBJECT_BY_ID_METHOD);
- javaFile.addMethod(REGISTER_DATA_BINDING_METHOD);
- javaFile.addMethod(GET_DATA_BINDING_METHOD);
+ addMethod(javaFile, REGISTER_DATA_BINDING_METHOD);
+ addMethod(javaFile, GET_DATA_BINDING_METHOD, JAXXBinding.class.getSimpleName());
javaFile.addMethod(createApplyDataBindingMethod());
javaFile.addMethod(createProcessDataBindingMethod());
@@ -712,14 +712,16 @@
protected void addLoggerSupport(JAXXCompiler compiler, JavaFile javaFile, String className) {
if (compiler.getConfiguration().isAddLogger()) {
- javaFile.addImport(LogFactory.class);
+// javaFile.addImport(LogFactory.class);
javaFile.addSimpleField(newField(
PRIVATE | STATIC | FINAL,
Log.class.getName(),
"log",
false,
- "LogFactory.getLog(" + className + ".class)")
+ "%s.getLog(" + className + ".class)",
+ LogFactory.class.getName()
+ )
);
}
}
@@ -865,17 +867,18 @@
} else {
addField(javaFile, PROPERTY_CHANGE_SUPPORT_FIELD);
- javaFile.addMethod(GET_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
- javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
- javaFile.addMethod(FIRE_PROPERTY_CHANGE_NAMED_METHOD);
+ addMethod(javaFile, GET_PROPERTY_CHANGE_SUPPORT_METHOD,
+ PropertyChangeSupport.class.getName());
+ addMethod(javaFile, ADD_PROPERTY_CHANGE_SUPPORT_METHOD);
+ addMethod(javaFile, ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
+ addMethod(javaFile, REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD);
+ addMethod(javaFile, REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
+ addMethod(javaFile, FIRE_PROPERTY_CHANGE_NAMED_METHOD);
}
}
protected JavaMethod addRegisteredDefaultBindingsMethod(JAXXCompiler compiler,
- JavaFile javaFile) {
+ JavaFile javaFile) {
DataBinding[] bindings = compiler.getBindingHelper().getDataBindings();
StringBuilder initCode = new StringBuilder();
@@ -898,10 +901,10 @@
}
}
JavaMethod method = newMethod(PRIVATE,
- TYPE_VOID,
- METHOD_NAME_$REGISTER_DEFAULT_BINDINGS,
- initCode.toString(),
- false
+ TYPE_VOID,
+ METHOD_NAME_$REGISTER_DEFAULT_BINDINGS,
+ initCode.toString(),
+ false
);
javaFile.addMethod(method);
return method;
1
0
r2244 - trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test
by tchemit@users.nuiton.org 18 Mar '11
by tchemit@users.nuiton.org 18 Mar '11
18 Mar '11
Author: tchemit
Date: 2011-03-18 12:20:11 +0100 (Fri, 18 Mar 2011)
New Revision: 2244
Url: http://nuiton.org/repositories/revision/jaxx/2244
Log:
fix svn eol
Modified:
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx
___________________________________________________________________
Added: svn:eol-style
+ native
1
0
Author: tchemit
Date: 2011-03-18 12:19:23 +0100 (Fri, 18 Mar 2011)
New Revision: 2243
Url: http://nuiton.org/repositories/revision/jaxx/2243
Log:
Evolution #1405: Improve import manager usage
Anomalie #1404: Using decorator='boxed' or icon="img.png" miss import jaxx.runtime.SwingUtil
Added:
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/AbstractFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateConstructorsTask.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -516,8 +516,8 @@
protected String getInitializationCode(EventHandler handler, JAXXCompiler compiler) {
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
- String type = compiler.getImportManager().getType(listenerClass.getName());
- String prefix = compiler.getImportManager().getType(JAXXUtil.class);
+ String type = compiler.getImportedType(listenerClass.getName());
+ String prefix = compiler.getImportedType(JAXXUtil.class);
//TC-20091026 use 'this' instead of root object javaCode
//TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -293,7 +293,11 @@
* A flag to know if SwingUtil msut be imported.
*
* @since 2.4
+ * @deprecated since 2.4.1, will be removed in version 3.0, it is not a good
+ * idea to do special treatment for a particular class, to use SwingUtil,
+ * do like for other class : import it!
*/
+ @Deprecated
protected boolean needSwingUtil;
public static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -784,7 +788,7 @@
// types are not the same
String simpleType =
- getImportManager().getType(getCanonicalName(object));
+ getImportedType(getCanonicalName(object));
if (log.isDebugEnabled()) {
log.debug("Simple type for " + object.getId()
+ " : " + getCanonicalName(object) +
@@ -1581,7 +1585,7 @@
public void preFinalizeCompiler() throws Exception {
}
-
+
public void finalizeCompiler() throws Exception {
int dotPos = getOutputClassName().lastIndexOf(".");
@@ -1926,14 +1930,62 @@
this.classLoader = classLoader;
}
+ /**
+ * Try to import the given type into the underlying java file of this compiler.
+ * <p/>
+ * If import can not be done, will then returns the fully qualified name of
+ * the type.
+ *
+ * @param type the type to simplify
+ * @return the simplify type or the fqn if type could not be imported for the underlying java file.
+ * @since 2.4.1
+ */
+ public String getImportedType(Class<?> type) {
+ return getJavaFile().getImportedType(type);
+ }
+
+ /**
+ * Try to import the given type into the underlying java file of this compiler.
+ * <p/>
+ * If import can not be done, will then returns the fully qualified name of
+ * the type.
+ *
+ * @param type the fqn of the type to simplify
+ * @return the simplify type or the fqn if type could not be imported for the underlying java file.
+ * @since 2.4.1
+ */
+ public String getImportedType(String type) {
+ return getJavaFile().getImportedType(type);
+ }
+
+ /**
+ * @return the javafile import manager
+ * @since 2.4
+ * @deprecated since 2.4.1, will be removed in version 3.0 : do not want
+ * to expose eugene export manager in rest of api, this is purpose of
+ * JavaFile only
+ */
+ @Deprecated
public ImportsManager getImportManager() {
return getJavaFile().getImportManager();
}
+ /**
+ * @return
+ * @since 2.4
+ * @deprecated since 2.4.1, will be removed in version 3.0, has no effect do not use it...
+ */
+ @Deprecated
public boolean isNeedSwingUtil() {
return needSwingUtil;
}
+ /**
+ * @param needSwingUtil
+ * @since 2.4
+ * @deprecated since 2.4.1, will be removed in version 3.0, has no effect do not use it...
+ */
+ @Deprecated
public void setNeedSwingUtil(boolean needSwingUtil) {
this.needSwingUtil = needSwingUtil;
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -671,7 +671,7 @@
String methodName = "$pr" + compiler.getUniqueId(propertyChangeListenerCode.equals("this") ? constantId : propertyChangeListenerCode);
boolean methodExists = hasMethod(methodName);
ClassDescriptor eventClass = DefaultObjectHandler.getEventClass(eventInfo.getListenerClass());
- String type = compiler.getImportManager().getType(JAXXCompiler.getCanonicalName(eventClass));
+ String type = compiler.getImportedType(JAXXCompiler.getCanonicalName(eventClass));
if (!methodExists) {
String code = JavaFileGenerator.addDebugLoggerInvocation(compiler, "event");
code += "propertyChange(null);";
@@ -688,8 +688,8 @@
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
//TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
ClassDescriptor listenerClass = eventInfo.getListenerClass();
- String listenerType = compiler.getImportManager().getType(listenerClass.getName());
- String jaxxUtilPrefix = compiler.getImportManager().getType(JAXXUtil.class);
+ String listenerType = compiler.getImportedType(listenerClass.getName());
+ String jaxxUtilPrefix = compiler.getImportedType(JAXXUtil.class);
result.append(code);
result.append('.');
result.append(eventInfo.getAddMethod());
@@ -771,7 +771,7 @@
boolean methodExists = hasMethod(methodName);
if (!methodExists) {
ClassDescriptor eventClass = DefaultObjectHandler.getEventClass(eventInfo.getListenerClass());
- String type = compiler.getImportManager().getType(JAXXCompiler.getCanonicalName(eventClass));
+ String type = compiler.getImportedType(JAXXCompiler.getCanonicalName(eventClass));
String code = JavaFileGenerator.addDebugLoggerInvocation(compiler, "event");
code += "propertyChange(null);";
JavaMethod method = JavaElementFactory.newMethod(
@@ -786,16 +786,16 @@
try {
String modelMemberName = eventInfo.getModelName() != null ? "get" + StringUtils.capitalize(eventInfo.getModelName()) : null;
String modelClassName = modelMemberName != null ? handler.getBeanClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAXXCompiler.getCanonicalName(handler.getBeanClass());
- String modelType = compiler.getImportManager().getType(modelClassName);
+ String modelType = compiler.getImportedType(modelClassName);
String code = objectCode + (eventInfo.getModelName() != null ? "." + modelMemberName + "()" : "");
String eol = JAXXCompiler.getLineSeparator();
- String jaxxUtilPrefix = compiler.getImportManager().getType(JAXXUtil.class);
+ String jaxxUtilPrefix = compiler.getImportedType(JAXXUtil.class);
result.append(modelType).append(" $target = (").append(modelType).append(") $bindingSources.remove(\"").append(code).append("\");").append(eol);
//TC-20091105 test if $target is not null
result.append("if ($target != null) {").append(eol);
//TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
ClassDescriptor listenerClass = eventInfo.getListenerClass();
- String listenerType = compiler.getImportManager().getType(listenerClass.getName());
+ String listenerType = compiler.getImportedType(listenerClass.getName());
result.append(" $target.");
result.append(eventInfo.getRemoveMethod());
result.append("( ").append(jaxxUtilPrefix).append(".getEventListener(");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -47,7 +47,6 @@
import jaxx.runtime.css.Stylesheet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.eugene.java.extension.ImportsManager;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@@ -361,15 +360,14 @@
String pseudoClassesPrefix = null;
String dataBindingPrefix = null;
- ImportsManager importManager = compiler.getImportManager();
if (!properties.isEmpty()) {
- pseudoClassesPrefix = importManager.getType(Pseudoclasses.class);
- dataBindingPrefix = importManager.getType(jaxx.runtime.css.DataBinding.class);
+ pseudoClassesPrefix = compiler.getImportedType(Pseudoclasses.class);
+ dataBindingPrefix = compiler.getImportedType(jaxx.runtime.css.DataBinding.class);
}
String outputClassName =
- importManager.getType(compiler.getOutputClassName());
+ compiler.getImportedType(compiler.getOutputClassName());
for (Map.Entry<String, String> e : properties.entrySet()) {
String property = e.getKey();
@@ -384,7 +382,7 @@
String dataBindingCode =
DataBindingHelper.processDataBindings(e.getValue());
String valueCode;
- String simpleType = importManager.getType(JAXXCompiler.getCanonicalName(type));
+ String simpleType = compiler.getImportedType(JAXXCompiler.getCanonicalName(type));
if (dataBindingCode != null) {
String code = object.getId() + "." + property + "." + priority;
@@ -471,7 +469,7 @@
for (Map.Entry<String, String> e : properties.entrySet()) {
String property = e.getKey();
ClassDescriptor type = handler.getPropertyType(object, property, compiler);
- String simpleType = importManager.getType(JAXXCompiler.getCanonicalName(type));
+ String simpleType = compiler.getImportedType(JAXXCompiler.getCanonicalName(type));
if (log.isDebugEnabled()) {
log.debug("will test if databinding : [" + e.getValue() + "] type=" + type);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -61,12 +61,7 @@
for (ChildRef child : parent.getChilds()) {
if (child.getChild() == object) {
String javaCode = child.getChildJavaCode();
- String type =
- compiler.getImportManager().getType(SwingUtil.class);
- if (log.isInfoEnabled()) {
- log.info("SwingUtil type " + type);
- }
- compiler.setNeedSwingUtil(true);
+ String type = compiler.getImportedType(SwingUtil.class);
child.setChildJavaCode(
type +
".boxComponentWithJxLayer(" + javaCode + ")");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -201,7 +201,7 @@
// on special init, use constructor
String canonicalName = JAXXCompiler.getCanonicalName(object);
- String impl = compiler.getImportManager().getType(canonicalName);
+ String impl = compiler.getImportedType(canonicalName);
init.append("new ").append(impl).append("(");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -162,7 +162,7 @@
// }
if (buffer.length() > 0) {
- String type = compiler.getImportManager().getType(helpBrokerFQN);
+ String type = compiler.getImportedType(helpBrokerFQN);
StringBuilder extraCode = new StringBuilder(type);
extraCode.append(" _broker = getBroker();");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/AbstractFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/AbstractFinalizer.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/AbstractFinalizer.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -73,11 +73,17 @@
*
* @param file the file where to add the cloned method
* @param method the method to clone
+ * @param types optional types to use to simplify the body of the method
* @since 2.4
*/
- protected void addMethod(JavaFile file, JavaMethod method) {
+ protected void addMethod(JavaFile file, JavaMethod method, String... types) {
JavaMethod clonedMethod = JavaElementFactory.cloneMethod(method);
+ if (types.length > 0) {
+ String body = clonedMethod.getBody();
+ String simplifiedBody = file.simplifyCode(body, types);
+ clonedMethod.setBody(simplifiedBody);
+ }
file.addMethod(clonedMethod);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -50,6 +50,7 @@
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXObjectDescriptor;
import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -316,7 +317,7 @@
PUBLIC,
"<O extends Container> O",
"getParentContainer",
- "return SwingUtil.getParentContainer(source, clazz);",
+ "return %s.getParentContainer(source, clazz);",
true,
newArgument(TYPE_OBJECT, "source"),
newArgument("Class<O>", "clazz")
@@ -329,7 +330,7 @@
PUBLIC,
"<O extends Container> O",
"getParentContainer",
- "return SwingUtil.getParentContainer(this, clazz);",
+ "return %s.getParentContainer(this, clazz);",
true,
newArgument("Class<O>", "clazz")
);
@@ -351,7 +352,8 @@
PUBLIC | STATIC,
JAXXObjectDescriptor.class.getName(),
METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");",
+ "return %s.decodeCompressedJAXXObjectDescriptor(" +
+ FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");",
false
);
@@ -541,7 +543,10 @@
addSimpleField(javaFile, ALL_COMPONENTS_CREATED_FIELD);
addJAXXObjectDescriptorField(compiler, javaFile);
- addMethod(javaFile, GET_JAXX_OBJECT_DESCRIPTOR_METHOD);
+ addMethod(javaFile,
+ GET_JAXX_OBJECT_DESCRIPTOR_METHOD,
+ JAXXUtil.class.getName()
+ );
addPreviousValuesField(compiler, javaFile, root);
@@ -673,7 +678,7 @@
// JAXXContext
String type =
- javaFile.getImportManager().getType(jaxxContextImplementorClass);
+ javaFile.getImportedType(jaxxContextImplementorClass);
javaFile.addField(newField(
PROTECTED | FINAL,
@@ -691,8 +696,10 @@
javaFile.addMethod(GET_CONTEXT_VALUE_NAMED_METHOD);
javaFile.addMethod(REMOVE_CONTEXT_VALUE_METHOD);
javaFile.addMethod(REMOVE_CONTEXT_VALUE_NAMED_METHOD);
- javaFile.addMethod(GET_PARENT_CONTAINER_METHOD);
- javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD);
+ addMethod(javaFile, GET_PARENT_CONTAINER_METHOD, SwingUtil.class.getName());
+ addMethod(javaFile, GET_PARENT_CONTAINER_MORE_METHOD, SwingUtil.class.getName());
+// javaFile.addMethod(GET_PARENT_CONTAINER_METHOD);
+// javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD);
// PropertyChangeSupport
addPropertyChangeSupport(root, javaFile);
@@ -1021,7 +1028,7 @@
// }
// }
if (!superclassIsJAXXObject) {
- String prefix = compiler.getImportManager().getType(JAXXUtil.class);
+ String prefix = compiler.getImportedType(JAXXUtil.class);
code.append(prefix);
code.append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -102,10 +102,12 @@
);
if (found) {
- compiler.setNeedSwingUtil(true);
+// compiler.setNeedSwingUtil(true);
+ String type =
+ compiler.getImportedType(SwingUtil.class);
// box the child component in a JxLayer
child.setChildJavaCode(
- SwingUtil.class.getSimpleName() +
+ type +
".boxComponentWithJxLayer(" + javaCode + ")");
}
}
@@ -117,9 +119,9 @@
BeanValidatorHandler.getValidators(compiler);
// javaFile.addImport(Validator.class);
// javaFile.addImport(ValidatorField.class);
- javaFile.addImport(SwingValidatorUtil.class);
+// javaFile.addImport(SwingValidatorUtil.class);
String validatorUtilPrefix =
- compiler.getImportManager().getType(SwingValidatorUtil.class) +
+ compiler.getImportedType(SwingValidatorUtil.class) +
".";
compiler.getJavaFile().addMethod(JavaElementFactory.newMethod(
@@ -173,7 +175,7 @@
// implements JAXXValidator
addField(javaFile, VALIDATOR_IDS_FIELD);
- String type = compiler.getImportManager().getType(validatorClass);
+ String type = compiler.getImportedType(validatorClass);
String initializer = "return (" + type +
"<?>) (validatorIds.contains(validatorId) ? " +
@@ -198,8 +200,8 @@
String validatorId = TypeManager.getJavaCode(validator.getId());
- String type = compiler.getImportManager().getType(Validator.class);
- String fieldType = compiler.getImportManager().getType(ValidatorField.class);
+ String type = compiler.getImportedType(Validator.class);
+ String fieldType = compiler.getImportedType(ValidatorField.class);
String validatorAnnotation = type +
"( validatorId = " + validatorId + ")";
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -154,9 +154,9 @@
// for (FieldDescriptor field : fields) {
// if (field.getName().equals(lhs)) {
// //lhs.substring(lhs.lastIndexOf(".") + 1);
-// String prefix = compiler.getImportManager().getType(JAXXUtil.class);
+// String prefix = compiler.getImportedType(JAXXUtil.class);
// node.firstToken.image = prefix + ".assignment(" + node.firstToken.image;
-// String outputClassName = compiler.getImportManager().getType(compiler.getOutputClassName());
+// String outputClassName = compiler.getImportedType(compiler.getOutputClassName());
// node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
// }
// }
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -223,13 +223,15 @@
return id + ".setLocation(" + id + ".getX(), " + valueCode + ");";
}
if (WIDTH_ATTRIBUTE.equals(name)) {
- compiler.setNeedSwingUtil(true);
+ String type = compiler.getImportedType(SwingUtil.class);
+// compiler.setNeedSwingUtil(true);
// need to optimize case when both width and height are being assigned
- return SwingUtil.class.getSimpleName() + ".setComponentWidth(" + id + "," + valueCode + ");";
+ return type + ".setComponentWidth(" + id + "," + valueCode + ");";
}
if (HEIGHT_ATTRIBUTE.equals(name)) {
- compiler.setNeedSwingUtil(true);
- return SwingUtil.class.getSimpleName() + ".setComponentHeight(" + id + "," + valueCode + ");";
+// compiler.setNeedSwingUtil(true);
+ String type = compiler.getImportedType(SwingUtil.class);
+ return type + ".setComponentHeight(" + id + "," + valueCode + ");";
}
if (FONT_FACE_ATTRIBUTE.equals(name)) {
return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}";
@@ -239,36 +241,36 @@
}
if (FONT_WEIGHT_ATTRIBUTE.equals(name)) {
if (valueCode.equals("\"bold\"")) {
- compiler.addImport(Font.class);
- return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}";
+ String type = compiler.getImportedType(Font.class);
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | "+type+".BOLD));\n}";
}
if (valueCode.equals("\"normal\"")) {
- compiler.addImport(Font.class);
- return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n}";
+ String type = compiler.getImportedType(Font.class);
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~"+type+".BOLD));\n}";
}
if (!valueCode.startsWith("\"")) {
- compiler.addImport(Font.class);
+ String type = compiler.getImportedType(Font.class);
return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n } else {\n " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n }\n}";
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | "+type+".BOLD));\n } else {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~"+type+".BOLD));\n }\n}";
}
compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode);
return "";
}
if (FONT_STYLE_ATTRIBUTE.equals(name)) {
if (valueCode.equals("\"italic\"")) {
- compiler.addImport(Font.class);
- return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}";
+ String type = compiler.getImportedType(Font.class);
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | "+type+".ITALIC));\n}";
}
if (valueCode.equals("\"normal\"")) {
- compiler.addImport(Font.class);
- return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n}";
+ String type = compiler.getImportedType(Font.class);
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~"+type+".ITALIC));\n}";
}
if (!valueCode.startsWith("\"")) {
- compiler.addImport(Font.class);
+ String type = compiler.getImportedType(Font.class);
return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n } else {\n " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n }\n}";
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | "+type+".ITALIC));\n } else {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~"+type+".ITALIC));\n }\n}";
}
compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode);
return "";
@@ -315,11 +317,14 @@
if (ICON_ATTRIBUTE.equals(propertyName)) {
if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) {
// this is a customized icon, add the icon creation code
+// compiler.setNeedSwingUtil(true);
+ String type =
+ compiler.getImportedType(SwingUtil.class);
+
if (compiler.getConfiguration().isUseUIManagerForIcon()) {
- compiler.setNeedSwingUtil(true);
- stringValue = "{" + SwingUtil.class.getSimpleName() + ".getUIManagerIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + type + ".getUIManagerIcon(\"" + stringValue + "\")}";
} else {
- stringValue = "{" + SwingUtil.class.getSimpleName() + ".createImageIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + type + ".createImageIcon(\"" + stringValue + "\")}";
}
}
} else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) {
@@ -330,11 +335,12 @@
return;
}
propertyName = ICON_ATTRIBUTE;
+// compiler.setNeedSwingUtil(true);
+ String type = compiler.getImportedType(SwingUtil.class);
if (compiler.getConfiguration().isUseUIManagerForIcon()) {
- compiler.setNeedSwingUtil(true);
- stringValue = "{" + SwingUtil.class.getSimpleName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + type + ".getUIManagerActionIcon(\"" + stringValue + "\")}";
} else {
- stringValue = "{" + SwingUtil.class.getSimpleName() + ".createActionIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + type + ".createActionIcon(\"" + stringValue + "\")}";
}
}
super.setAttribute(object, propertyName, stringValue, inline, compiler);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -93,12 +93,12 @@
compiler.registerCompiledObject(buttonGroup);
}
}
- String type = compiler.getImportManager().getType(
+ String type = compiler.getImportedType(
ButtonGroup.class.getName());
return "{ " + type + " $buttonGroup = " + valueCode + "; " + id + ".putClientProperty(\"$buttonGroup\", $buttonGroup); $buttonGroup.add(" + id + "); }\n";
} else if (name.equals(VALUE_PROPERTY)) {
- String type = compiler.getImportManager().getType(
+ String type = compiler.getImportedType(
JAXXButtonGroup.class.getName());
return "{ " + id + ".putClientProperty(\"" + JAXXButtonGroup.VALUE_CLIENT_PROPERTY + "\", " + valueCode + "); Object $buttonGroup = " + id + ".getClientProperty(\"" + JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY + "\");" +
" if ($buttonGroup instanceof " + type + ") { ((" + type + ") $buttonGroup).updateSelectedValue(); } }\n";
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -114,7 +114,7 @@
if (spinner.value == null) {
spinner.value = spinner.minimum;
}
- String type = compiler.getImportManager().getType(SpinnerNumberModel.class);
+ String type = compiler.getImportedType(SpinnerNumberModel.class);
spinner.setConstructorParams("new " + type + "(" + spinner.value + ", " + spinner.minimum + ", " + spinner.maximum + ", 1)");
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -83,7 +83,7 @@
}
int tabIndex = ++tabCount - 1;
- String type = compiler.getImportManager().getType(TabInfoPropertyChangeListener.class);
+ String type = compiler.getImportedType(TabInfoPropertyChangeListener.class);
appendAdditionCode(tabInfo.getId() + ".addPropertyChangeListener(new " + type + "(" + getId() + ", " + tabIndex + "));");
String title = tabInfo.getTitle();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -89,7 +89,7 @@
String valueCode,
JAXXCompiler compiler) throws CompilerException {
if (name.equals(ATTRIBUTE_TEXT)) {
- String prefix = compiler.getImportManager().getType(SwingUtil.class);
+ String prefix = compiler.getImportedType(SwingUtil.class);
return prefix + ".setText(" +
id + ", " + valueCode + ");" +
JAXXCompiler.getLineSeparator();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -466,7 +466,7 @@
);
withError = true;
} else {
- String prefix = compiler.getImportManager().getType(uiClazz.getName());
+ String prefix = compiler.getImportedType(uiClazz.getName());
String code = handler.getSetPropertyCode(
getJavaCode(),
UI_CLASS_ATTRIBUTE,
@@ -625,7 +625,7 @@
}
}
- String prefix = compiler.getImportManager().getType(SwingValidatorUtil.class);
+ String prefix = compiler.getImportedType(SwingValidatorUtil.class);
String code = prefix +
".registerErrorListMouseListener(" + errorList + ");";
@@ -654,7 +654,7 @@
}
}
- String prefix = compiler.getImportManager().getType(SwingValidatorUtil.class);
+ String prefix = compiler.getImportedType(SwingValidatorUtil.class);
String code = prefix +
".registerErrorTableMouseListener(" + errorTable +
@@ -752,12 +752,12 @@
}
String beanClassName = beanInfo.getJAXXBeanDescriptor().getClassDescriptor().getName();
- String type = compiler.getImportManager().getType(beanClassName);
+ String type = compiler.getImportedType(beanClassName);
// contextName must be in constructor to able to init validator with his correct contextName
String constructorParams = type + ".class, " +
TypeManager.getJavaCode(contextName);
// setConstructorParams(constructorParams);
- String prefix = compiler.getImportManager().getType(SwingValidatorUtil.class);
+ String prefix = compiler.getImportedType(SwingValidatorUtil.class);
setInitializer(
prefix + ".newValidator(" + constructorParams + ")"
);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateConstructorsTask.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateConstructorsTask.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateConstructorsTask.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -494,7 +494,7 @@
if (!superclassIsJAXXObject) {
// call explicitly the init code of the parentContext
- String prefix = compiler.getImportManager().getType(JAXXUtil.class);
+ String prefix = compiler.getImportedType(JAXXUtil.class);
code.append(prefix);
code.append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -31,8 +31,6 @@
import jaxx.compiler.java.JavaConstructor;
import jaxx.compiler.java.JavaFile;
import jaxx.compiler.java.JavaFileGenerator;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.eugene.java.extension.ImportsManager;
@@ -104,10 +102,7 @@
String packageName = javaFile.getPackageName();
// optimize imports
- List<String> imports = optimizeImports(
- javaFile,
- packageName,
- compiler.isNeedSwingUtil());
+ List<String> imports = optimizeImports(javaFile, packageName);
String packageToExclude = packageName + ".*";
@@ -116,7 +111,7 @@
if (!packageToExclude.equals(importFQN) &&
!imports.contains(importFQN)) {
imports.add(importFQN);
- }
+ }
}
// set them to the file to generate
@@ -128,8 +123,7 @@
}
public List<String> optimizeImports(JavaFile f,
- String packageName,
- boolean needSwingUtil) {
+ String packageName) {
ImportsManager importsManager = f.getImportManager();
@@ -171,13 +165,13 @@
// optimize constructors parameters
optimizeConstructorParameters(f, importsManager);
- importsManager.addImport(JAXXUtil.class);
- if (!f.isSuperclassIsJAXXObject() || needSwingUtil) {
-
- // while implementing JAXXObject contract we sure need the
- // SwingUtil class
- importsManager.addImport(SwingUtil.class);
- }
+// importsManager.addImport(JAXXUtil.class);
+// if (!f.isSuperclassIsJAXXObject() || needSwingUtil) {
+//
+// // while implementing JAXXObject contract we sure need the
+// // SwingUtil class
+// importsManager.addImport(SwingUtil.class);
+// }
result = importsManager.getImports(packageName);
result.remove(packageName + ".*");
if (log.isDebugEnabled()) {
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java 2011-03-18 11:18:55 UTC (rev 2242)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java 2011-03-18 11:19:23 UTC (rev 2243)
@@ -39,8 +39,9 @@
GenerateMojo mojo = getMojo();
mojo.execute();
- assertNumberJaxxFiles(2);
+ assertNumberJaxxFiles(3);
checkPattern(mojo, "import jaxx.runtime.SwingUtil;", true);
+ checkPattern(mojo, "import jaxx.runtime.JAXXUtil;", true);
}
}
\ No newline at end of file
Copied: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx (from rev 2241, trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx)
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx 2011-03-18 11:19:23 UTC (rev 2243)
@@ -0,0 +1,27 @@
+<!--
+ #%L
+ JAXX :: Maven plugin
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+ <TestParent>
+ <JLabel id='icon' icon='myicon.png'/>
+ </TestParent>
1
0
18 Mar '11
Author: tchemit
Date: 2011-03-18 12:18:55 +0100 (Fri, 18 Mar 2011)
New Revision: 2242
Url: http://nuiton.org/repositories/revision/jaxx/2242
Log:
Anomalie #1406: NPE when cloning method with arguments
Evolution #1407: Can simplify body code of method while cloning it
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElementFactory.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElementFactory.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElementFactory.java 2011-03-18 09:33:24 UTC (rev 2241)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElementFactory.java 2011-03-18 11:18:55 UTC (rev 2242)
@@ -158,9 +158,11 @@
String[] exceptions = new String[incomingExceptions.length];
System.arraycopy(incomingExceptions, 0, exceptions, 0, exceptions.length);
- JavaArgument[] arguments = new JavaArgument[method.getArguments().length];
- for (int i = 0; i < arguments.length; i++) {
- JavaArgument argument = arguments[i];
+ JavaArgument[] oldArguments = method.getArguments();
+ int nbArguments = oldArguments.length;
+ JavaArgument[] arguments = new JavaArgument[nbArguments];
+ for (int i = 0; i < nbArguments; i++) {
+ JavaArgument argument = oldArguments[i];
arguments[i] = cloneArgument(argument);
}
return newMethod(
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java 2011-03-18 09:33:24 UTC (rev 2241)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java 2011-03-18 11:18:55 UTC (rev 2242)
@@ -143,6 +143,14 @@
return importManager;
}
+ public String getImportedType(Class<?> type) {
+ return getImportManager().getType(type);
+ }
+
+ public String getImportedType(String type) {
+ return getImportManager().getType(type);
+ }
+
public String[] getImports() {
List<String> result = new ArrayList<String>(imports);
Collections.sort(result);
@@ -253,7 +261,8 @@
String type = importManager.getType(anInterface);
anInterface = type;
} catch (Exception e) {
- log.error("Could not determine simple name of interface " + anInterface);
+ log.error("Could not determine simple name of interface " +
+ anInterface);
}
simpleInterfaces.add(anInterface);
}
@@ -270,7 +279,8 @@
String type = importManager.getReturnType(returnType);
method.setReturnType(type);
} catch (Exception e) {
- log.error("Could not determine simple name of return type " + returnType + " for method " + method.getName());
+ log.error("Could not determine simple name of return type " +
+ returnType + " for method " + method.getName());
}
for (JavaArgument argument : method.getArguments()) {
String argumentType = argument.getType();
@@ -278,7 +288,9 @@
String type = importManager.getType(argumentType);
argument.setType(type);
} catch (Exception e) {
- log.error("Could not determine simple name of argument type " + argumentType + " of argument " + argument.getName() + " for method " + method.getName());
+ log.error("Could not determine simple name of argument type " +
+ argumentType + " of argument " + argument.getName() +
+ " for method " + method.getName());
}
}
@@ -289,7 +301,8 @@
String exceptionSimple = importManager.getType(exception);
exceptions[i] = exceptionSimple;
} catch (Exception e) {
- log.error("Could not determine simple name of exception " + exception + " for method " + method.getName());
+ log.error("Could not determine simple name of exception " +
+ exception + " for method " + method.getName());
}
}
@@ -367,8 +380,13 @@
);
addMethod(method);
}
- String content = String.format(SETTER_PATTERN, field.getType(), id, constantId);
- JavaArgument arg = JavaElementFactory.newArgument(field.getType(), id);
+ String content = String.format(SETTER_PATTERN,
+ field.getType(),
+ id,
+ constantId
+ );
+ JavaArgument arg = JavaElementFactory.newArgument(field.getType(),
+ id);
JavaMethod method = JavaElementFactory.newMethod(
Modifier.PUBLIC,
JAXXCompilerFinalizer.TYPE_VOID,
@@ -393,7 +411,8 @@
field.getName() + "] type " + fieldType);
}
if (field.hasInitializerTypes()) {
- String code = simplifyCode(field.getInitializer(), field.getInitializerTypes());
+ String code = simplifyCode(field.getInitializer(),
+ field.getInitializerTypes());
if (log.isDebugEnabled()) {
log.debug("Use simplify text : " + code);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java 2011-03-18 09:33:24 UTC (rev 2241)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java 2011-03-18 11:18:55 UTC (rev 2242)
@@ -122,6 +122,10 @@
return body;
}
+ public void setBody(String body) {
+ this.body = body;
+ }
+
@Override
public int compareTo(JavaMethod o) {
return JavaElementComparator.compare(this, o);
1
0
r2241 - in trunk: jaxx-compiler/src/main/java/jaxx/compiler/decorators jaxx-compiler/src/main/java/jaxx/compiler/tasks maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test
by tchemit@users.nuiton.org 18 Mar '11
by tchemit@users.nuiton.org 18 Mar '11
18 Mar '11
Author: tchemit
Date: 2011-03-18 10:33:24 +0100 (Fri, 18 Mar 2011)
New Revision: 2241
Url: http://nuiton.org/repositories/revision/jaxx/2241
Log:
fix for real Anomalie #1404: Using decorator='boxed' miss import jaxx.runtime.SwingUtil
Added:
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-17 18:17:49 UTC (rev 2240)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-18 09:33:24 UTC (rev 2241)
@@ -63,6 +63,10 @@
String javaCode = child.getChildJavaCode();
String type =
compiler.getImportManager().getType(SwingUtil.class);
+ if (log.isInfoEnabled()) {
+ log.info("SwingUtil type " + type);
+ }
+ compiler.setNeedSwingUtil(true);
child.setChildJavaCode(
type +
".boxComponentWithJxLayer(" + javaCode + ")");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java 2011-03-17 18:17:49 UTC (rev 2240)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tasks/GenerateTask.java 2011-03-18 09:33:24 UTC (rev 2241)
@@ -199,9 +199,8 @@
JavaArgument[] arguments = constructor.getArguments();
for (JavaArgument argument : arguments) {
String type = argument.getType();
- String simpleType = null;
try {
- simpleType = importsManager.getType(type);
+ String simpleType = importsManager.getType(type);
argument.setType(simpleType);
} catch (Exception e) {
log.error("file [" + f.getName() +
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java 2011-03-17 18:17:49 UTC (rev 2240)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java 2011-03-18 09:33:24 UTC (rev 2241)
@@ -39,7 +39,7 @@
GenerateMojo mojo = getMojo();
mojo.execute();
- assertNumberJaxxFiles(1);
+ assertNumberJaxxFiles(2);
checkPattern(mojo, "import jaxx.runtime.SwingUtil;", true);
}
Modified: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx 2011-03-17 18:17:49 UTC (rev 2240)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx 2011-03-18 09:33:24 UTC (rev 2241)
@@ -22,4 +22,6 @@
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->
-<JLabel implements="java.io.Serializable" text='test' decorator='boxed'/>
\ No newline at end of file
+ <TestParent>
+ <JLabel id='label' decorator='boxed'/>
+ </TestParent>
Copied: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx (from rev 2240, trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx)
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx 2011-03-18 09:33:24 UTC (rev 2241)
@@ -0,0 +1,25 @@
+<!--
+ #%L
+ JAXX :: Maven plugin
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+ <JPanel id='content'/>
\ No newline at end of file
1
0
r2240 - in trunk: . jaxx-compiler/src/main/java/jaxx/compiler/decorators maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test
by tchemit@users.nuiton.org 17 Mar '11
by tchemit@users.nuiton.org 17 Mar '11
17 Mar '11
Author: tchemit
Date: 2011-03-17 19:17:49 +0100 (Thu, 17 Mar 2011)
New Revision: 2240
Url: http://nuiton.org/repositories/revision/jaxx/2240
Log:
fixed Anomalie #1404: Using decorator='boxed' miss import jaxx.runtime.SwingUtil
Added:
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
trunk/pom.xml
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-12 14:21:19 UTC (rev 2239)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2011-03-17 18:17:49 UTC (rev 2240)
@@ -61,8 +61,10 @@
for (ChildRef child : parent.getChilds()) {
if (child.getChild() == object) {
String javaCode = child.getChildJavaCode();
+ String type =
+ compiler.getImportManager().getType(SwingUtil.class);
child.setChildJavaCode(
- SwingUtil.class.getSimpleName() +
+ type +
".boxComponentWithJxLayer(" + javaCode + ")");
break;
}
Added: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java 2011-03-17 18:17:49 UTC (rev 2240)
@@ -0,0 +1,46 @@
+/*
+ * #%L
+ * JAXX :: Maven plugin
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.jaxx.plugin;
+
+import org.junit.Test;
+
+/**
+ * Test the bug describe here http://nuiton.org/issues/show/1404
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4.1
+ */
+public class Bug1404Test extends JaxxBaseTest {
+
+ @Test
+ public void Bug_1404() throws Exception {
+
+ GenerateMojo mojo = getMojo();
+ mojo.execute();
+ assertNumberJaxxFiles(1);
+
+ checkPattern(mojo, "import jaxx.runtime.SwingUtil;", true);
+ }
+}
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml 2011-03-17 18:17:49 UTC (rev 2240)
@@ -0,0 +1,53 @@
+<!--
+ #%L
+ JAXX :: Maven plugin
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<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>
+ <groupId>org.nuiton.jaxx.test</groupId>
+ <artifactId>test</artifactId>
+ <version>0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <configuration>
+ <src>${basedir}/target/test-classes</src>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
+ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
+ <i18nable>true</i18nable>
+ <force>true</force>
+ <!--<verbose>true</verbose>-->
+ <resetAfterCompile>false</resetAfterCompile>
+ <includes>
+ <value>**/bug1404Test/*.jaxx</value>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx 2011-03-17 18:17:49 UTC (rev 2240)
@@ -0,0 +1,25 @@
+<!--
+ #%L
+ JAXX :: Maven plugin
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+<JLabel implements="java.io.Serializable" text='test' decorator='boxed'/>
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-12 14:21:19 UTC (rev 2239)
+++ trunk/pom.xml 2011-03-17 18:17:49 UTC (rev 2240)
@@ -448,8 +448,8 @@
</plugin>
<plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>license-maven-plugin</artifactId>
<configuration>
<licenseMerges>
<licenseMerge>The Apache Software License, Version 2.0|Apache License, Version 2.0</licenseMerge>
1
0
Author: tchemit
Date: 2011-03-12 15:21:19 +0100 (Sat, 12 Mar 2011)
New Revision: 2239
Url: http://nuiton.org/repositories/revision/jaxx/2239
Log:
Update mavenpom4redmineAndCentral to 2.5.2.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
+++ trunk/pom.xml 2011-03-12 14:21:19 UTC (rev 2239)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>2.5.1</version>
+ <version>2.5.2</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
r2238 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-runtime/src/main/java/jaxx/runtime/decorator jaxx-tutorial jaxx-tutorial-config jaxx-tutorial-css jaxx-tutorial-databinding jaxx-tutorial-helloworld jaxx-tutorial-helloworld2 jaxx-tutorial-validation jaxx-validator jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 02 Mar '11
by tchemit@users.nuiton.org 02 Mar '11
02 Mar '11
Author: tchemit
Date: 2011-03-02 10:46:21 +0100 (Wed, 02 Mar 2011)
New Revision: 2238
Url: http://nuiton.org/repositories/revision/jaxx/2238
Log:
pass to version 2.4.1-SNAPSHOT
Anomalie #1377: Improve log in JXPathDecorator closes
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
trunk/jaxx-tutorial-config/pom.xml
trunk/jaxx-tutorial-css/pom.xml
trunk/jaxx-tutorial-databinding/pom.xml
trunk/jaxx-tutorial-helloworld/pom.xml
trunk/jaxx-tutorial-helloworld2/pom.xml
trunk/jaxx-tutorial-validation/pom.xml
trunk/jaxx-tutorial/pom.xml
trunk/jaxx-validator/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-compiler/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-demo/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-runtime/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2011-03-02 09:46:21 UTC (rev 2238)
@@ -54,8 +54,8 @@
* assert "expr = %1$s" == d.toString(d);
* </pre>
*
+ * @param <O> type of data to decorate
* @author tchemit <chemit(a)codelutin.com>
- * @param <O> type of data to decorate
* @see Decorator
* @since 1.7.2 (was previously {@code jaxx.runtime.JXPathDecorator})
*/
@@ -98,9 +98,12 @@
try {
args[i] = getTokenValue(jxcontext, context.tokens[i]);
} catch (Exception e) {
- log.error("can not obtain token " + context.tokens[i]
- + "on object " + bean + " for reason " +
- e.getMessage(), e);
+ if (log.isErrorEnabled()) {
+ log.error("can not obtain token " + context.tokens[i]
+ + " on object of type " +
+ bean.getClass().getName() +
+ " for reason " + e.getMessage(), e);
+ }
}
}
@@ -109,7 +112,10 @@
try {
result = String.format(context.expression, args);
} catch (Exception eee) {
- log.error("Could not format " + context.expression + " with args : " + Arrays.toString(args), eee);
+ if (log.isErrorEnabled()) {
+ log.error("Could not format " + context.expression + "" +
+ " with args : " + Arrays.toString(args), eee);
+ }
result = "";
}
return result;
@@ -249,9 +255,9 @@
protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) {
if (pos < -1 || pos > decorator.getNbToken()) {
- throw new ArrayIndexOutOfBoundsException("token index " + pos +
- " is out of bound, can be inside [" +
- 0 + ',' + decorator.nbToken + ']');
+ throw new ArrayIndexOutOfBoundsException(
+ "token index " + pos + " is out of bound, can be inside [" +
+ 0 + ',' + decorator.nbToken + ']');
}
}
}
Modified: trunk/jaxx-tutorial/pom.xml
===================================================================
--- trunk/jaxx-tutorial/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-tutorial-config/pom.xml
===================================================================
--- trunk/jaxx-tutorial-config/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-config/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-tutorial-css/pom.xml
===================================================================
--- trunk/jaxx-tutorial-css/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-css/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-tutorial-databinding/pom.xml
===================================================================
--- trunk/jaxx-tutorial-databinding/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-databinding/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-tutorial-helloworld/pom.xml
===================================================================
--- trunk/jaxx-tutorial-helloworld/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-helloworld/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-tutorial-helloworld2/pom.xml
===================================================================
--- trunk/jaxx-tutorial-helloworld2/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-helloworld2/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-tutorial-validation/pom.xml
===================================================================
--- trunk/jaxx-tutorial-validation/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-tutorial-validation/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-tutorial</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath>../jaxx-tutorial</relativePath>
</parent>
Modified: trunk/jaxx-validator/pom.xml
===================================================================
--- trunk/jaxx-validator/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-validator/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/jaxx-widgets/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/maven-jaxx-plugin/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-02-20 12:13:14 UTC (rev 2237)
+++ trunk/pom.xml 2011-03-02 09:46:21 UTC (rev 2238)
@@ -38,7 +38,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
1
0