Jaxx-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
January 2010
- 2 participants
- 24 discussions
30 Jan '10
Author: tchemit
Date: 2010-01-30 12:46:50 +0100 (Sat, 30 Jan 2010)
New Revision: 1728
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
Log:
- add jaxx.runtime and jaxx.runtime.swing namespace in all generated files
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 09:57:56 UTC (rev 1727)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 11:46:50 UTC (rev 1728)
@@ -647,13 +647,14 @@
"javax.swing.*",
"javax.swing.border.*",
"javax.swing.event.*",
- "jaxx.runtime.swing.JAXXButtonGroup",
- "jaxx.runtime.swing.HBox",
- "jaxx.runtime.swing.VBox",
- "jaxx.runtime.swing.Table",
- "jaxx.runtime.Util",
- "jaxx.runtime.JAXXUtil",
- "jaxx.runtime.SwingUtil",
+// "jaxx.runtime.swing.JAXXButtonGroup",
+// "jaxx.runtime.swing.HBox",
+// "jaxx.runtime.swing.VBox",
+// "jaxx.runtime.swing.Table",
+ "jaxx.runtime.*",
+ "jaxx.runtime.swing.*",
+// "jaxx.runtime.JAXXUtil",
+// "jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
);
1
0
30 Jan '10
Author: tchemit
Date: 2010-01-30 10:57:56 +0100 (Sat, 30 Jan 2010)
New Revision: 1727
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
Log:
For the moment let old Util class in generation to make it compatible
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 17:32:57 UTC (rev 1726)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-30 09:57:56 UTC (rev 1727)
@@ -651,6 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
+ "jaxx.runtime.Util",
"jaxx.runtime.JAXXUtil",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
1
0
r1726 - in trunk: jaxx-compiler/src/main/java/jaxx/compiler jaxx-runtime/src/main/java/jaxx/runtime
by sletellier@users.nuiton.org 29 Jan '10
by sletellier@users.nuiton.org 29 Jan '10
29 Jan '10
Author: sletellier
Date: 2010-01-29 18:32:57 +0100 (Fri, 29 Jan 2010)
New Revision: 1726
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Log:
Evol 292 : Refactoring, Util is deprecated and will be replaced by JAXXUtil
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 16:58:54 UTC (rev 1725)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 17:32:57 UTC (rev 1726)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding JAXXUtil
+ * Binding Util
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 16:58:54 UTC (rev 1725)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 17:32:57 UTC (rev 1726)
@@ -20,6 +20,9 @@
* ##%*
*/
-@Deprecated // since 2.0.4-XXX, will be removed
+/**
+ * @deprecated since 2, will be removed in 2.1
+ */
+@Deprecated
public class Util extends JAXXUtil{
}
1
0
Author: sletellier
Date: 2010-01-29 17:58:54 +0100 (Fri, 29 Jan 2010)
New Revision: 1725
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
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/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
trunk/src/site/rst/BeanValidator.rst
Log:
Evol 292 : Refactoring, Util is deprecated and will be replaced by JAXXUtil
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -460,8 +460,8 @@
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
//TC-20091026 use 'this' instead of root object javaCode
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name
- return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
+ return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding Util
+ * Binding JAXXUtil
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -651,7 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "jaxx.runtime.Util",
+ "jaxx.runtime.JAXXUtil",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -37,7 +37,7 @@
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -620,12 +620,12 @@
}
String code = objectCode + (eventInfo.getModelName() != null ? ".get" + StringUtils.capitalize(eventInfo.getModelName()) + "()" : "");
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(code).append('.').append(eventInfo.getAddMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(code).append('.').append(eventInfo.getAddMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
result.append(JAXXCompiler.getLineSeparator());
if (eventInfo.getModelName() != null) {
result.append(getAddMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
compiler));
}
return result.toString();
@@ -696,12 +696,12 @@
result.append(modelClassName).append(" $target = ((").append(modelClassName).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 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
result.append("}").append(eol);
if (eventInfo.getModelName() != null) {
result.append(getRemoveMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
compiler));
}
return result.toString();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -194,7 +194,7 @@
*
*/
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "JAXXObjectDescriptor", METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return Util.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
+ "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
/**
*
*/
@@ -624,7 +624,7 @@
}
}
if (!superclassIsJAXXObject) {
- code.append(Util.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
+ code.append(JAXXUtil.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
}
code.append(METHOD_NAME_$INITIALIZE + "();");
@@ -708,7 +708,7 @@
if (bindings.length > 0) {
result.append(eol).append("// apply ").append(bindings.length).append(" data bindings").append(eol);
- result.append(Util.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
+ result.append(JAXXUtil.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
}
bindings = compiler.getBindingHelper().getSimpleBindings();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -133,7 +133,7 @@
for (FieldDescriptor field : fields) {
if (field.getName().equals(lhs)) {
//lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
+ node.firstToken.image = "jaxx.runtime.JAXXUtil.assignment(" + node.firstToken.image;
String outputClassName = compiler.getOutputClassName();
node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -337,13 +337,13 @@
// }
// String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
// result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
-// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(code).append('.').append(eventInfo.addMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
// result.append(JAXXCompiler.getLineSeparator());
// if (eventInfo.modelName != null) {
// result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
@@ -407,14 +407,14 @@
// result.append(modelClassName).append(" $target = ((").append(modelClassName).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 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(" $target.").append(eventInfo.removeMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
// result.append("}").append(eol);
// if (eventInfo.modelName != null) {
//// String bi = dataBinding.startsWith("this.") ? dataBinding : ("\"" + dataBinding + "\"");
// result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
Modified: trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 16:58:54 UTC (rev 1725)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -29,7 +29,7 @@
import java.util.Properties;
import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,7 +214,7 @@
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -37,7 +37,7 @@
import jaxx.demo.fun.LabelStyleDemo;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -191,7 +191,7 @@
/**
* la definition de l'unqiue object a partage
*/
- static private final JAXXContextEntryDef<DemoConfig> def = Util.newContextEntryDef(DemoConfig.class);
+ static private final JAXXContextEntryDef<DemoConfig> def = JAXXUtil.newContextEntryDef(DemoConfig.class);
/**
* la pile des noeuds parent
*/
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -21,7 +21,7 @@
package jaxx.demo;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -57,7 +57,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(DemoUIHandler.class);
- static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = Util.newContextEntryDef("mainui", DemoUI.class);
+ static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class);
/**
* Methode pour initialiser l'ui principale sans l'afficher.
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -63,11 +63,11 @@
/**
* where the movies are hold in context
*/
- static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies");
+ static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXUtil.newListContextEntryDef("movies");
/**
* where the actors are hold in context
*/
- static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors");
+ static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXUtil.newListContextEntryDef("actors");
protected FullNavigationTreeModelBuilder builder;
public FullNavigationTreeHelper() {
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -0,0 +1,516 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.*;
+
+public class JAXXUtil {
+
+ // public static final String DEFAULT_ICON_PATH = "/icons/";
+ // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(JAXXUtil.class);
+ public static final String PARENT = "parent";
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+ private static class EventListenerDescriptor {
+
+ Class<?> listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
+
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
+ return newContextEntryDef(null, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
+ return new JAXXContextEntryDef<O>(name, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
+ return newListContextEntryDef(null);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
+ Class<List<O>> castList = JAXXUtil.castList();
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
+ return contextEntryDef;
+ }
+
+// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
+// bindings.put(binding.getId(), binding);
+//// binding.applyDataBinding();
+//// binding.processDataBinding();
+// return binding;
+// }
+
+// /**
+// * Return parent's container corresponding to the Class clazz
+// *
+// * @param <O> type of container to obtain from context
+// * @param top the top container
+// * @param clazz desired
+// * @return parent's container
+// */
+// @SuppressWarnings({"unchecked"})
+// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
+// if (top == null) {
+// throw new IllegalArgumentException("top parameter can not be null");
+// }
+// if (!Container.class.isAssignableFrom(top.getClass())) {
+// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
+// }
+// Container parent = ((Container) top).getParent();
+// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
+// parent = getParentContainer(parent, clazz);
+// }
+// return (O) parent;
+// }
+
+ @SuppressWarnings({"unchecked"})
+ protected static <O> Class<List<O>> castList() {
+ return (Class<List<O>>) Collections.emptyList().getClass();
+ }
+
+ /**
+ * Method to initialize the context of a ui.
+ *
+ * @param ui the ui
+ * @param parentContext the context to set in ui
+ */
+ public static void initContext(JAXXObject ui, JAXXContext parentContext) {
+
+ if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
+ ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
+ } else {
+ ui.setContextValue(parentContext);
+ }
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return (E) descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null) {
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ }
+ Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class<?>[]{listenerClass},
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ targetMethod.setAccessible(true);
+ return targetMethod.invoke(methodContainer, args);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("could not invoke on container " + methodContainer, e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return (E) descriptor.eventListener;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName())) {
+ return listener;
+ }
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+// public static void setComponentWidth(Component component, int width) {
+// component.setSize(width, component.getHeight());
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+// public static void setComponentHeight(Component component, int height) {
+// component.setSize(component.getWidth(), height);
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ /**
+ * Compute the string representation of an object.
+ * <p/>
+ * Return empty string if given object is null
+ *
+ * @param value the value to write
+ * @return the string representation of the given object or an empty string if object is null.
+ */
+ public static String getStringValue(Object value) {
+ String result;
+ result = value == null ? "" : value.toString();
+ return result;
+ }
+
+ /**
+ * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
+ * <p/>
+ * If entry is found, return his value in context.
+ *
+ * @param <T> the type of required data
+ * @param context the context to test
+ * @param def the definition of the entry to seek in context
+ * @return the value from the context
+ * @throws IllegalArgumentException if the entry is not found in context.
+ */
+ public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
+
+ T value = def.getContextValue(context);
+
+ if (value == null) {
+ throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to process more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void processDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.processDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to remove more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void removeDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.removeDataBinding(binding);
+ }
+ }
+
+// public static ImageIcon createIcon(String path) {
+// java.net.URL imgURL = JAXXUtil.class.getResource(path);
+// if (imgURL != null) {
+// return new ImageIcon(imgURL);
+// } else {
+// throw new IllegalArgumentException("could not find icon " + path);
+// }
+// }
+
+// /**
+// * @param path the location of icons in root directory icons
+// * @return the icon at {@link #getIconPath()}+path
+// */
+// public static ImageIcon createImageIcon(String path) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + path);
+// }
+//
+// /**
+// * @param key the key of the icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerIcon(String key) {
+// return UIManager.getIcon(key);
+// }
+//
+// /**
+// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
+// *
+// * @param key the key of the action icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerActionIcon(String key) {
+// return getUIManagerIcon("action." + key);
+// }
+//
+// public static ImageIcon createActionIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "action-" + name + ".png");
+// }
+//
+// public static ImageIcon createI18nIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "i18n/" + name + ".png");
+// }
+
+ /**
+ * detects all PropertychangedListener added by Jaxx uis
+ * (should be a {@link DataBindingListener}
+ *
+ * @param propertyNames the array of property names to find
+ * @param listeners the array of listeners to filter
+ * @return the filtered listeners
+ */
+ public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
+ if (listeners == null || listeners.length == 0) {
+ return new PropertyChangeListener[0];
+ }
+ List<String> pNames = Arrays.asList(propertyNames);
+
+ List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
+
+ for (PropertyChangeListener listener : listeners) {
+ String pName = null;
+ PropertyChangeListenerProxy plistener = null;
+ if (listener instanceof PropertyChangeListenerProxy) {
+ plistener = (PropertyChangeListenerProxy) listener;
+ if (!pNames.contains(plistener.getPropertyName())) {
+ // not on the good property
+ continue;
+ }
+ listener = (PropertyChangeListener) plistener.getListener();
+ pName = plistener.getPropertyName();
+ }
+ if (plistener != null && pName != null && listener instanceof DataBindingListener) {
+ if (log.isDebugEnabled()) {
+ log.debug("find config listener to remove [" + pName + "] : " + listener);
+ }
+ toRemove.add(plistener);
+ //toRemove.add(listener);
+ }
+ }
+ return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
+ }
+
+// private static String getIconPath() {
+// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
+// if (iconPath == null) {
+// iconPath = DEFAULT_ICON_PATH;
+// } else {
+// if (!iconPath.endsWith("/")) {
+// iconPath += "/";
+// }
+// }
+// return iconPath;
+// }
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -79,7 +79,7 @@
* @author tony
* @since 1.2
*/
-public class SwingUtil extends Util {
+public class SwingUtil extends JAXXUtil {
/**
* to use log facility, just put in your code: log.info(\"...\");
@@ -861,7 +861,7 @@
}
public static ImageIcon createIcon(String path) {
- java.net.URL imgURL = Util.class.getResource(path);
+ java.net.URL imgURL = JAXXUtil.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -1,5 +1,6 @@
+package jaxx.runtime;
/*
- * *##%
+ * *##%
* JAXX Runtime
* Copyright (C) 2008 - 2009 CodeLutin
*
@@ -18,499 +19,7 @@
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* ##%*
*/
-package jaxx.runtime;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.*;
-
-public class Util {
-
- // public static final String DEFAULT_ICON_PATH = "/icons/";
- // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(Util.class);
- public static final String PARENT = "parent";
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
- private static class EventListenerDescriptor {
-
- Class<?> listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
-
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
- return newContextEntryDef(null, klass);
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
- return new JAXXContextEntryDef<O>(name, klass);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
- return newListContextEntryDef(null);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
- Class<List<O>> castList = Util.castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
- return contextEntryDef;
- }
-
-// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
-// bindings.put(binding.getId(), binding);
-//// binding.applyDataBinding();
-//// binding.processDataBinding();
-// return binding;
-// }
-
-// /**
-// * Return parent's container corresponding to the Class clazz
-// *
-// * @param <O> type of container to obtain from context
-// * @param top the top container
-// * @param clazz desired
-// * @return parent's container
-// */
-// @SuppressWarnings({"unchecked"})
-// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
-// if (top == null) {
-// throw new IllegalArgumentException("top parameter can not be null");
-// }
-// if (!Container.class.isAssignableFrom(top.getClass())) {
-// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
-// }
-// Container parent = ((Container) top).getParent();
-// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
-// parent = getParentContainer(parent, clazz);
-// }
-// return (O) parent;
-// }
-
- @SuppressWarnings({"unchecked"})
- protected static <O> Class<List<O>> castList() {
- return (Class<List<O>>) Collections.emptyList().getClass();
- }
-
- /**
- * Method to initialize the context of a ui.
- *
- * @param ui the ui
- * @param parentContext the context to set in ui
- */
- public static void initContext(JAXXObject ui, JAXXContext parentContext) {
-
- if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
- ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
- } else {
- ui.setContextValue(parentContext);
- }
- // if parentContext is a JAXXObject then
- // add an special parent entry to can go up
- if (parentContext instanceof JAXXObject) {
- ui.setContextValue(parentContext, PARENT);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return (E) descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null) {
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- }
- Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class<?>[]{listenerClass},
- new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- targetMethod.setAccessible(true);
- return targetMethod.invoke(methodContainer, args);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("could not invoke on container " + methodContainer, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return (E) descriptor.eventListener;
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName())) {
- return listener;
- }
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-// public static void setComponentWidth(Component component, int width) {
-// component.setSize(width, component.getHeight());
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
-// public static void setComponentHeight(Component component, int height) {
-// component.setSize(component.getWidth(), height);
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- /**
- * Compute the string representation of an object.
- * <p/>
- * Return empty string if given object is null
- *
- * @param value the value to write
- * @return the string representation of the given object or an empty string if object is null.
- */
- public static String getStringValue(Object value) {
- String result;
- result = value == null ? "" : value.toString();
- return result;
- }
-
- /**
- * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
- * <p/>
- * If entry is found, return his value in context.
- *
- * @param <T> the type of required data
- * @param context the context to test
- * @param def the definition of the entry to seek in context
- * @return the value from the context
- * @throws IllegalArgumentException if the entry is not found in context.
- */
- public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
-
- T value = def.getContextValue(context);
-
- if (value == null) {
- throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
- }
-
- return value;
- }
-
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to process more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void processDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.processDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to remove more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void removeDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.removeDataBinding(binding);
- }
- }
-
-// public static ImageIcon createIcon(String path) {
-// java.net.URL imgURL = Util.class.getResource(path);
-// if (imgURL != null) {
-// return new ImageIcon(imgURL);
-// } else {
-// throw new IllegalArgumentException("could not find icon " + path);
-// }
-// }
-
-// /**
-// * @param path the location of icons in root directory icons
-// * @return the icon at {@link #getIconPath()}+path
-// */
-// public static ImageIcon createImageIcon(String path) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + path);
-// }
-//
-// /**
-// * @param key the key of the icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerIcon(String key) {
-// return UIManager.getIcon(key);
-// }
-//
-// /**
-// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
-// *
-// * @param key the key of the action icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerActionIcon(String key) {
-// return getUIManagerIcon("action." + key);
-// }
-//
-// public static ImageIcon createActionIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "action-" + name + ".png");
-// }
-//
-// public static ImageIcon createI18nIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "i18n/" + name + ".png");
-// }
-
- /**
- * detects all PropertychangedListener added by Jaxx uis
- * (should be a {@link DataBindingListener}
- *
- * @param propertyNames the array of property names to find
- * @param listeners the array of listeners to filter
- * @return the filtered listeners
- */
- public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
- if (listeners == null || listeners.length == 0) {
- return new PropertyChangeListener[0];
- }
- List<String> pNames = Arrays.asList(propertyNames);
-
- List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
-
- for (PropertyChangeListener listener : listeners) {
- String pName = null;
- PropertyChangeListenerProxy plistener = null;
- if (listener instanceof PropertyChangeListenerProxy) {
- plistener = (PropertyChangeListenerProxy) listener;
- if (!pNames.contains(plistener.getPropertyName())) {
- // not on the good property
- continue;
- }
- listener = (PropertyChangeListener) plistener.getListener();
- pName = plistener.getPropertyName();
- }
- if (plistener != null && pName != null && listener instanceof DataBindingListener) {
- if (log.isDebugEnabled()) {
- log.debug("find config listener to remove [" + pName + "] : " + listener);
- }
- toRemove.add(plistener);
- //toRemove.add(listener);
- }
- }
- return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
- }
-
-// private static String getIconPath() {
-// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
-// if (iconPath == null) {
-// iconPath = DEFAULT_ICON_PATH;
-// } else {
-// if (!iconPath.endsWith("/")) {
-// iconPath += "/";
-// }
-// }
-// return iconPath;
-// }
+@Deprecated // since 2.0.4-XXX, will be removed
+public class Util extends JAXXUtil{
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -21,7 +21,7 @@
package jaxx.runtime.context;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -248,7 +248,7 @@
}
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,7 +47,7 @@
/**
* entry of the parent context
*/
- protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class);
+ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = JAXXUtil.newContextEntryDef(JAXXContext.class);
/**
* Logger
*/
@@ -194,7 +194,7 @@
// }
protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) {
- return Util.newContextEntryDef(name, klass);
+ return JAXXUtil.newContextEntryDef(name, klass);
}
@SuppressWarnings({"unchecked"})
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -23,7 +23,7 @@
import javax.swing.JTree;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
/**
@@ -71,13 +71,13 @@
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
- treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
- selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class);
- selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
- selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class);
-// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class);
+ treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
+ treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
+ treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
+ selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
+ selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
+// selectedUIContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-ui", Component.class);
}
public String getPrefix() {
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -33,10 +33,10 @@
@Test
public void testGetEventListener() {
count = 0;
- DocumentListener listener = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener.insertUpdate(null);
Assert.assertEquals(count, 1);
- DocumentListener listener2 = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener2 = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener2.removeUpdate(null);
Assert.assertEquals(count, 2);
//assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -20,7 +20,7 @@
*/
package jaxx.runtime.swing.navigation;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
import org.junit.Assert;
@@ -164,10 +164,10 @@
NavigationTreeNode sonSonNode;
NavigationTreeNode sonSonSonNode;
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null);
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name", String.class), "name", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name2", String.class), "name2", null, null);
- sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef(Model.class), "model", null, null);
builder.build(sonNode, (String) null, "../name", "name", null, null);
builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null);
@@ -286,7 +286,7 @@
NavigationTreeNode sonSonSonNode;
// first son is a list of models
- sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newListContextEntryDef("models"), "models", null, null);
// first son son is a model
sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 16:58:54 UTC (rev 1725)
@@ -23,7 +23,7 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -48,7 +48,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
@@ -58,7 +58,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeCompressedJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeCompressedJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
Modified: trunk/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
+++ trunk/src/site/rst/BeanValidator.rst 2010-01-29 16:58:54 UTC (rev 1725)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
1
0
Author: sletellier
Date: 2010-01-29 16:49:15 +0100 (Fri, 29 Jan 2010)
New Revision: 1724
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Removed:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
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/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
trunk/src/site/rst/BeanValidator.rst
Log:
Revert
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -460,8 +460,8 @@
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
//TC-20091026 use 'this' instead of root object javaCode
- //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
- return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name
+ return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding JAXXUtil
+ * Binding Util
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -651,7 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "jaxx.runtime.JAXXUtil",
+ "jaxx.runtime.Util",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -37,7 +37,7 @@
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -620,12 +620,12 @@
}
String code = objectCode + (eventInfo.getModelName() != null ? ".get" + StringUtils.capitalize(eventInfo.getModelName()) + "()" : "");
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
- result.append(code).append('.').append(eventInfo.getAddMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+ result.append(code).append('.').append(eventInfo.getAddMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
result.append(JAXXCompiler.getLineSeparator());
if (eventInfo.getModelName() != null) {
result.append(getAddMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
+ Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
compiler));
}
return result.toString();
@@ -696,12 +696,12 @@
result.append(modelClassName).append(" $target = ((").append(modelClassName).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
- result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+ //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+ result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
result.append("}").append(eol);
if (eventInfo.getModelName() != null) {
result.append(getRemoveMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
+ Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
compiler));
}
return result.toString();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -194,7 +194,7 @@
*
*/
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "JAXXObjectDescriptor", METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
+ "return Util.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
/**
*
*/
@@ -624,7 +624,7 @@
}
}
if (!superclassIsJAXXObject) {
- code.append(JAXXUtil.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
+ code.append(Util.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
}
code.append(METHOD_NAME_$INITIALIZE + "();");
@@ -708,7 +708,7 @@
if (bindings.length > 0) {
result.append(eol).append("// apply ").append(bindings.length).append(" data bindings").append(eol);
- result.append(JAXXUtil.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
+ result.append(Util.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
}
bindings = compiler.getBindingHelper().getSimpleBindings();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -133,7 +133,7 @@
for (FieldDescriptor field : fields) {
if (field.getName().equals(lhs)) {
//lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.JAXXUtil.assignment(" + node.firstToken.image;
+ node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
String outputClassName = compiler.getOutputClassName();
node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -337,13 +337,13 @@
// }
// String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
// 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
-// result.append(code).append('.').append(eventInfo.addMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+// result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
// result.append(JAXXCompiler.getLineSeparator());
// if (eventInfo.modelName != null) {
// result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
-//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
+//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
@@ -407,14 +407,14 @@
// result.append(modelClassName).append(" $target = ((").append(modelClassName).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
-// result.append(" $target.").append(eventInfo.removeMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
+// result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
// result.append("}").append(eol);
// if (eventInfo.modelName != null) {
//// String bi = dataBinding.startsWith("this.") ? dataBinding : ("\"" + dataBinding + "\"");
// result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
-//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
+//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
Modified: trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -29,7 +29,7 @@
import java.util.Properties;
import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,7 +214,7 @@
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -37,7 +37,7 @@
import jaxx.demo.fun.LabelStyleDemo;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -191,7 +191,7 @@
/**
* la definition de l'unqiue object a partage
*/
- static private final JAXXContextEntryDef<DemoConfig> def = JAXXUtil.newContextEntryDef(DemoConfig.class);
+ static private final JAXXContextEntryDef<DemoConfig> def = Util.newContextEntryDef(DemoConfig.class);
/**
* la pile des noeuds parent
*/
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -21,7 +21,7 @@
package jaxx.demo;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -57,7 +57,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(DemoUIHandler.class);
- static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class);
+ static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = Util.newContextEntryDef("mainui", DemoUI.class);
/**
* Methode pour initialiser l'ui principale sans l'afficher.
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -63,11 +63,11 @@
/**
* where the movies are hold in context
*/
- static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXUtil.newListContextEntryDef("movies");
+ static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies");
/**
* where the actors are hold in context
*/
- static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXUtil.newListContextEntryDef("actors");
+ static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors");
protected FullNavigationTreeModelBuilder builder;
public FullNavigationTreeHelper() {
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -1,516 +0,0 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 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>.
- * ##%*
- */
-package jaxx.runtime;
-
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.*;
-
-public class JAXXUtil {
-
- // public static final String DEFAULT_ICON_PATH = "/icons/";
- // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(JAXXUtil.class);
- public static final String PARENT = "parent";
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
- private static class EventListenerDescriptor {
-
- Class<?> listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
-
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
- return newContextEntryDef(null, klass);
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
- return new JAXXContextEntryDef<O>(name, klass);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
- return newListContextEntryDef(null);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
- Class<List<O>> castList = JAXXUtil.castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
- return contextEntryDef;
- }
-
-// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
-// bindings.put(binding.getId(), binding);
-//// binding.applyDataBinding();
-//// binding.processDataBinding();
-// return binding;
-// }
-
-// /**
-// * Return parent's container corresponding to the Class clazz
-// *
-// * @param <O> type of container to obtain from context
-// * @param top the top container
-// * @param clazz desired
-// * @return parent's container
-// */
-// @SuppressWarnings({"unchecked"})
-// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
-// if (top == null) {
-// throw new IllegalArgumentException("top parameter can not be null");
-// }
-// if (!Container.class.isAssignableFrom(top.getClass())) {
-// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
-// }
-// Container parent = ((Container) top).getParent();
-// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
-// parent = getParentContainer(parent, clazz);
-// }
-// return (O) parent;
-// }
-
- @SuppressWarnings({"unchecked"})
- protected static <O> Class<List<O>> castList() {
- return (Class<List<O>>) Collections.emptyList().getClass();
- }
-
- /**
- * Method to initialize the context of a ui.
- *
- * @param ui the ui
- * @param parentContext the context to set in ui
- */
- public static void initContext(JAXXObject ui, JAXXContext parentContext) {
-
- if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
- ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
- } else {
- ui.setContextValue(parentContext);
- }
- // if parentContext is a JAXXObject then
- // add an special parent entry to can go up
- if (parentContext instanceof JAXXObject) {
- ui.setContextValue(parentContext, PARENT);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return (E) descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null) {
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- }
- Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class<?>[]{listenerClass},
- new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- targetMethod.setAccessible(true);
- return targetMethod.invoke(methodContainer, args);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("could not invoke on container " + methodContainer, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return (E) descriptor.eventListener;
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName())) {
- return listener;
- }
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-// public static void setComponentWidth(Component component, int width) {
-// component.setSize(width, component.getHeight());
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
-// public static void setComponentHeight(Component component, int height) {
-// component.setSize(component.getWidth(), height);
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- /**
- * Compute the string representation of an object.
- * <p/>
- * Return empty string if given object is null
- *
- * @param value the value to write
- * @return the string representation of the given object or an empty string if object is null.
- */
- public static String getStringValue(Object value) {
- String result;
- result = value == null ? "" : value.toString();
- return result;
- }
-
- /**
- * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
- * <p/>
- * If entry is found, return his value in context.
- *
- * @param <T> the type of required data
- * @param context the context to test
- * @param def the definition of the entry to seek in context
- * @return the value from the context
- * @throws IllegalArgumentException if the entry is not found in context.
- */
- public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
-
- T value = def.getContextValue(context);
-
- if (value == null) {
- throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
- }
-
- return value;
- }
-
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to process more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void processDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.processDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to remove more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void removeDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.removeDataBinding(binding);
- }
- }
-
-// public static ImageIcon createIcon(String path) {
-// java.net.URL imgURL = JAXXUtil.class.getResource(path);
-// if (imgURL != null) {
-// return new ImageIcon(imgURL);
-// } else {
-// throw new IllegalArgumentException("could not find icon " + path);
-// }
-// }
-
-// /**
-// * @param path the location of icons in root directory icons
-// * @return the icon at {@link #getIconPath()}+path
-// */
-// public static ImageIcon createImageIcon(String path) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + path);
-// }
-//
-// /**
-// * @param key the key of the icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerIcon(String key) {
-// return UIManager.getIcon(key);
-// }
-//
-// /**
-// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
-// *
-// * @param key the key of the action icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerActionIcon(String key) {
-// return getUIManagerIcon("action." + key);
-// }
-//
-// public static ImageIcon createActionIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "action-" + name + ".png");
-// }
-//
-// public static ImageIcon createI18nIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "i18n/" + name + ".png");
-// }
-
- /**
- * detects all PropertychangedListener added by Jaxx uis
- * (should be a {@link DataBindingListener}
- *
- * @param propertyNames the array of property names to find
- * @param listeners the array of listeners to filter
- * @return the filtered listeners
- */
- public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
- if (listeners == null || listeners.length == 0) {
- return new PropertyChangeListener[0];
- }
- List<String> pNames = Arrays.asList(propertyNames);
-
- List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
-
- for (PropertyChangeListener listener : listeners) {
- String pName = null;
- PropertyChangeListenerProxy plistener = null;
- if (listener instanceof PropertyChangeListenerProxy) {
- plistener = (PropertyChangeListenerProxy) listener;
- if (!pNames.contains(plistener.getPropertyName())) {
- // not on the good property
- continue;
- }
- listener = (PropertyChangeListener) plistener.getListener();
- pName = plistener.getPropertyName();
- }
- if (plistener != null && pName != null && listener instanceof DataBindingListener) {
- if (log.isDebugEnabled()) {
- log.debug("find config listener to remove [" + pName + "] : " + listener);
- }
- toRemove.add(plistener);
- //toRemove.add(listener);
- }
- }
- return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
- }
-
-// private static String getIconPath() {
-// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
-// if (iconPath == null) {
-// iconPath = DEFAULT_ICON_PATH;
-// } else {
-// if (!iconPath.endsWith("/")) {
-// iconPath += "/";
-// }
-// }
-// return iconPath;
-// }
-}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -79,7 +79,7 @@
* @author tony
* @since 1.2
*/
-public class SwingUtil extends JAXXUtil {
+public class SwingUtil extends Util {
/**
* to use log facility, just put in your code: log.info(\"...\");
@@ -861,7 +861,7 @@
}
public static ImageIcon createIcon(String path) {
- java.net.URL imgURL = JAXXUtil.class.getResource(path);
+ java.net.URL imgURL = Util.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -0,0 +1,516 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.*;
+
+public class Util {
+
+ // public static final String DEFAULT_ICON_PATH = "/icons/";
+ // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(Util.class);
+ public static final String PARENT = "parent";
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+ private static class EventListenerDescriptor {
+
+ Class<?> listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
+
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
+ return newContextEntryDef(null, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
+ return new JAXXContextEntryDef<O>(name, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
+ return newListContextEntryDef(null);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
+ Class<List<O>> castList = Util.castList();
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
+ return contextEntryDef;
+ }
+
+// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
+// bindings.put(binding.getId(), binding);
+//// binding.applyDataBinding();
+//// binding.processDataBinding();
+// return binding;
+// }
+
+// /**
+// * Return parent's container corresponding to the Class clazz
+// *
+// * @param <O> type of container to obtain from context
+// * @param top the top container
+// * @param clazz desired
+// * @return parent's container
+// */
+// @SuppressWarnings({"unchecked"})
+// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
+// if (top == null) {
+// throw new IllegalArgumentException("top parameter can not be null");
+// }
+// if (!Container.class.isAssignableFrom(top.getClass())) {
+// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
+// }
+// Container parent = ((Container) top).getParent();
+// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
+// parent = getParentContainer(parent, clazz);
+// }
+// return (O) parent;
+// }
+
+ @SuppressWarnings({"unchecked"})
+ protected static <O> Class<List<O>> castList() {
+ return (Class<List<O>>) Collections.emptyList().getClass();
+ }
+
+ /**
+ * Method to initialize the context of a ui.
+ *
+ * @param ui the ui
+ * @param parentContext the context to set in ui
+ */
+ public static void initContext(JAXXObject ui, JAXXContext parentContext) {
+
+ if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
+ ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
+ } else {
+ ui.setContextValue(parentContext);
+ }
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return (E) descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null) {
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ }
+ Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class<?>[]{listenerClass},
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ targetMethod.setAccessible(true);
+ return targetMethod.invoke(methodContainer, args);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("could not invoke on container " + methodContainer, e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return (E) descriptor.eventListener;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName())) {
+ return listener;
+ }
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+// public static void setComponentWidth(Component component, int width) {
+// component.setSize(width, component.getHeight());
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+// public static void setComponentHeight(Component component, int height) {
+// component.setSize(component.getWidth(), height);
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ /**
+ * Compute the string representation of an object.
+ * <p/>
+ * Return empty string if given object is null
+ *
+ * @param value the value to write
+ * @return the string representation of the given object or an empty string if object is null.
+ */
+ public static String getStringValue(Object value) {
+ String result;
+ result = value == null ? "" : value.toString();
+ return result;
+ }
+
+ /**
+ * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
+ * <p/>
+ * If entry is found, return his value in context.
+ *
+ * @param <T> the type of required data
+ * @param context the context to test
+ * @param def the definition of the entry to seek in context
+ * @return the value from the context
+ * @throws IllegalArgumentException if the entry is not found in context.
+ */
+ public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
+
+ T value = def.getContextValue(context);
+
+ if (value == null) {
+ throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to process more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void processDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.processDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to remove more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void removeDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.removeDataBinding(binding);
+ }
+ }
+
+// public static ImageIcon createIcon(String path) {
+// java.net.URL imgURL = Util.class.getResource(path);
+// if (imgURL != null) {
+// return new ImageIcon(imgURL);
+// } else {
+// throw new IllegalArgumentException("could not find icon " + path);
+// }
+// }
+
+// /**
+// * @param path the location of icons in root directory icons
+// * @return the icon at {@link #getIconPath()}+path
+// */
+// public static ImageIcon createImageIcon(String path) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + path);
+// }
+//
+// /**
+// * @param key the key of the icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerIcon(String key) {
+// return UIManager.getIcon(key);
+// }
+//
+// /**
+// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
+// *
+// * @param key the key of the action icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerActionIcon(String key) {
+// return getUIManagerIcon("action." + key);
+// }
+//
+// public static ImageIcon createActionIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "action-" + name + ".png");
+// }
+//
+// public static ImageIcon createI18nIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "i18n/" + name + ".png");
+// }
+
+ /**
+ * detects all PropertychangedListener added by Jaxx uis
+ * (should be a {@link DataBindingListener}
+ *
+ * @param propertyNames the array of property names to find
+ * @param listeners the array of listeners to filter
+ * @return the filtered listeners
+ */
+ public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
+ if (listeners == null || listeners.length == 0) {
+ return new PropertyChangeListener[0];
+ }
+ List<String> pNames = Arrays.asList(propertyNames);
+
+ List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
+
+ for (PropertyChangeListener listener : listeners) {
+ String pName = null;
+ PropertyChangeListenerProxy plistener = null;
+ if (listener instanceof PropertyChangeListenerProxy) {
+ plistener = (PropertyChangeListenerProxy) listener;
+ if (!pNames.contains(plistener.getPropertyName())) {
+ // not on the good property
+ continue;
+ }
+ listener = (PropertyChangeListener) plistener.getListener();
+ pName = plistener.getPropertyName();
+ }
+ if (plistener != null && pName != null && listener instanceof DataBindingListener) {
+ if (log.isDebugEnabled()) {
+ log.debug("find config listener to remove [" + pName + "] : " + listener);
+ }
+ toRemove.add(plistener);
+ //toRemove.add(listener);
+ }
+ }
+ return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
+ }
+
+// private static String getIconPath() {
+// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
+// if (iconPath == null) {
+// iconPath = DEFAULT_ICON_PATH;
+// } else {
+// if (!iconPath.endsWith("/")) {
+// iconPath += "/";
+// }
+// }
+// return iconPath;
+// }
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -21,7 +21,7 @@
package jaxx.runtime.context;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -248,7 +248,7 @@
}
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,7 +47,7 @@
/**
* entry of the parent context
*/
- protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = JAXXUtil.newContextEntryDef(JAXXContext.class);
+ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class);
/**
* Logger
*/
@@ -194,7 +194,7 @@
// }
protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) {
- return JAXXUtil.newContextEntryDef(name, klass);
+ return Util.newContextEntryDef(name, klass);
}
@SuppressWarnings({"unchecked"})
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -23,7 +23,7 @@
import javax.swing.JTree;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.JAXXContextEntryDef;
/**
@@ -71,13 +71,13 @@
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
- treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
- selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
- selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
- selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
-// selectedUIContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-ui", Component.class);
+ treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class);
+ treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
+ treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class);
+ selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
+ selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class);
+// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class);
}
public String getPrefix() {
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -33,10 +33,10 @@
@Test
public void testGetEventListener() {
count = 0;
- DocumentListener listener = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener.insertUpdate(null);
Assert.assertEquals(count, 1);
- DocumentListener listener2 = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener2 = (DocumentListener) Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener2.removeUpdate(null);
Assert.assertEquals(count, 2);
//assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -20,7 +20,7 @@
*/
package jaxx.runtime.swing.navigation;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import jaxx.runtime.context.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
import org.junit.Assert;
@@ -164,10 +164,10 @@
NavigationTreeNode sonSonNode;
NavigationTreeNode sonSonSonNode;
- builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name", String.class), "name", null, null);
- builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name2", String.class), "name2", null, null);
+ builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null);
+ builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null);
- sonNode = builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef(Model.class), "model", null, null);
+ sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null);
builder.build(sonNode, (String) null, "../name", "name", null, null);
builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null);
@@ -286,7 +286,7 @@
NavigationTreeNode sonSonSonNode;
// first son is a list of models
- sonNode = builder.build(rootNode, (String) null, JAXXUtil.newListContextEntryDef("models"), "models", null, null);
+ sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null);
// first son son is a model
sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:49:15 UTC (rev 1724)
@@ -23,7 +23,7 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.Util;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -48,7 +48,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = JAXXUtil.decodeJAXXObjectDescriptor(data);
+ descriptor2 = Util.decodeJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
@@ -58,7 +58,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = JAXXUtil.decodeCompressedJAXXObjectDescriptor(data);
+ descriptor2 = Util.decodeCompressedJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
Modified: trunk/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
+++ trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:49:15 UTC (rev 1724)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
1
0
Author: sletellier
Date: 2010-01-29 16:18:50 +0100 (Fri, 29 Jan 2010)
New Revision: 1723
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
Removed:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
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/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
trunk/src/site/rst/BeanValidator.rst
Log:
Evol 929 : Refactor Util to JAXXUtil
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -460,8 +460,8 @@
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
//TC-20091026 use 'this' instead of root object javaCode
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name
- return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name
+ return getJavaCode() + '.' + addMethod.getName() + "(JAXXUtil.getEventListener(" + listenerClass.getSimpleName() + ".class, " +
TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -127,7 +127,7 @@
*/
protected final IDHelper idHelper;
/**
- * Binding Util
+ * Binding JAXXUtil
*/
protected final DataBindingHelper bindingHelper;
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -651,7 +651,7 @@
"jaxx.runtime.swing.HBox",
"jaxx.runtime.swing.VBox",
"jaxx.runtime.swing.Table",
- "jaxx.runtime.Util",
+ "jaxx.runtime.JAXXUtil",
"jaxx.runtime.SwingUtil",
"static org.nuiton.i18n.I18n._",
"static jaxx.runtime.SwingUtil.createImageIcon")
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -37,7 +37,7 @@
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
@@ -620,12 +620,12 @@
}
String code = objectCode + (eventInfo.getModelName() != null ? ".get" + StringUtils.capitalize(eventInfo.getModelName()) + "()" : "");
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
- //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(code).append('.').append(eventInfo.getAddMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(code).append('.').append(eventInfo.getAddMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
result.append(JAXXCompiler.getLineSeparator());
if (eventInfo.getModelName() != null) {
result.append(getAddMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + (compiler.getOutputClassName() + ".this") + ", " + constantId + ")",
compiler));
}
return result.toString();
@@ -696,12 +696,12 @@
result.append(modelClassName).append(" $target = ((").append(modelClassName).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 Util.getEventListener is generic, no more need cast and use simple listener name
- result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( Util.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+ //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+ result.append(" $target.").append(eventInfo.getRemoveMethod()).append("( JAXXUtil.getEventListener(").append(eventInfo.getListenerClass().getSimpleName()).append(".class, ").append("this").append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
result.append("}").append(eol);
if (eventInfo.getModelName() != null) {
result.append(getRemoveMemberListenerCode(handler, objectCode, "get" + StringUtils.capitalize(eventInfo.getModelName()),
- Util.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
+ JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(" + compiler.getOutputClassName() + ".this, " + constantId + ")",
compiler));
}
return result.toString();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -194,7 +194,7 @@
*
*/
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "JAXXObjectDescriptor", METHOD_NAME_$GET_JAXXOBJECT_DESCRIPTOR,
- "return Util.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
+ "return JAXXUtil.decodeCompressedJAXXObjectDescriptor(" + FIELD_NAME_$JAXX_OBJECT_DESCRIPTOR + ");", false);
/**
*
*/
@@ -624,7 +624,7 @@
}
}
if (!superclassIsJAXXObject) {
- code.append(Util.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
+ code.append(JAXXUtil.class.getSimpleName()).append(".initContext(this, " + PARAMETER_NAME_PARENT_CONTEXT + ");");
code.append(eol);
}
code.append(METHOD_NAME_$INITIALIZE + "();");
@@ -708,7 +708,7 @@
if (bindings.length > 0) {
result.append(eol).append("// apply ").append(bindings.length).append(" data bindings").append(eol);
- result.append(Util.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
+ result.append(JAXXUtil.class.getSimpleName()).append("." + METHOD_NAME_APPLY_DATA_BINDING + "(this, " + FIELD_NAME_$BINDINGS + ".keySet());").append(eol);
}
bindings = compiler.getBindingHelper().getSimpleBindings();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -133,7 +133,7 @@
for (FieldDescriptor field : fields) {
if (field.getName().equals(lhs)) {
//lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
+ node.firstToken.image = "jaxx.runtime.JAXXUtil.assignment(" + node.firstToken.image;
String outputClassName = compiler.getOutputClassName();
node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -337,13 +337,13 @@
// }
// String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
// result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
-// //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(code).append('.').append(eventInfo.addMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));");
// result.append(JAXXCompiler.getLineSeparator());
// if (eventInfo.modelName != null) {
// result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
@@ -407,14 +407,14 @@
// result.append(modelClassName).append(" $target = ((").append(modelClassName).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 Util.getEventListener is generic, no more need cast and use simple listener name
-// result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
+// //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple listener name
+// result.append(" $target.").append(eventInfo.removeMethod).append("( JAXXUtil.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));").append(eol);
// result.append("}").append(eol);
// if (eventInfo.modelName != null) {
//// String bi = dataBinding.startsWith("this.") ? dataBinding : ("\"" + dataBinding + "\"");
// result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
-// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
-//// Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, " + dataBinding + ")",
+//// JAXXUtil.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
// compiler));
// }
// return result.toString();
Modified: trunk/jaxx-compiler/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-compiler/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -29,6 +29,7 @@
import java.util.Properties;
import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -213,7 +214,7 @@
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = jaxx.runtime.Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -37,6 +37,7 @@
import jaxx.demo.fun.LabelStyleDemo;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -190,7 +191,7 @@
/**
* la definition de l'unqiue object a partage
*/
- static private final JAXXContextEntryDef<DemoConfig> def = jaxx.runtime.Util.newContextEntryDef(DemoConfig.class);
+ static private final JAXXContextEntryDef<DemoConfig> def = JAXXUtil.newContextEntryDef(DemoConfig.class);
/**
* la pile des noeuds parent
*/
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -21,6 +21,7 @@
package jaxx.demo;
import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -56,7 +57,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(DemoUIHandler.class);
- static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = jaxx.runtime.Util.newContextEntryDef("mainui", DemoUI.class);
+ static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class);
/**
* Methode pour initialiser l'ui principale sans l'afficher.
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
@@ -63,11 +63,11 @@
/**
* where the movies are hold in context
*/
- static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies");
+ static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXUtil.newListContextEntryDef("movies");
/**
* where the actors are hold in context
*/
- static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors");
+ static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXUtil.newListContextEntryDef("actors");
protected FullNavigationTreeModelBuilder builder;
public FullNavigationTreeHelper() {
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/JAXXUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -0,0 +1,516 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.io.IOException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.*;
+
+public class JAXXUtil {
+
+ // public static final String DEFAULT_ICON_PATH = "/icons/";
+ // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(JAXXUtil.class);
+ public static final String PARENT = "parent";
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+ private static class EventListenerDescriptor {
+
+ Class<?> listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
+
+ /*byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();*/
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
+ return newContextEntryDef(null, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
+ return new JAXXContextEntryDef<O>(name, klass);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
+ return newListContextEntryDef(null);
+ }
+
+ public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
+ Class<List<O>> castList = JAXXUtil.castList();
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
+ return contextEntryDef;
+ }
+
+// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
+// bindings.put(binding.getId(), binding);
+//// binding.applyDataBinding();
+//// binding.processDataBinding();
+// return binding;
+// }
+
+// /**
+// * Return parent's container corresponding to the Class clazz
+// *
+// * @param <O> type of container to obtain from context
+// * @param top the top container
+// * @param clazz desired
+// * @return parent's container
+// */
+// @SuppressWarnings({"unchecked"})
+// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
+// if (top == null) {
+// throw new IllegalArgumentException("top parameter can not be null");
+// }
+// if (!Container.class.isAssignableFrom(top.getClass())) {
+// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
+// }
+// Container parent = ((Container) top).getParent();
+// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
+// parent = getParentContainer(parent, clazz);
+// }
+// return (O) parent;
+// }
+
+ @SuppressWarnings({"unchecked"})
+ protected static <O> Class<List<O>> castList() {
+ return (Class<List<O>>) Collections.emptyList().getClass();
+ }
+
+ /**
+ * Method to initialize the context of a ui.
+ *
+ * @param ui the ui
+ * @param parentContext the context to set in ui
+ */
+ public static void initContext(JAXXObject ui, JAXXContext parentContext) {
+
+ if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
+ ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
+ } else {
+ ui.setContextValue(parentContext);
+ }
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return (E) descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null) {
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ }
+ Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class<?>[]{listenerClass},
+ new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ targetMethod.setAccessible(true);
+ return targetMethod.invoke(methodContainer, args);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("could not invoke on container " + methodContainer, e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return (E) descriptor.eventListener;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName())) {
+ return listener;
+ }
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+// public static void setComponentWidth(Component component, int width) {
+// component.setSize(width, component.getHeight());
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+// public static void setComponentHeight(Component component, int height) {
+// component.setSize(component.getWidth(), height);
+// if (component instanceof JComponent) {
+// JComponent jcomponent = (JComponent) component;
+// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+// if (jcomponent.isDisplayable()) {
+// jcomponent.revalidate();
+// }
+// }
+// }
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+ /**
+ * Compute the string representation of an object.
+ * <p/>
+ * Return empty string if given object is null
+ *
+ * @param value the value to write
+ * @return the string representation of the given object or an empty string if object is null.
+ */
+ public static String getStringValue(Object value) {
+ String result;
+ result = value == null ? "" : value.toString();
+ return result;
+ }
+
+ /**
+ * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
+ * <p/>
+ * If entry is found, return his value in context.
+ *
+ * @param <T> the type of required data
+ * @param context the context to test
+ * @param def the definition of the entry to seek in context
+ * @return the value from the context
+ * @throws IllegalArgumentException if the entry is not found in context.
+ */
+ public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
+
+ T value = def.getContextValue(context);
+
+ if (value == null) {
+ throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+ /**
+ * Convinient method to apply more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
+ for (String binding : bindings) {
+ src.applyDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to process more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void processDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.processDataBinding(binding);
+ }
+ }
+
+ /**
+ * Convinient method to remove more than one binding on a JAXX ui.
+ *
+ * @param src the ui to treate
+ * @param bindings the list of binding to process.
+ */
+ public static void removeDataBinding(JAXXObject src, String... bindings) {
+ for (String binding : bindings) {
+ src.removeDataBinding(binding);
+ }
+ }
+
+// public static ImageIcon createIcon(String path) {
+// java.net.URL imgURL = JAXXUtil.class.getResource(path);
+// if (imgURL != null) {
+// return new ImageIcon(imgURL);
+// } else {
+// throw new IllegalArgumentException("could not find icon " + path);
+// }
+// }
+
+// /**
+// * @param path the location of icons in root directory icons
+// * @return the icon at {@link #getIconPath()}+path
+// */
+// public static ImageIcon createImageIcon(String path) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + path);
+// }
+//
+// /**
+// * @param key the key of the icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerIcon(String key) {
+// return UIManager.getIcon(key);
+// }
+//
+// /**
+// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
+// *
+// * @param key the key of the action icon to retreave from {@link UIManager}
+// * @return the icon, or <code>null if no icon found in {@link UIManager}
+// */
+// public static Icon getUIManagerActionIcon(String key) {
+// return getUIManagerIcon("action." + key);
+// }
+//
+// public static ImageIcon createActionIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "action-" + name + ".png");
+// }
+//
+// public static ImageIcon createI18nIcon(String name) {
+// String iconPath = getIconPath();
+// return createIcon(iconPath + "i18n/" + name + ".png");
+// }
+
+ /**
+ * detects all PropertychangedListener added by Jaxx uis
+ * (should be a {@link DataBindingListener}
+ *
+ * @param propertyNames the array of property names to find
+ * @param listeners the array of listeners to filter
+ * @return the filtered listeners
+ */
+ public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
+ if (listeners == null || listeners.length == 0) {
+ return new PropertyChangeListener[0];
+ }
+ List<String> pNames = Arrays.asList(propertyNames);
+
+ List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
+
+ for (PropertyChangeListener listener : listeners) {
+ String pName = null;
+ PropertyChangeListenerProxy plistener = null;
+ if (listener instanceof PropertyChangeListenerProxy) {
+ plistener = (PropertyChangeListenerProxy) listener;
+ if (!pNames.contains(plistener.getPropertyName())) {
+ // not on the good property
+ continue;
+ }
+ listener = (PropertyChangeListener) plistener.getListener();
+ pName = plistener.getPropertyName();
+ }
+ if (plistener != null && pName != null && listener instanceof DataBindingListener) {
+ if (log.isDebugEnabled()) {
+ log.debug("find config listener to remove [" + pName + "] : " + listener);
+ }
+ toRemove.add(plistener);
+ //toRemove.add(listener);
+ }
+ }
+ return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
+ }
+
+// private static String getIconPath() {
+// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
+// if (iconPath == null) {
+// iconPath = DEFAULT_ICON_PATH;
+// } else {
+// if (!iconPath.endsWith("/")) {
+// iconPath += "/";
+// }
+// }
+// return iconPath;
+// }
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -79,7 +79,7 @@
* @author tony
* @since 1.2
*/
-public class SwingUtil extends Util {
+public class SwingUtil extends JAXXUtil {
/**
* to use log facility, just put in your code: log.info(\"...\");
@@ -861,7 +861,7 @@
}
public static ImageIcon createIcon(String path) {
- java.net.URL imgURL = Util.class.getResource(path);
+ java.net.URL imgURL = JAXXUtil.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -1,516 +0,0 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 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>.
- * ##%*
- */
-package jaxx.runtime;
-
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.*;
-
-public class Util {
-
- // public static final String DEFAULT_ICON_PATH = "/icons/";
- // public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(Util.class);
- public static final String PARENT = "parent";
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
- private static class EventListenerDescriptor {
-
- Class<?> listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, false);
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true);
-
- /*byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(), 0, data, 0, data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();*/
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) {
- return newContextEntryDef(null, klass);
- }
-
- public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) {
- return new JAXXContextEntryDef<O>(name, klass);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() {
- return newListContextEntryDef(null);
- }
-
- public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
- Class<List<O>> castList = Util.castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
- return contextEntryDef;
- }
-
-// public static DefaultJAXXBinding registerBinding(Map<String, DefaultJAXXBinding> bindings, DefaultJAXXBinding binding) {
-// bindings.put(binding.getId(), binding);
-//// binding.applyDataBinding();
-//// binding.processDataBinding();
-// return binding;
-// }
-
-// /**
-// * Return parent's container corresponding to the Class clazz
-// *
-// * @param <O> type of container to obtain from context
-// * @param top the top container
-// * @param clazz desired
-// * @return parent's container
-// */
-// @SuppressWarnings({"unchecked"})
-// public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) {
-// if (top == null) {
-// throw new IllegalArgumentException("top parameter can not be null");
-// }
-// if (!Container.class.isAssignableFrom(top.getClass())) {
-// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class);
-// }
-// Container parent = ((Container) top).getParent();
-// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) {
-// parent = getParentContainer(parent, clazz);
-// }
-// return (O) parent;
-// }
-
- @SuppressWarnings({"unchecked"})
- protected static <O> Class<List<O>> castList() {
- return (Class<List<O>>) Collections.emptyList().getClass();
- }
-
- /**
- * Method to initialize the context of a ui.
- *
- * @param ui the ui
- * @param parentContext the context to set in ui
- */
- public static void initContext(JAXXObject ui, JAXXContext parentContext) {
-
- if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {
- ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui);
- } else {
- ui.setContextValue(parentContext);
- }
- // if parentContext is a JAXXObject then
- // add an special parent entry to can go up
- if (parentContext instanceof JAXXObject) {
- ui.setContextValue(parentContext, PARENT);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return (E) descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null) {
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- }
- Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class<?>[]{listenerClass},
- new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- targetMethod.setAccessible(true);
- return targetMethod.invoke(methodContainer, args);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("could not invoke on container " + methodContainer, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return (E) descriptor.eventListener;
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName())) {
- return listener;
- }
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-// public static void setComponentWidth(Component component, int width) {
-// component.setSize(width, component.getHeight());
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
-// public static void setComponentHeight(Component component, int height) {
-// component.setSize(component.getWidth(), height);
-// if (component instanceof JComponent) {
-// JComponent jcomponent = (JComponent) component;
-// jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
-// if (jcomponent.isDisplayable()) {
-// jcomponent.revalidate();
-// }
-// }
-// }
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
- /**
- * Compute the string representation of an object.
- * <p/>
- * Return empty string if given object is null
- *
- * @param value the value to write
- * @return the string representation of the given object or an empty string if object is null.
- */
- public static String getStringValue(Object value) {
- String result;
- result = value == null ? "" : value.toString();
- return result;
- }
-
- /**
- * Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.
- * <p/>
- * If entry is found, return his value in context.
- *
- * @param <T> the type of required data
- * @param context the context to test
- * @param def the definition of the entry to seek in context
- * @return the value from the context
- * @throws IllegalArgumentException if the entry is not found in context.
- */
- public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException {
-
- T value = def.getContextValue(context);
-
- if (value == null) {
- throw new IllegalArgumentException("the context entry [" + def + "] ] was not found in context " + context);
- }
-
- return value;
- }
-
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
- /**
- * Convinient method to apply more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void applyDataBinding(JAXXObject src, Collection<String> bindings) {
- for (String binding : bindings) {
- src.applyDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to process more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void processDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.processDataBinding(binding);
- }
- }
-
- /**
- * Convinient method to remove more than one binding on a JAXX ui.
- *
- * @param src the ui to treate
- * @param bindings the list of binding to process.
- */
- public static void removeDataBinding(JAXXObject src, String... bindings) {
- for (String binding : bindings) {
- src.removeDataBinding(binding);
- }
- }
-
-// public static ImageIcon createIcon(String path) {
-// java.net.URL imgURL = Util.class.getResource(path);
-// if (imgURL != null) {
-// return new ImageIcon(imgURL);
-// } else {
-// throw new IllegalArgumentException("could not find icon " + path);
-// }
-// }
-
-// /**
-// * @param path the location of icons in root directory icons
-// * @return the icon at {@link #getIconPath()}+path
-// */
-// public static ImageIcon createImageIcon(String path) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + path);
-// }
-//
-// /**
-// * @param key the key of the icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerIcon(String key) {
-// return UIManager.getIcon(key);
-// }
-//
-// /**
-// * retreave for the {@link UIManager} the icon prefixed by <code>action.</code>
-// *
-// * @param key the key of the action icon to retreave from {@link UIManager}
-// * @return the icon, or <code>null if no icon found in {@link UIManager}
-// */
-// public static Icon getUIManagerActionIcon(String key) {
-// return getUIManagerIcon("action." + key);
-// }
-//
-// public static ImageIcon createActionIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "action-" + name + ".png");
-// }
-//
-// public static ImageIcon createI18nIcon(String name) {
-// String iconPath = getIconPath();
-// return createIcon(iconPath + "i18n/" + name + ".png");
-// }
-
- /**
- * detects all PropertychangedListener added by Jaxx uis
- * (should be a {@link DataBindingListener}
- *
- * @param propertyNames the array of property names to find
- * @param listeners the array of listeners to filter
- * @return the filtered listeners
- */
- public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners) {
- if (listeners == null || listeners.length == 0) {
- return new PropertyChangeListener[0];
- }
- List<String> pNames = Arrays.asList(propertyNames);
-
- List<PropertyChangeListener> toRemove = new ArrayList<PropertyChangeListener>();
-
- for (PropertyChangeListener listener : listeners) {
- String pName = null;
- PropertyChangeListenerProxy plistener = null;
- if (listener instanceof PropertyChangeListenerProxy) {
- plistener = (PropertyChangeListenerProxy) listener;
- if (!pNames.contains(plistener.getPropertyName())) {
- // not on the good property
- continue;
- }
- listener = (PropertyChangeListener) plistener.getListener();
- pName = plistener.getPropertyName();
- }
- if (plistener != null && pName != null && listener instanceof DataBindingListener) {
- if (log.isDebugEnabled()) {
- log.debug("find config listener to remove [" + pName + "] : " + listener);
- }
- toRemove.add(plistener);
- //toRemove.add(listener);
- }
- }
- return toRemove.toArray(new PropertyChangeListener[toRemove.size()]);
- }
-
-// private static String getIconPath() {
-// String iconPath = UIManager.getString(DEFAULT_ICON_PATH_PROPERTY);
-// if (iconPath == null) {
-// iconPath = DEFAULT_ICON_PATH;
-// } else {
-// if (!iconPath.endsWith("/")) {
-// iconPath += "/";
-// }
-// }
-// return iconPath;
-// }
-}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -21,7 +21,7 @@
package jaxx.runtime.context;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -248,7 +248,7 @@
}
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -22,7 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,7 +47,7 @@
/**
* entry of the parent context
*/
- protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class);
+ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = JAXXUtil.newContextEntryDef(JAXXContext.class);
/**
* Logger
*/
@@ -194,7 +194,7 @@
// }
protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) {
- return Util.newContextEntryDef(name, klass);
+ return JAXXUtil.newContextEntryDef(name, klass);
}
@SuppressWarnings({"unchecked"})
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -23,11 +23,9 @@
import javax.swing.JTree;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
-import java.awt.*;
-
/**
* To help getting and setting navigation tree objects from a {@link JAXXContext}.
* <p/>
@@ -73,13 +71,13 @@
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
- treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
- selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class);
- selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
- selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class);
-// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class);
+ treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
+ treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
+ treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
+ selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
+ selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
+// selectedUIContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-ui", Component.class);
}
public String getPrefix() {
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -1,23 +1,23 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 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>.
- * ##%*
- */
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 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>.
+ * ##%*
+ */
package jaxx.runtime;
import org.junit.Assert;
@@ -33,10 +33,10 @@
@Test
public void testGetEventListener() {
count = 0;
- DocumentListener listener = (DocumentListener) jaxx.runtime.Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener.insertUpdate(null);
Assert.assertEquals(count, 1);
- DocumentListener listener2 = (DocumentListener) jaxx.runtime.Util.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
+ DocumentListener listener2 = (DocumentListener) JAXXUtil.getEventListener(javax.swing.event.DocumentListener.class, this, "incCount");
listener2.removeUpdate(null);
Assert.assertEquals(count, 2);
//assertTrue("Received two different event listeners despite using identical parameters", listener == listener2);
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -20,6 +20,7 @@
*/
package jaxx.runtime.swing.navigation;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
import org.junit.Assert;
@@ -28,7 +29,6 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import jaxx.runtime.Util;
/**
* Test du model de navigation.
@@ -164,10 +164,10 @@
NavigationTreeNode sonSonNode;
NavigationTreeNode sonSonSonNode;
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null);
- builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name", String.class), "name", null, null);
+ builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef("name2", String.class), "name2", null, null);
- sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newContextEntryDef(Model.class), "model", null, null);
builder.build(sonNode, (String) null, "../name", "name", null, null);
builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null);
@@ -286,7 +286,7 @@
NavigationTreeNode sonSonSonNode;
// first son is a list of models
- sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null);
+ sonNode = builder.build(rootNode, (String) null, JAXXUtil.newListContextEntryDef("models"), "models", null, null);
// first son son is a model
sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2010-01-29 15:18:50 UTC (rev 1723)
@@ -23,7 +23,7 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.Util;
+import jaxx.runtime.JAXXUtil;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -48,7 +48,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
@@ -58,7 +58,7 @@
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
- descriptor2 = Util.decodeCompressedJAXXObjectDescriptor(data);
+ descriptor2 = JAXXUtil.decodeCompressedJAXXObjectDescriptor(data);
assertNotNull(descriptor2);
assertEquals(descriptor.toString(), descriptor2.toString());
Modified: trunk/src/site/rst/BeanValidator.rst
===================================================================
--- trunk/src/site/rst/BeanValidator.rst 2010-01-26 21:06:53 UTC (rev 1722)
+++ trunk/src/site/rst/BeanValidator.rst 2010-01-29 15:18:50 UTC (rev 1723)
@@ -170,7 +170,7 @@
::
- jaxx.runtime.Util.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
+ jaxx.runtime.JAXXUtil.convert(validator,"nomDeLaPropriété",widget.getText(),TypeDeLaProriete.class);
On obtiendra si une erreur de conversion intervient, une erreur dont le libellé est de la forme *error.convertor.XXX*
1
0
Author: tchemit
Date: 2010-01-26 22:06:53 +0100 (Tue, 26 Jan 2010)
New Revision: 1722
Modified:
trunk/pom.xml
Log:
Utilisation de mavenpom4redmine 2.0.4
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-24 23:35:36 UTC (rev 1721)
+++ trunk/pom.xml 2010-01-26 21:06:53 UTC (rev 1722)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0.3</version>
+ <version>2.0.4</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
Author: tchemit
Date: 2010-01-25 00:35:36 +0100 (Mon, 25 Jan 2010)
New Revision: 1721
Modified:
trunk/pom.xml
Log:
Utilisation de mavenpom4redmine 2.0.3
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-19 17:50:08 UTC (rev 1720)
+++ trunk/pom.xml 2010-01-24 23:35:36 UTC (rev 1721)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0.2</version>
+ <version>2.0.3</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
r1720 - trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 19 Jan '10
by tchemit@users.nuiton.org 19 Jan '10
19 Jan '10
Author: tchemit
Date: 2010-01-19 18:50:08 +0100 (Tue, 19 Jan 2010)
New Revision: 1720
Modified:
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java
Log:
clean code + debut de resolution de Anomalie #236: La generation de l'index de l'aide n'est pas correct
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -107,7 +107,6 @@
@Override
protected void init() throws Exception {
-// protected boolean init() throws Exception {
if (StringUtils.isEmpty(locales)) {
throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ").");
@@ -132,8 +131,6 @@
defaultLocale = localesToTreate[0];
createDirectoryIfNecessary(getTargetDirectory());
-
-// return true;
}
@Override
@@ -148,10 +145,6 @@
@Override
protected void doAction() throws Exception {
-// if (skipAction()) {
-// return;
-// }
-
for (Locale locale : localesToTreate) {
boolean isDefaultLocale = locale == defaultLocale;
@@ -171,14 +164,6 @@
postDoAction();
}
-// protected boolean skipAction() {
-// if (!generateHelp) {
-// getLog().info("generateHelp flag is off, will skip goal.");
-// return true;
-// }
-// return false;
-// }
-
public File getOutputHelpIds() {
return outputHelpIds;
}
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -81,7 +81,6 @@
protected boolean checkPackaging() {
// not accept pom modules
return !acceptPackaging(Packaging.pom);
-// return project != null && !"pom".equals(project.getPackaging()) && !"site".equals(project.getPackaging());
}
@Override
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -134,10 +134,8 @@
@Override
public void init() throws Exception {
-// public boolean init() throws Exception {
if (!generateHelp) {
return;
-// return true;
}
// check ressources
@@ -154,31 +152,12 @@
super.init();
-// boolean b = super.init();
-// if (!b) {
-// return false;
-// }
-
// load ids from idsStore file
-// File idsFile;
-
if (isForce()) {
idsFile = getMergeHelpIdsStoreFile();
-// if (!idsFile.exists()) {
-// if (isVerbose()) {
-// getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
-// }
-// return true;
-// }
} else {
idsFile = getHelpIdsStoreFile();
-// if (!idsFile.exists()) {
-// if (isVerbose()) {
-// getLog().info("no helpIdStore to react at " + idsFile);
-// }
-// return true;
-// }
}
if (!idsFile.exists()) {
@@ -190,21 +169,10 @@
// loading all ids
Set<String> ids = loadHelpIds(idsFile);
-// if (ids.isEmpty()) {
-//
-// // no ids detected
-// if (isVerbose()) {
-// getLog().info("No helpIds detected, will skip.");
-// }
-// return true;
-// }
-
for (String id : ids) {
String path = id.replaceAll("\\.", File.separator) + ".html";
helpIds.put(id, path);
}
-
-// return true;
}
@Override
@@ -229,33 +197,6 @@
return b;
}
-// @Override
-// protected boolean skipAction() {
-// boolean b = super.skipAction();
-// if (!b) {
-// if (helpIds == null || helpIds.isEmpty()) {
-// getLog().info("No help ids to treate.");
-// return true;
-// }
-// }
-// return false;
-// }
-
-// @Override
-// public void doAction() throws Exception {
-//
-// if (skipAction()) {
-// return;
-// }
-//
-// if (helpIds == null || helpIds.isEmpty()) {
-// getLog().info("No help ids to treate.");
-// return;
-// }
-//
-// super.doAction();
-// }
-
protected void postDoAction() {
getLog().info(touchedFiles + " file(s) treated.");
}
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -32,19 +32,13 @@
@Override
public void init() throws Exception {
-// public boolean init() throws Exception {
if (!generateHelp) {
return;
-// return true;
}
super.init();
-// if (!super.init()) {
-// return false;
-// }
-
// check there is some bundle
if (getHelpIdsFilename() == null) {
throw new MojoFailureException("you must set the 'helpIdStore' property.");
@@ -58,7 +52,6 @@
// always clean helpIdsStore before all
cleanHelpIdsStore();
-// return true;
}
@Override
@@ -80,21 +73,6 @@
@Override
public void doAction() throws Exception {
-// if (skipAction()) {
-// return;
-// }
-
-// Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
-//
-// if (helpIds.isEmpty()) {
-//// if (isVerbose()) {
-// // no ids detected in this compilation round
-// getLog().info("No helpIds detected.");
-//// }
-// cleanHelpIdsStore();
-// return;
-// }
-
// store current jaxx session detected help ids
File idsStore = getHelpIdsStoreFile();
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -45,19 +45,12 @@
public void setTargetDirectory(File targetDirectory) {
}
-// @Override
-// public boolean init() throws Exception {
-//
-// return true;
-// }
-
@Override
public void doAction() throws Exception {
}
protected void postDoAction() {
- //getLog().info(touchedFiles + " file(s) treated.");
}
protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -19,9 +19,7 @@
package org.nuiton.jaxx.plugin;
import com.sun.java.help.search.Indexer;
-import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringUtils;
import org.nuiton.plugin.PluginHelper;
import java.io.File;
@@ -56,25 +54,26 @@
*/
protected File outputHelpSearch;
+ /**
+ * The directory where to pick content files to generate the index.
+ *
+ * @parameter expression="${jaxx.inputHelp}" default-value="${project.basedir}/src/main/help"
+ * @required
+ * @since 2.0.0
+ */
+ protected File inputHelp;
+
protected String timestamp;
@Override
public void init() throws Exception {
-// public boolean init() throws Exception {
if (!generateHelp || !generateSearch) {
return;
-// return true;
}
-// if (!generateSearch) {
-//// getLog().info("Do not generate search.");
-// return true;
-// }
-
timestamp = "-" + System.currentTimeMillis();
super.init();
-// return super.init();
}
@Override
@@ -92,32 +91,23 @@
boolean b = super.checkSkip();
if (b) {
if (!generateSearch) {
- getLog().info("generateHelpsearch flag is off, will skip goal.");
+ getLog().info("generateSearch flag is off, will skip goal.");
return false;
}
}
return b;
}
-// protected boolean skipAction() {
-// if (!generateHelp) {
-// getLog().info("generateHelp flag is off, generate nothing.");
-// return true;
-// }
-// if (!generateSearch) {
-// getLog().info("generateHelpsearch flag is off, generate nothing.");
-// return true;
-// }
-// return false;
-// }
-
@Override
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
+ protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
String language = locale.getLanguage();
- File target = new File(getTargetDirectory(), localePath + File.separator + "JavaHelpSearch");
+ File source = new File(inputHelp, localePath);
+ File target = new File(localizedTarget, "JavaHelpSearch");
+// File target = new File(getTargetDirectory(), localePath + File.separator + "JavaHelpSearch");
+
// detect if need to generate
boolean generate = false;
@@ -167,6 +157,7 @@
}
createDirectoryIfNecessary(source);
+// createDirectoryIfNecessary(localizedTarget);
createDirectoryIfNecessary(target);
// ---------------------------------------------------------------
@@ -197,7 +188,8 @@
if (isVerbose()) {
getLog().info("copy files to " + tmpDir + " for indexing them.");
}
- FileUtils.copyDirectory(source, tmpDir, "**/*", StringUtils.join(DirectoryScanner.DEFAULTEXCLUDES, ","));
+ FileUtils.copyDirectoryStructure(source, tmpDir);
+// FileUtils.copyDirectory(source, tmpDir, "**/*", StringUtils.join(DirectoryScanner.DEFAULTEXCLUDES, ",")+",**/*.jpg");
// prepare arguments of Indexer.main calling
List<String> params = new ArrayList<String>();
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -290,7 +290,6 @@
@SuppressWarnings("unchecked")
@Override
public void init() throws Exception {
-// public boolean init() throws Exception {
fixCompileSourceRoots();
@@ -308,7 +307,6 @@
nofiles = files == null || files.length == 0;
if (nofiles) {
return;
-// return true;
}
cl = initClassLoader(getProject(),
@@ -361,7 +359,6 @@
getLog().info("will parse " + file);
}
}
-// return true;
}
@Override
@@ -376,11 +373,6 @@
@Override
public void doAction() throws Exception {
-// if (nofiles) {
-// getLog().info("Nothing to generate - all files are uo to date.");
-// return;
-// }
-
getLog().info("Detects " + files.length + " modified jaxx file(s). ");
if (showBinding) {
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java 2010-01-19 17:33:41 UTC (rev 1719)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java 2010-01-19 17:50:08 UTC (rev 1720)
@@ -68,8 +68,9 @@
}
});
- InputStream s = new FileInputStream(file);
+ InputStream s=null;
try {
+ s = new FileInputStream(file);
parser.parse(new InputSource(s));
} finally {
if (s != null) {
1
0
Author: tchemit
Date: 2010-01-19 18:33:41 +0100 (Tue, 19 Jan 2010)
New Revision: 1719
Modified:
trunk/pom.xml
Log:
Utilisation de mavenpom4redmine 2.0.2
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-17 20:14:22 UTC (rev 1718)
+++ trunk/pom.xml 2010-01-19 17:33:41 UTC (rev 1719)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0.1</version>
+ <version>2.0.2</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
Author: tchemit
Date: 2010-01-17 21:14:22 +0100 (Sun, 17 Jan 2010)
New Revision: 1718
Modified:
trunk/pom.xml
Log:
Utilisation de mavenpom4redmine 2.0.1
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-13 09:54:14 UTC (rev 1717)
+++ trunk/pom.xml 2010-01-17 20:14:22 UTC (rev 1718)
@@ -1,3 +1,4 @@
+<?xml version="1.0"?>
<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,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0-SNAPSHOT</version>
+ <version>2.0.1</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
Author: tchemit
Date: 2010-01-13 10:54:14 +0100 (Wed, 13 Jan 2010)
New Revision: 1717
Modified:
trunk/pom.xml
Log:
Jaxx is on redmine not on labs
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-10 22:57:31 UTC (rev 1716)
+++ trunk/pom.xml 2010-01-13 09:54:14 UTC (rev 1717)
@@ -8,7 +8,7 @@
<parent>
<groupId>org.nuiton</groupId>
- <artifactId>mavenpom4labs</artifactId>
+ <artifactId>mavenpom4redmine</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
1
0
10 Jan '10
Author: tchemit
Date: 2010-01-10 23:57:31 +0100 (Sun, 10 Jan 2010)
New Revision: 1716
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/pom.xml
Log:
use mavenpom4redmine
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-07 03:12:55 UTC (rev 1715)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-10 22:57:31 UTC (rev 1716)
@@ -143,7 +143,7 @@
jaxxdemo.action.exit.tip=Quit JAXXDemo
jaxxdemo.action.fullscreen=Full screen
jaxxdemo.action.fullscreen.tip=Change to full screen mode
-jaxxdemo.action.help=Help
+jaxxdemo.action.help=
jaxxdemo.action.help.tip=Display help
jaxxdemo.action.locale.fr=French
jaxxdemo.action.locale.fr.tip=Change to french language
@@ -175,7 +175,7 @@
jaxxdemo.init.ui.done=UI initialized.
jaxxdemo.menu.file=File
jaxxdemo.menu.file.locale=Languages
-jaxxdemo.menu.help=Help
+jaxxdemo.menu.help=
jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
jaxxdemo.message.goto.site=Go to JAXXDemo Web site
jaxxdemo.navigation.actor.title=
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
+++ trunk/pom.xml 2010-01-10 22:57:31 UTC (rev 1716)
@@ -8,8 +8,8 @@
<parent>
<groupId>org.nuiton</groupId>
- <artifactId>mavenpom</artifactId>
- <version>1.1.4</version>
+ <artifactId>mavenpom4labs</artifactId>
+ <version>2.0-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
r1715 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 07 Jan '10
by tchemit@users.nuiton.org 07 Jan '10
07 Jan '10
Author: tchemit
Date: 2010-01-07 04:12:55 +0100 (Thu, 07 Jan 2010)
New Revision: 1715
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/jaxx-compiler/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/jaxx-demo/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/jaxx-runtime/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/jaxx-swing-action/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/jaxx-widgets/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/maven-jaxx-plugin/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 03:12:51 UTC (rev 1714)
+++ trunk/pom.xml 2010-01-07 03:12:55 UTC (rev 1715)
@@ -13,7 +13,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4</version>
+ <version>2.0.0-beta-5-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
@@ -403,9 +403,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-4</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-4</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-4</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
</project>
1
0
Author: tchemit
Date: 2010-01-07 04:12:51 +0100 (Thu, 07 Jan 2010)
New Revision: 1714
Added:
tags/jaxx-2.0.0-beta-4/
Log:
[maven-scm] copy for tag jaxx-2.0.0-beta-4
1
0
r1713 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 07 Jan '10
by tchemit@users.nuiton.org 07 Jan '10
07 Jan '10
Author: tchemit
Date: 2010-01-07 04:12:48 +0100 (Thu, 07 Jan 2010)
New Revision: 1713
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-2.0.0-beta-4
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/jaxx-compiler/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/jaxx-demo/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/jaxx-runtime/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/jaxx-swing-action/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/jaxx-widgets/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/maven-jaxx-plugin/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -1,6 +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">
+<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>
@@ -11,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
+++ trunk/pom.xml 2010-01-07 03:12:48 UTC (rev 1713)
@@ -13,7 +13,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-4-SNAPSHOT</version>
+ <version>2.0.0-beta-4</version>
<modules>
<module>jaxx-runtime</module>
@@ -403,9 +403,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-4</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-4</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-4</url>
</scm>
</project>
1
0
Author: tchemit
Date: 2010-01-07 04:10:11 +0100 (Thu, 07 Jan 2010)
New Revision: 1712
Modified:
trunk/pom.xml
Log:
use mavenpom 1.1.4
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 02:46:32 UTC (rev 1711)
+++ trunk/pom.xml 2010-01-07 03:10:11 UTC (rev 1712)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.1.4-SNAPSHOT</version>
+ <version>1.1.4</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
r1711 - in trunk: . jaxx-compiler/src/site jaxx-demo/src/main/resources/i18n jaxx-demo/src/site jaxx-runtime/src/site jaxx-runtime/src/site/rst jaxx-swing-action/src/site jaxx-widgets/src/site jaxx-widgets/src/site/rst maven-jaxx-plugin/src/site maven-jaxx-plugin/src/site/rst src/site src/site/rst
by tchemit@users.nuiton.org 07 Jan '10
by tchemit@users.nuiton.org 07 Jan '10
07 Jan '10
Author: tchemit
Date: 2010-01-07 03:46:32 +0100 (Thu, 07 Jan 2010)
New Revision: 1711
Added:
trunk/jaxx-compiler/src/site/site_fr.xml
trunk/jaxx-demo/src/site/site_fr.xml
trunk/jaxx-runtime/src/site/rst/index.rst
trunk/jaxx-runtime/src/site/site_fr.xml
trunk/jaxx-swing-action/src/site/site_fr.xml
trunk/jaxx-widgets/src/site/site_fr.xml
trunk/maven-jaxx-plugin/src/site/site_fr.xml
trunk/src/site/site_fr.xml
Removed:
trunk/jaxx-compiler/src/site/site.xml
trunk/jaxx-demo/src/site/site.xml
trunk/jaxx-runtime/src/site/site.xml
trunk/jaxx-swing-action/src/site/site.xml
trunk/jaxx-widgets/src/site/site.xml
trunk/maven-jaxx-plugin/src/site/site.xml
trunk/src/site/site.xml
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-widgets/src/site/rst/index.rst
trunk/maven-jaxx-plugin/src/site/rst/index.rst
trunk/pom.xml
trunk/src/site/rst/index.rst
Log:
update doc and make it compatible with mavenpom
Deleted: trunk/jaxx-compiler/src/site/site.xml
===================================================================
--- trunk/jaxx-compiler/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-compiler/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top"/>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
-
- </body>
-</project>
Copied: trunk/jaxx-compiler/src/site/site_fr.xml (from rev 1706, trunk/jaxx-compiler/src/site/site.xml)
===================================================================
--- trunk/jaxx-compiler/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-compiler/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top"/>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+
+ </body>
+</project>
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-07 02:46:32 UTC (rev 1711)
@@ -143,7 +143,7 @@
jaxxdemo.action.exit.tip=Quit JAXXDemo
jaxxdemo.action.fullscreen=Full screen
jaxxdemo.action.fullscreen.tip=Change to full screen mode
-jaxxdemo.action.help=
+jaxxdemo.action.help=Help
jaxxdemo.action.help.tip=Display help
jaxxdemo.action.locale.fr=French
jaxxdemo.action.locale.fr.tip=Change to french language
@@ -151,8 +151,8 @@
jaxxdemo.action.locale.uk.tip=Change to english language
jaxxdemo.action.normalscreen=Normal screen
jaxxdemo.action.normalscreen.tip=Change to normal screen mode
-jaxxdemo.action.remove=
-jaxxdemo.action.show=
+jaxxdemo.action.remove=Remove
+jaxxdemo.action.show=show
jaxxdemo.action.site=Web site
jaxxdemo.action.site.tip=Go to the web site
jaxxdemo.config.category.directories=Files
@@ -161,7 +161,7 @@
jaxxdemo.config.category.other.description=Others preferences
jaxxdemo.config.configFileName.description=Configuration file name
jaxxdemo.config.ui.=
-jaxxdemo.config.ui.demo.path=
+jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Popup title
@@ -175,7 +175,7 @@
jaxxdemo.init.ui.done=UI initialized.
jaxxdemo.menu.file=File
jaxxdemo.menu.file.locale=Languages
-jaxxdemo.menu.help=
+jaxxdemo.menu.help=Help
jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
jaxxdemo.message.goto.site=Go to JAXXDemo Web site
jaxxdemo.navigation.actor.title=
Deleted: trunk/jaxx-demo/src/site/site.xml
===================================================================
--- trunk/jaxx-demo/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-demo/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top">
- <item name="Accueil" href="index.html"/>
- <item name="Lancer la démo" href="jnlp/launch.jnlp"/>
- </menu>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
-
- </body>
-</project>
Copied: trunk/jaxx-demo/src/site/site_fr.xml (from rev 1706, trunk/jaxx-demo/src/site/site.xml)
===================================================================
--- trunk/jaxx-demo/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-demo/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top">
+ <item name="Accueil" href="index.html"/>
+ <item name="Lancer la démo" href="jnlp/launch.jnlp"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+
+ </body>
+</project>
Added: trunk/jaxx-runtime/src/site/rst/index.rst
===================================================================
--- trunk/jaxx-runtime/src/site/rst/index.rst (rev 0)
+++ trunk/jaxx-runtime/src/site/rst/index.rst 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,13 @@
+jaxx-runtime
+============
+
+.. contents::
+
+
+Présentation
+------------
+
+Api des objets utilisables au runtime.
+
+**Veuillez consulter la JavaDoc pour de plus ample détails sur les différentes
+librairies.**
Deleted: trunk/jaxx-runtime/src/site/site.xml
===================================================================
--- trunk/jaxx-runtime/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-runtime/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top"/>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
-
- </body>
-</project>
Copied: trunk/jaxx-runtime/src/site/site_fr.xml (from rev 1706, trunk/jaxx-runtime/src/site/site.xml)
===================================================================
--- trunk/jaxx-runtime/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-runtime/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top">
+ <item name="Accueil" href="index.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+
+ </body>
+</project>
Deleted: trunk/jaxx-swing-action/src/site/site.xml
===================================================================
--- trunk/jaxx-swing-action/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-swing-action/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top"/>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
-
- </body>
-</project>
Copied: trunk/jaxx-swing-action/src/site/site_fr.xml (from rev 1706, trunk/jaxx-swing-action/src/site/site.xml)
===================================================================
--- trunk/jaxx-swing-action/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-swing-action/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top"/>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+
+ </body>
+</project>
Modified: trunk/jaxx-widgets/src/site/rst/index.rst
===================================================================
--- trunk/jaxx-widgets/src/site/rst/index.rst 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-widgets/src/site/rst/index.rst 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,40 +1,26 @@
-===================
-Examples/Components
-===================
+============
+JAXX Widgets
+============
-The Components demo displays many different Swing components being used in a variety of ways; it is JAXX's equivalent
-of the SwingSet demo. Various pages use advanced features such as data binding, scripting, event handling, and
-CSS stylesheets.
+The modules of rich widgets for swing desinged in jaxx.
-Examples/Calculator
-===================
+Editors
+=======
-This is an implementation of Challenge #2 from the `XUL Grand Coding Challenge 2004`_ . Because this example program
-has been implemented in so many different languages, you can easily compare JAXX's
-syntax against the competition and decide for yourself which you prefer.
+TODO Explain editors
Screen shot
-----------
-.. image:: images/Components-screenshot.gif
+TODO
-Set it in action
-----------------
+Widgets
+=======
-|webstart|
+TODO Explain widgets
-To run this example in `Java Web Start`_, click the `following link`_.
-
-Source code
+Screen shot
-----------
-Unlike the other examples, the source code for Components is too big to display here. You can view it yourself by
-downloading JAXX, and you can also view the source code for the individual demos by clicking the "Source" tabs.
-
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: ./launch-demo.jnlp
+TODO
\ No newline at end of file
Deleted: trunk/jaxx-widgets/src/site/site.xml
===================================================================
--- trunk/jaxx-widgets/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/jaxx-widgets/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top"/>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
-
- </body>
-</project>
Copied: trunk/jaxx-widgets/src/site/site_fr.xml (from rev 1706, trunk/jaxx-widgets/src/site/site.xml)
===================================================================
--- trunk/jaxx-widgets/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-widgets/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top"/>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+
+ </body>
+</project>
Modified: trunk/maven-jaxx-plugin/src/site/rst/index.rst
===================================================================
--- trunk/maven-jaxx-plugin/src/site/rst/index.rst 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/maven-jaxx-plugin/src/site/rst/index.rst 2010-01-07 02:46:32 UTC (rev 1711)
@@ -7,12 +7,13 @@
Introduction
------------
-The plugin permits to generate java files from jaxx files via the `generate`_ goal.
+The plugin permits to generate java files from jaxx files via the **generate** goal.
-You can also generate the java help system via the `generate-help`_ goal and generate search index via
-the `generate-help-search`_ goal.
+You can also generate the java help system via the **generate-helpXXX* goals.
+for more information, consult the `documentation of each mojo`_.
+
Default layout
--------------
@@ -23,7 +24,6 @@
* the generated java files should be under *target/generated-sources/java*
* the java help files should be under *src/main/help*
* the generated help search index should be under *target/generated-sources/help*
-
-.. _generate: generate-mojo.html
-.. _generate-help: generate-help-mojo.html
-.. _generate-help-search: generate-help-search-mojo.html
+
+
+.. _documentation of each mojo: plugin-info.html
Deleted: trunk/maven-jaxx-plugin/src/site/site.xml
===================================================================
--- trunk/maven-jaxx-plugin/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/maven-jaxx-plugin/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <body>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu ref="parent"/>
-
- <menu name="Utilisateur" inherited="top">
- <item name="Accueil" href="index.html"/>
- <item name="Détail goals" href="plugin-info.html">
- <item name="generate" href="generate-mojo.html"/>
- <item name="generate-help" href="generate-help-mojo.html"/>
- <item name="generate-help-search" href="generate-help-search-mojo.html"/>
- <item name="help" href="help-mojo.html"/>
- </item>
- </menu>
-
- <menu name="Développeur" inherit="top">
- <item name="A faire" href="Todo.html"/>
- </menu>
-
- <menu ref="reports"/>
-
- <menu ref="modules"/>
- </body>
-</project>
Copied: trunk/maven-jaxx-plugin/src/site/site_fr.xml (from rev 1706, trunk/maven-jaxx-plugin/src/site/site.xml)
===================================================================
--- trunk/maven-jaxx-plugin/src/site/site_fr.xml (rev 0)
+++ trunk/maven-jaxx-plugin/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top">
+ <item name="Accueil" href="index.html"/>
+ <item name="Détail goals" href="plugin-info.html">
+ <item name="generate" href="generate-mojo.html"/>
+ <item name="generate-help" href="generate-help-mojo.html"/>
+ <item name="generate-help-search" href="generate-help-search-mojo.html"/>
+ <item name="help" href="help-mojo.html"/>
+ </item>
+ </menu>
+
+ <menu name="Développeur" inherit="top">
+ <item name="A faire" href="Todo.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <menu ref="modules"/>
+ </body>
+</project>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/pom.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -362,8 +362,6 @@
<lutinutil.version>1.1.0</lutinutil.version>
<i18n.version>1.0.1</i18n.version>
- <!--<helper.version>1.2.0</helper.version>-->
- <!--<jredmin.version>1.1</jredmin.version>-->
<jxlayer.version>3.0.3</jxlayer.version>
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/src/site/rst/index.rst 2010-01-07 02:46:32 UTC (rev 1711)
@@ -45,6 +45,26 @@
* NavigationTreeModel_
+Who use JAXX ?
+--------------
+
+Here is a list of projects using JAXX :
+
+ * Isis-fish
+
+ * simExplorer-si
+
+ * ObServe
+
+ * Lima
+
+ * Vradi
+
+ * Nuiton-i18n-editor
+
+ TODO Finish this list and add icons and links to site
+
+
.. _Migration: migration.html
.. _Core: Core.html
Deleted: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2010-01-07 02:20:02 UTC (rev 1710)
+++ trunk/src/site/site.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="${project.name}">
-
- <bannerLeft>
- <name>${project.name}</name>
- <src>${site.home.url}/jaxx.png</src>
- <href>index.html</href>
- </bannerLeft>
-
- <poweredBy>
- <logo href="http://maven.apache.org" name="Maven" img="${project.url}/images/logos/maven-feather.png"/>
- <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="${project.url}/images/jrst-logo.png"/>
- <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="${project.url}/images/restructuredtext-logo.png"/>
- </poweredBy>
-
- <body>
- <links>
- <item name="original JAXX" href="http://buix.labs.libre-entreprise.org/original-jaxx"/>
- </links>
-
- <breadcrumbs>
- <item name="${project.name}" href="${project.url}" />
- </breadcrumbs>
-
- <menu name="Utilisateur">
- <item name="Accueil" href="index.html"/>
- <item name="Migration JAXX 2.0" href="migration.html"/>
- </menu>
-
- <menu name="Développeur">
- <item name="A faire" href="Todo.html"/>
- </menu>
-
- <menu ref="modules"/>
-
- <menu ref="reports"/>
- </body>
-</project>
Copied: trunk/src/site/site_fr.xml (from rev 1706, trunk/src/site/site.xml)
===================================================================
--- trunk/src/site/site_fr.xml (rev 0)
+++ trunk/src/site/site_fr.xml 2010-01-07 02:46:32 UTC (rev 1711)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <poweredBy>
+ <logo href="http://maven.apache.org" name="Maven" img="${project.url}/images/logos/maven-feather.png"/>
+ <logo href="http://maven-site.nuiton.org/jrst" name="JRst" img="${project.url}/images/jrst-logo.png"/>
+ <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="${project.url}/images/restructuredtext-logo.png"/>
+ </poweredBy>
+
+ <body>
+ <links>
+ <item name="original JAXX" href="http://buix.labs.libre-entreprise.org/original-jaxx"/>
+ </links>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html" />
+ </breadcrumbs>
+
+ <menu name="Utilisateur">
+ <item name="Accueil" href="index.html"/>
+ <item name="Migration JAXX 2.0" href="migration.html"/>
+ </menu>
+
+ <menu name="Développeur">
+ <item name="A faire" href="Todo.html"/>
+ </menu>
+
+ <menu ref="modules"/>
+
+ <menu ref="reports"/>
+ </body>
+</project>
1
0
Author: tchemit
Date: 2010-01-07 03:20:02 +0100 (Thu, 07 Jan 2010)
New Revision: 1710
Modified:
trunk/jaxx-widgets/pom.xml
trunk/pom.xml
trunk/src/site/rst/JAXXContext.rst
trunk/src/site/rst/NavigationTreeModel.rst
Log:
no more need of swingWorker + reuse the last mavenpom + fix rst
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2010-01-07 00:57:50 UTC (rev 1709)
+++ trunk/jaxx-widgets/pom.xml 2010-01-07 02:20:02 UTC (rev 1710)
@@ -31,10 +31,10 @@
<artifactId>swingx</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swing-worker</artifactId>
- </dependency>
+ </dependency-->
<dependency>
<groupId>commons-io</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-07 00:57:50 UTC (rev 1709)
+++ trunk/pom.xml 2010-01-07 02:20:02 UTC (rev 1710)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.1.3</version>
+ <version>1.1.4-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -250,11 +250,11 @@
<version>1.6</version>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swing-worker</artifactId>
<version>1.1</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>log4j</groupId>
@@ -362,10 +362,10 @@
<lutinutil.version>1.1.0</lutinutil.version>
<i18n.version>1.0.1</i18n.version>
- <helper.version>1.2.0</helper.version>
- <jredmin.version>1.1</jredmin.version>
+ <!--<helper.version>1.2.0</helper.version>-->
+ <!--<jredmin.version>1.1</jredmin.version>-->
- <jxlayer.version>3.0.4</jxlayer.version>
+ <jxlayer.version>3.0.3</jxlayer.version>
<javahelp.version>2.0.02</javahelp.version>
Modified: trunk/src/site/rst/JAXXContext.rst
===================================================================
--- trunk/src/site/rst/JAXXContext.rst 2010-01-07 00:57:50 UTC (rev 1709)
+++ trunk/src/site/rst/JAXXContext.rst 2010-01-07 02:20:02 UTC (rev 1710)
@@ -41,7 +41,7 @@
* *getContextValue(Class)* récupère la donnée *non nommée* dont le type correspond à celui passé.
- * *getContextValue(Class,String)* récupère la donnée nommé dont le type correspond à celui passé.
+ * *getContextValue(Class,String)* récupère la donnée nommée dont le type correspond à celui passé.
Les méthodes d'écriture
***********************
@@ -82,13 +82,13 @@
réellement la donnée, ce qui est important pour conserver la cohérence des contexts dans les contexts chaînés.
Pour traiter le context parent, aucune méthode publique supplémentaire n'a été rajoutée, il suffit d'injecter un objet
-de type *JAXXContext* *non nommé* qui le context courant qui sera détecté comme une entrée de type context.
+de type *JAXXContext* non nommé qui le context courant qui sera détecté comme une entrée de type context.
Cette entrée spéciale ne sera pas stockée avec les autres entrées afin d'optimiser les algorithmes d'injection et de
restitution.
jaxx.runtime.context.JAXXInitialContext
-*******************************
+***************************************
On a implanté un second type de context qui lui peut servir à l'initialisation des JAXXObject.
Modified: trunk/src/site/rst/NavigationTreeModel.rst
===================================================================
--- trunk/src/site/rst/NavigationTreeModel.rst 2010-01-07 00:57:50 UTC (rev 1709)
+++ trunk/src/site/rst/NavigationTreeModel.rst 2010-01-07 02:20:02 UTC (rev 1710)
@@ -35,7 +35,7 @@
Il apporte les nouvelles propriétés suivantes :
- * *navigationPAth* : nom de chemin de navigation de ce noeud.
+ * *navigationPath* : nom de chemin de navigation de ce noeud.
* *jaxxClass* : nom qualifié de la classe d'ui associé à ce noeud (doit être obligatoirement un *JAXXObject*)
1
0
Author: tchemit
Date: 2010-01-07 01:57:50 +0100 (Thu, 07 Jan 2010)
New Revision: 1709
Modified:
trunk/pom.xml
Log:
bumps to stable version + jx libraries
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-04 17:25:05 UTC (rev 1708)
+++ trunk/pom.xml 2010-01-07 00:57:50 UTC (rev 1709)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.1.4-SNAPSHOT</version>
+ <version>1.1.3</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -247,7 +247,7 @@
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
- <version>1.0</version>
+ <version>1.6</version>
</dependency>
<dependency>
@@ -361,16 +361,14 @@
<projectId>jaxx</projectId>
<lutinutil.version>1.1.0</lutinutil.version>
- <i18n.version>1.0.2-SNAPSHOT</i18n.version>
+ <i18n.version>1.0.1</i18n.version>
+ <helper.version>1.2.0</helper.version>
+ <jredmin.version>1.1</jredmin.version>
- <jxlayer.version>3.0.3</jxlayer.version>
+ <jxlayer.version>3.0.4</jxlayer.version>
<javahelp.version>2.0.02</javahelp.version>
- <!-- to include (or not) attached files to redmine file to publish -->
- <!-- will be remove when using mavenpom 1.1.1 -->
- <redmine.includeAttached>false</redmine.includeAttached>
-
</properties>
<build>
1
0
r1708 - in trunk: jaxx-compiler/src/main/java/jaxx/compiler/tags 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/bug184Test
by tchemit@users.nuiton.org 04 Jan '10
by tchemit@users.nuiton.org 04 Jan '10
04 Jan '10
Author: tchemit
Date: 2010-01-04 18:25:05 +0100 (Mon, 04 Jan 2010)
New Revision: 1708
Added:
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug184Test.java
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
Log:
Anomalie #184: Bug dans constructorParams
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-04 16:11:17 UTC (rev 1707)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-01-04 17:25:05 UTC (rev 1708)
@@ -674,9 +674,13 @@
// adds dependencies as a side effect
compiler.preprocessScript(value);
} else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) {
- for (String param : value.split("\\s*,\\s*")) {
- compiler.preprocessScript(param);
- }
+ //fix bug 178 : if a constructor parameter contains a comma
+ // the split will not works.
+ // using this hack will always works :) (but still a hack)
+ compiler.preprocessScript("java.util.Arrays.toString(" + value + ")");
+// for (String param : value.split("\\s*,\\s*")) {
+// compiler.preprocessScript(param);
+// }
} else if (value.startsWith("{") && value.endsWith("}")) {
compiler.preprocessScript(value.substring(1, value.length() - 1));
}
Added: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug184Test.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug184Test.java (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug184Test.java 2010-01-04 17:25:05 UTC (rev 1708)
@@ -0,0 +1,23 @@
+package org.nuiton.jaxx.plugin;
+
+import org.junit.Test;
+
+/**
+ * Created: 4 janv. 2010
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ */
+public class Bug184Test extends JaxxBaseTest {
+
+ @Test
+ public void Bug_184() throws Exception {
+ getMojo().execute();
+ assertNumberJaxxFiles(1);
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug184Test.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml 2010-01-04 17:25:05 UTC (rev 1708)
@@ -0,0 +1,26 @@
+<?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/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>
+ <force>true</force>
+ <verbose>true</verbose>
+ <includes>
+ <value>**/bug184Test/*.jaxx</value>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx 2010-01-04 17:25:05 UTC (rev 1708)
@@ -0,0 +1,13 @@
+<JPanel>
+
+<script>
+
+private static final int[] yo = new int[]{65,66,67};
+
+protected String myMethod(String a, String b, String c) {
+ return "";
+}
+
+</script>
+ <JButton constructorParams='myMethod("a", new String(yo, 1, 2), "c")'/>
+</JPanel>
\ No newline at end of file
1
0
r1707 - trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 04 Jan '10
by tchemit@users.nuiton.org 04 Jan '10
04 Jan '10
Author: tchemit
Date: 2010-01-04 17:11:17 +0100 (Mon, 04 Jan 2010)
New Revision: 1707
Modified:
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
Log:
fix expression
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2010-01-01 17:24:15 UTC (rev 1706)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2010-01-04 16:11:17 UTC (rev 1707)
@@ -47,7 +47,7 @@
/**
* The directory where to create or update help files.
*
- * @parameter expression="${jaxx.outuptHelp}" default-value="${project.basedir}/src/main/help"
+ * @parameter expression="${jaxx.outputHelp}" default-value="${project.basedir}/src/main/help"
* @required
* @since 2.0.0
*/
1
0
Author: tchemit
Date: 2010-01-01 18:24:15 +0100 (Fri, 01 Jan 2010)
New Revision: 1706
Modified:
trunk/maven-jaxx-plugin/pom.xml
Log:
use javadoc configuration from mavenpom
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2010-01-01 16:18:48 UTC (rev 1705)
+++ trunk/maven-jaxx-plugin/pom.xml 2010-01-01 17:24:15 UTC (rev 1706)
@@ -1,6 +1,7 @@
+<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">
-<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>
<!-- ************************************************************* -->
@@ -61,7 +62,7 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
</dependency>
-
+
<!-- pour acceder aux BeansInfos swing via Introspector -->
<dependency>
<groupId>com.sun</groupId>
@@ -77,7 +78,7 @@
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
</dependency>
-
+
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
@@ -129,366 +130,18 @@
</execution>
</executions>
</plugin>
-
+
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc.version}</version>
- <configuration>
- <taglets>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
-
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- </taglets>
- </configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
<reporting>
<plugins>
+
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc.version}</version>
- <configuration>
- <taglets>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- </taglets>
- </configuration>
- </plugin>
</plugins>
</reporting>
1
0
Author: tchemit
Date: 2010-01-01 17:18:48 +0100 (Fri, 01 Jan 2010)
New Revision: 1705
Modified:
trunk/pom.xml
Log:
add FIXME to resolve...
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-29 17:45:48 UTC (rev 1704)
+++ trunk/pom.xml 2010-01-01 16:18:48 UTC (rev 1705)
@@ -328,6 +328,12 @@
<artifactId>maven-reporting-api</artifactId>
</exclusion>
+ <!-- FIXME shoudl use the maven-ocre of maven.version...
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ </exclusion-->
+
</exclusions>
</dependency>
1
0