[Buix-commits] r1239 - in jaxx/trunk: jaxx-compiler-api/src/main/java/jaxx jaxx-compiler-api/src/main/java/jaxx/compiler jaxx-compiler-api/src/main/java/jaxx/tags jaxx-compiler-swing/src/main/java/jaxx jaxx-compiler-swing/src/main/java/jaxx/compiler jaxx-compiler-swing/src/main/java/jaxx/tags/swing jaxx-compiler-swing/src/main/resources/META-INF/services jaxx-compiler-validator/src/main/java/jaxx/compiler jaxx-example jaxx-example/src/main/java/jaxx/demo jaxx-example/src/main/resources jaxx-example/src/main
Author: tchemit Date: 2009-02-23 02:06:29 +0000 (Mon, 23 Feb 2009) New Revision: 1239 Added: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx jaxx/trunk/jaxx-example/src/main/resources/icons/ jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx Removed: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java jaxx/trunk/jaxx-example/ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml Log: introduce CompiledObjectDecorator. offer the default implementation, and a boxed one. refactor plugin tests begin nromalisation of classnames (should remove Util, Utils and other to have JaxxUtil, SwingUtil,...) Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -15,6 +15,8 @@ import jaxx.types.TypeManager; import java.awt.Component; +import jaxx.compiler.CompiledObjectDecorator; +import jaxx.compiler.DefaultCompiledObjectDecorator; /** Initializes support for java. */ public class DefaultInitializer implements jaxx.spi.Initializer { @@ -44,5 +46,7 @@ TypeManager.registerTypeConverter(char.class, primitiveConverter); TypeManager.registerTypeConverter(Character.class, primitiveConverter); TypeManager.registerTypeConverter(String.class, primitiveConverter); + + CompiledObjectDecorator.registerDecorator("default", DefaultCompiledObjectDecorator.class); } } \ No newline at end of file Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -83,6 +83,11 @@ /** the type of the override object (can be null if no oveeride) */ private ClassDescriptor overrideType; + /** + * the decorator (if null will use {@link DefaultCompiledObjectDecorator}). + */ + private CompiledObjectDecorator decorator; + public class ChildRef { CompiledObject child; String constraints; @@ -556,24 +561,8 @@ String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : ""; child.setParent(this); - /*String javaCode = child.getJavaCode(); - if (compiler.hasValidator()) { - // some validators are defined on this object - boolean found = compiler.isComponentUsedByValidator(child.getId()); - if (found) { - // box the child component in a JxLayer - javaCode = "jaxx.runtime.Util.boxComponentWithJxLayer(" + javaCode + ")"; - } - }*/ - + childs.add(new ChildRef(child, constraints, child.getJavaCode(), delegateCode)); - /*if (constraints != null) { - appendAdditionCode(this.javaCode + delegateCode + ".add(" + javaCode + ", " + constraints + ");"); - //appendAdditionCode(getJavaCode() + delegateCode + ".add(" + javaCode + ", " + constraints + ");"); - } else { - appendAdditionCode(this.javaCode + delegateCode + ".add(" + javaCode + ");"); - //appendAdditionCode(getJavaCode() + delegateCode + ".add(" + javaCode + ");"); - }*/ } } @@ -636,6 +625,14 @@ return childs; } + public CompiledObjectDecorator getDecorator() { + return decorator; + } + + public void setDecorator(CompiledObjectDecorator decorator) { + this.decorator = decorator; + } + public void finalizeCompiler() { StringBuffer buffer = new StringBuffer(); Added: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java (rev 0) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,76 @@ +package jaxx.compiler; + +import java.util.Map; +import java.util.TreeMap; +import jaxx.CompilerException; + +/** + * + * A class to decorate a compiled object at generation time. + * + * Contains also a cache of decorator in a dictonnary indexed by fqn of decorator. + * + * Use the {@link #getDecorator(java.lang.String)} to obtain the cached decorator. + * + * Note : The implementation of this class must be stateless. + * + * @author tony + * @since 1.2 + */ +public abstract class CompiledObjectDecorator { + + protected static Map<String, CompiledObjectDecorator> cache; + + public static void registerDecorator(String key, Class<? extends CompiledObjectDecorator> klass) { + synchronized (getCache()) { + if (getCache().containsKey(key)) { + throw new IllegalArgumentException("the decorator with key [" + key + "] is already registred! use another key name"); + } + try { + getCache().put(key, klass.newInstance()); + } catch (InstantiationException ex) { + throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); + } catch (IllegalAccessException ex) { + throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); + } + } + } + + public static CompiledObjectDecorator getDecorator(String name) { + CompiledObjectDecorator decorator = getCache().get(name); + if (decorator == null) { + throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getCache().keySet()); + } + return decorator; + } + + public static CompiledObjectDecorator getDecorator(Class<?> type) { + for (CompiledObjectDecorator decorator : getCache().values()) { + if (type == decorator.getClass()) { + return decorator; + } + } + return null; + } + + protected static synchronized Map<String, CompiledObjectDecorator> getCache() { + if (cache == null) { + cache = new TreeMap<String, CompiledObjectDecorator>(); + } + return cache; + } + + public static void reset() { + if (cache != null) { + cache.clear(); + } + } + + public abstract void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName); + + public abstract String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException; + + public abstract boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall); + + public abstract String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings); +} Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -43,6 +43,9 @@ /** a flag to use {@link javax.swing.UIManager} to retreave icons. */ private boolean useUIManagerForIcon; + /** the default compiled object decorator to use if none specifed via decorator attribute */ + private Class<? extends CompiledObjectDecorator> defaultDecoratorClass; + /** * Returns the target directory, generally specified with the "-d" option on the command line. * @@ -270,4 +273,13 @@ public void setValidatorFQN(String validatorFQN) { this.validatorFQN = validatorFQN; } + + public Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass() { + return defaultDecoratorClass; + } + + public void setDefaultDecoratorClass(Class<? extends CompiledObjectDecorator> defaultDecoratorClass) { + this.defaultDecoratorClass = defaultDecoratorClass; + } + } Added: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java (rev 0) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,112 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package jaxx.compiler; + +import java.lang.reflect.Modifier; +import jaxx.CompilerException; +import jaxx.types.TypeManager; + +/** + * The default compiledObjectDecorator. + * + * @author tony + * @since 1.2 + */ +public class DefaultCompiledObjectDecorator extends CompiledObjectDecorator { + + @Override + public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { + + if (!object.isOverride() && !(object instanceof ScriptInitializer)) { + String id = object.getId(); + int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; + if (object == root) { + javaFile.addField(new JavaField(access, fullClassName, id, "this")); + } else { + //TC -20081017 can have generic on compiled Object + javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); + } + } + + if (!compiler.inlineCreation(object) && object != root) { + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); + } + } + + @Override + public String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { + if (object instanceof ScriptInitializer) { + return object.getInitializationCode(compiler); + } + StringBuffer result = new StringBuffer(); + result.append(object.getId()); + result.append(" = "); + if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { + result.append(object.getJavaBeanInitCode()).append(";"); + } else { + String constructorParams = object.getConstructorParams(); + if (constructorParams != null) { + //TC - 20081017 compiledObject can have generics + result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); + //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); + } else { + //TC - 20081017 compiledObject can have generics + result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); + } + } + result.append(JAXXCompiler.getLineSeparator()); + String initCode = object.getInitializationCode(compiler); + if (initCode != null && initCode.length() > 0) { + result.append(initCode); + } + result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); + return result.toString(); + } + + @Override + public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) { + StringBuffer code = new StringBuffer(); + //TC - 20081017 only generate the method if not empty ? + if (object.getId().startsWith("$")) { + code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); + } else { + String additionCode = object.getAdditionCode(); + if (additionCode.length() > 0) { + code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); + additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); + } + } + //code.append(getLineSeparator()); + return code.toString(); + } + + @Override + public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall) { + if (object == root) { + String rootCode = root.getInitializationCode(compiler); + if (rootCode != null && rootCode.length() > 0) { + code.append(rootCode); + code.append(JAXXCompiler.getLineSeparator()); + } + } else { + if (!object.isOverride()) { + if (compiler.inlineCreation(object)) { + if (lastWasMethodCall) { + lastWasMethodCall = false; + code.append(JAXXCompiler.getLineSeparator()); + } + code.append(getCreationCode(compiler, object)); + code.append(JAXXCompiler.getLineSeparator()); + } else { + code.append(object.getCreationMethodName()).append("();"); + code.append(JAXXCompiler.getLineSeparator()); + lastWasMethodCall = true; + } + } + } + return lastWasMethodCall; + } +} Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -222,6 +222,8 @@ /** Maps objects to their ID strings. These are created during the second compilation pass. */ protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>(); + protected CompiledObjectDecorator defaultDecorator; + /*---------------------------------------------------------------------------------*/ /*-- Constructor methods ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ @@ -268,6 +270,11 @@ addImport(extraImport); } } + defaultDecorator = CompiledObjectDecorator.getDecorator(options.getDefaultDecoratorClass()); + if (defaultDecorator == null) { + log.error("could not find default decorator : "+options.getDefaultDecoratorClass()); + throw new IllegalArgumentException("could not find default decorator : " + options.getDefaultDecoratorClass()); + } } /*---------------------------------------------------------------------------------*/ @@ -484,6 +491,10 @@ } objects.put(id, object); ids.put(object, id); + if (object.getDecorator() == null) { + // use compiler decorator + object.setDecorator(defaultDecorator); + } } public CompiledObject getCompiledObject(String id) { Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -23,7 +23,7 @@ /** log */ protected static final Log log = LogFactory.getLog(JAXXCompilerLaunchor.class); - enum LifeCycle { + protected enum LifeCycle { init,// state before compilation compile_first_pass, // state when first pass of compilation compile_second_pass, // state when second pass of compilation @@ -174,6 +174,7 @@ jaxxFileClassNames.clear(); symbolTables.clear(); compilers.clear(); + //CompiledObjectDecorator.reset(); } public String getVersion() { Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -147,7 +147,10 @@ javaFile.setSuperGenericType(compiler.getSuperGenericType()); for (CompiledObject object : compiler.getObjects().values()) { - if (!object.isOverride() && !(object instanceof ScriptInitializer)) { + CompiledObjectDecorator decorator = object.getDecorator(); + decorator.finalizeCompiler(compiler, root, object,javaFile, packageName, className,fullClassName); + + /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) { String id = object.getId(); int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; if (object == root) { @@ -160,7 +163,7 @@ if (!compiler.inlineCreation(object) && object != root) { javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); - } + }*/ } // DataBinding @@ -283,15 +286,6 @@ addEventHandlers(compiler, javaFile); - /*//TODO : move this to jaxx-compiler-swing generator - if (ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.Application").isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) { - // TODO: check for existing main method first - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main", - "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });", - new JavaArgument("String[]", "arg")) - ); - }*/ - } @@ -451,7 +445,12 @@ boolean lastWasMethodCall = false; while (i.hasNext()) { CompiledObject object = i.next(); - if (object != root && !object.isOverride()) { + if (object == root) { + continue; + } + CompiledObjectDecorator decorator = object.getDecorator(); + lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); + /*if (object != root && !object.isOverride()) { if (compiler.inlineCreation(object)) { if (lastWasMethodCall) { lastWasMethodCall = false; @@ -464,13 +463,14 @@ code.append(JAXXCompiler.getLineSeparator()); lastWasMethodCall = true; } - } + }*/ } - String rootCode = root.getInitializationCode(compiler); + root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); + /*String rootCode = root.getInitializationCode(compiler); if (rootCode != null && rootCode.length() > 0) { code.append(rootCode); code.append(JAXXCompiler.getLineSeparator()); - } + }*/ code.append(JAXXCompiler.getLineSeparator()); if (compiler.getInitializer().length() > 0) { code.append(compiler.getInitializer()); @@ -487,7 +487,10 @@ code.append("allComponentsCreated = true;"); code.append(JAXXCompiler.getLineSeparator()); for (CompiledObject object : compiler.getObjects().values()) { - //TC - 20081017 only generate the method if not empty ? + CompiledObjectDecorator decorator = object.getDecorator(); + code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings)); + + /*//TC - 20081017 only generate the method if not empty ? if (object.getId().startsWith("$")) { code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); } else { @@ -497,7 +500,7 @@ additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); } - } + }*/ //code.append(getLineSeparator()); } @@ -559,11 +562,14 @@ /*-- Create methods code ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { +/* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { if (object instanceof ScriptInitializer) { return object.getInitializationCode(compiler); } - StringBuffer result = new StringBuffer(); + CompiledObjectDecorator decorator = object.getDecorator(); + String result = decorator.getCreationCode(compiler, object); + return result;*/ + /*StringBuffer result = new StringBuffer(); result.append(object.getId()); result.append(" = "); if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { @@ -586,7 +592,7 @@ } result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); - return result.toString(); - } + return result.toString();*/ +// } } Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -226,16 +226,6 @@ result.append(lineSeparator).append(lineSeparator); } - /* - java.util.Collections.sort(methods); // sort methods - - for (JavaMethod method : methods) { - result.append(addIndentation(method.toString(), 4)); - result.append(lineSeparator); - result.append(lineSeparator); - } - */ - EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods); for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) { List<JavaMethod> list = entry.getValue(); Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -43,6 +43,7 @@ import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import jaxx.compiler.CompiledObjectDecorator; /** * Default handler for class tags. Class tags are tags which represent instances of Java classes, @@ -512,12 +513,14 @@ } + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { scanAttributesForDependencies(tag, compiler); compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { try { init(); @@ -654,7 +657,7 @@ attributes.add((Attr) children.item(i)); } Collections.sort(attributes, getAttributeComparator()); - + for (Attr attribute : attributes) { String name = attribute.getName(); String value = attribute.getValue().trim(); @@ -711,6 +714,14 @@ continue; } + if (name.equals("decorator")) { + if (!value.isEmpty()) { + CompiledObjectDecorator decorator = CompiledObjectDecorator.getDecorator(value); + object.setDecorator(decorator); + } + continue; + } + if (isEventHandlerName(name)) { // event handler if (!value.endsWith(";")) { @@ -733,6 +744,7 @@ */ protected Comparator<Attr> getAttributeComparator() { return new Comparator<Attr>() { + @Override public int compare(Attr a, Attr b) { int aOrder = getAttributeOrdering(a); int bOrder = getAttributeOrdering(b); Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java =================================================================== --- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -91,6 +91,7 @@ registeredBeans.clear(); registeredTags.clear(); defaultNamespaces.clear(); + CompiledObjectDecorator.reset(); JAXXCompilerLaunchor.loadLibraries(verbose); } Copied: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java (from rev 1237, jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java) =================================================================== --- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java (rev 0) +++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,93 @@ +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx; + +import jaxx.tags.swing.*; +import jaxx.compiler.JAXXCompiler; +import jaxx.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Application; +import jaxx.runtime.swing.JAXXButtonGroup; +import jaxx.runtime.swing.JAXXComboBox; +import jaxx.runtime.swing.JAXXList; +import jaxx.runtime.swing.JAXXTab; +import jaxx.runtime.swing.JAXXTree; +import jaxx.runtime.swing.Table; +import jaxx.spi.Initializer; +import jaxx.tags.DefaultObjectHandler; +import jaxx.tags.TagManager; +import jaxx.types.ColorConverter; +import jaxx.types.GridBagConstraintsConverter; +import jaxx.types.InsetsConverter; +import jaxx.types.KeyStrokeConverter; +import jaxx.types.TypeManager; +import jaxx.beaninfos.BeanInfoUtil; + +import javax.swing.*; +import javax.swing.text.JTextComponent; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import jaxx.compiler.BoxedCompiledObjectDecorator; +import jaxx.compiler.CompiledObjectDecorator; + +public class SwingInitializer implements Initializer { + + public void initialize() { + + BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); + + TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); + + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); + TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class); + TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class))); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class); + TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class))); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class); + + TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*"); + TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*"); + TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*"); + TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*"); + TagManager.registerDefaultNamespace("JTextField", "javax.swing.*"); + TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*"); + + TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class); + TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); + TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); + TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); + + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTab.class), JAXXTabHandler.class); + + TypeManager.registerTypeConverter(Color.class, new ColorConverter()); + TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter()); + TypeManager.registerTypeConverter(Insets.class, new InsetsConverter()); + TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter()); + + CompiledObjectDecorator.registerDecorator("boxed", BoxedCompiledObjectDecorator.class); + } +} \ No newline at end of file Property changes on: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java ___________________________________________________________________ Name: svn:mergeinfo + Added: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java =================================================================== --- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java (rev 0) +++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,26 @@ +package jaxx.compiler; + +import jaxx.compiler.CompiledObject.ChildRef; + +/** + * A decorator to surround a compiled object (should be a component at least) + * with a JXLayer. + * + * @author tony + * @since 1.2 + */ +public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator { + + @Override + public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { + CompiledObject parent = object.getParent(); + for (ChildRef child : parent.getChilds()) { + if (child.getChild() == object) { + String javaCode = child.getChildJavaCode(); + child.setChildJavaCode("jaxx.runtime.SwingUtil.boxComponentWithJxLayer(" + javaCode + ")"); + break; + } + } + super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); + } +} Deleted: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java =================================================================== --- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -1,88 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Application; -import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.runtime.swing.JAXXComboBox; -import jaxx.runtime.swing.JAXXList; -import jaxx.runtime.swing.JAXXTab; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.Table; -import jaxx.spi.Initializer; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; -import jaxx.types.ColorConverter; -import jaxx.types.GridBagConstraintsConverter; -import jaxx.types.InsetsConverter; -import jaxx.types.KeyStrokeConverter; -import jaxx.types.TypeManager; -import jaxx.beaninfos.BeanInfoUtil; - -import javax.swing.*; -import javax.swing.text.JTextComponent; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.Insets; - -public class SwingInitializer implements Initializer { - - public void initialize() { - - BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); - - TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); - TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class); - TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class))); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class); - TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class))); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class); - - TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*"); - TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*"); - - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTab.class), JAXXTabHandler.class); - - TypeManager.registerTypeConverter(Color.class, new ColorConverter()); - TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter()); - TypeManager.registerTypeConverter(Insets.class, new InsetsConverter()); - TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter()); - } -} \ No newline at end of file Modified: jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer =================================================================== --- jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer 2009-02-23 02:06:29 UTC (rev 1239) @@ -1 +1 @@ -jaxx.tags.swing.SwingInitializer \ No newline at end of file +jaxx.SwingInitializer \ No newline at end of file Modified: jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java =================================================================== --- jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -34,7 +34,7 @@ boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId()); if (found) { // box the child component in a JxLayer - child.setChildJavaCode("jaxx.runtime.Util.boxComponentWithJxLayer(" + javaCode + ")"); + child.setChildJavaCode("jaxx.runtime.SwingUtil.boxComponentWithJxLayer(" + javaCode + ")"); } } } Property changes on: jaxx/trunk/jaxx-example ___________________________________________________________________ Name: svn:ignore - target velocity.log + velocity.log target nbactions.xml Added: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx =================================================================== --- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx (rev 0) +++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,56 @@ + +<DemoPanel> + <jaxx.runtime.swing.BlockingLayerUI id='layerUI' + blockIcon='{SwingUtil.createImageIcon("action-block.png")}' + acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' + acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; + @Override + public void actionPerformed(ActionEvent e) { + accept(e, "from icon of layer"); + } + }}' /> + <script><![CDATA[ +import jaxx.runtime.SwingUtil; + +public void setLayer(boolean active) { + for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { + jaxx.runtime.swing.BlockingLayerUI ui = active ? layerUI.clone() : null; + SwingUtil.getLayer(boxed).setUI(ui); + } +} + +protected void accept(ActionEvent e, String suffix) { + JButton source = (JButton) e.getSource(); + String msg = "'" + source.getText() + "' clicked - " + suffix; + ((DefaultListModel)messages.getModel()).addElement(msg); +}]]> + </script> + <Table id='demoPanel' fill='both' weightx='1'> + <row> + <cell> + <JCheckBox id='toggle' selected='true' + text='{toggle.isSelected() ? "Active layer" : "No layer"}' + onActionPerformed='setLayer(toggle.isSelected());'/> + </cell> + </row> + <row> + <cell weighty='0.5'> + <JPanel layout='{new GridLayout(1,3,3,3)}'> + <JButton text='button A' decorator='boxed' + onActionPerformed='accept(event, "from button (no layer)")'/> + <JButton text='button B' decorator='boxed' + onActionPerformed='accept(event, "from button (no layer)")'/> + <JButton text='button C' decorator='boxed' + onActionPerformed='accept(event, "from button (no layer)");'/> + </JPanel> + </cell> + </row> + <row> + <cell weighty='0.5'> + <JScrollPane> + <JList id='messages' model='{new DefaultListModel()}'/> + </JScrollPane> + </cell> + </row> + </Table> +</DemoPanel> \ No newline at end of file Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx =================================================================== --- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,7 +9,7 @@ // init i18n org.codelutin.i18n.I18n.init(); - +boxedDecoratorDemo.setLayer(true); ]]></script> <JSplitPane> <!--JSplitPane dividerLocation='200'--> @@ -73,6 +73,7 @@ <item value='{validationDemo2}'/> </item> <item value='{dataBindingDemo}'/> + <item value='{boxedDecoratorDemo}'/> </item> </JTree> </JScrollPane> @@ -103,6 +104,7 @@ <LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/> <CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/> <CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/> + <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/> </JPanel> </JSplitPane> </Application> \ No newline at end of file Modified: jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties =================================================================== --- jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties 2009-02-23 02:06:29 UTC (rev 1239) @@ -24,6 +24,7 @@ C= CE= Cancel= +Change\ layer\ state= Comments\:= Config\ file\ \:= Config\ file\:= @@ -84,6 +85,10 @@ \\u00f7= adjust\ the\ spacing= between\ these\ lines= +button\ A= +button\ B= +button\ C= +button\ with\ layer= cancel= close= close2= @@ -91,6 +96,7 @@ edit= edit2= edit3= +no\ layer= valid= validator.field=Champ validator.field.tip= @@ -98,4 +104,5 @@ validator.message.tip= validator.scope=... validator.scope.tip= +with\ layer= x= Modified: jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties =================================================================== --- jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties 2009-02-23 02:06:29 UTC (rev 1239) @@ -24,6 +24,7 @@ C= CE= Cancel= +Change\ layer\ state= Comments\:= Config\ file\ \:= Config\ file\:= @@ -84,6 +85,10 @@ \\u00f7= adjust\ the\ spacing= between\ these\ lines= +button\ A= +button\ B= +button\ C= +button\ with\ layer= cancel= close= close2= @@ -91,6 +96,7 @@ edit= edit2= edit3= +no\ layer= valid= validator.field=Champ validator.field.tip= @@ -98,4 +104,5 @@ validator.message.tip= validator.scope=... validator.scope.tip= +with\ layer= x= Added: jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png =================================================================== (Binary files differ) Property changes on: jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png =================================================================== (Binary files differ) Property changes on: jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java =================================================================== --- jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -3,7 +3,6 @@ import jaxx.Base64Coder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.jdesktop.jxlayer.JXLayer; import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; @@ -12,12 +11,7 @@ import javax.swing.JList; import javax.swing.UIManager; import java.awt.Component; -import java.awt.Container; import java.awt.Dimension; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; import java.io.IOException; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationHandler; @@ -27,10 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EventListener; -import java.util.HashMap; -import java.util.LinkedList; import java.util.List; -import java.util.ListIterator; import java.util.Map; import java.util.WeakHashMap; @@ -282,78 +273,6 @@ } /** - * recherche les composants portant le meme nom que les champs de la classe - * clazz. Cette methode est statique pour pouvoir eventuellement l'utiliser - * dans un autre context (je pense par exemple a la generation jaxx). - * <p/> - * <p/> - * Si la recherche echoue pour quelque raison que se soit, aucune exception - * n'est leve, et la map retournee est tout simplement vide ou incomplete - * - * @param clazz la classe ou recherche les champs - * @param container le container ou rechercher les composants d'edition - * @return le dictionnaire des composants recherches. - */ - public static Map<String, JComponent> lookingForEditor(Class clazz, Container container) { - Map<String, JComponent> result = new HashMap<String, JComponent>(); - try { - // looking for all component with name set - Map<String, JComponent> allNamedComponent = new HashMap<String, JComponent>(); - List<Container> todo = new LinkedList<Container>(); - todo.add(container); - while (todo.size() > 0) { - for (ListIterator<Container> i = todo.listIterator(); i.hasNext();) { - Container parent = i.next(); - i.remove(); - for (Component c : parent.getComponents()) { - if (c instanceof Container) { - i.add((Container) c); - String name = c.getName(); - if (c instanceof JComponent && - name != null && !"".equals(name)) { - allNamedComponent.put(name, (JComponent) c); - } - } - } - } - } - - // looking for all properties on class - BeanInfo info = Introspector.getBeanInfo(clazz); - PropertyDescriptor[] props = info.getPropertyDescriptors(); - - // find if one properties have same name that component - for (PropertyDescriptor prop : props) { - String name = prop.getName(); - if (allNamedComponent.containsKey(name)) { - result.put(name, allNamedComponent.get(name)); - } - } - - } catch (IntrospectionException eee) { - log.warn("Can't introspect bean", eee); - } - - if (log.isDebugEnabled()) { - log.debug("Result: " + result); - } - - return result; - } - - /** - * Box a component in a {@link org.jdesktop.jxlayer.JXLayer}. - * - * @param component the component to box - * @return the {@link org.jdesktop.jxlayer.JXLayer} boxing the component - */ - public static JXLayer boxComponentWithJxLayer(JComponent component) { - JXLayer layer = new org.jdesktop.jxlayer.JXLayer(); - layer.add(component); - return layer; - } - - /** * Compute the string representation of an object. * <p/> * Return empty string if given object is null @@ -372,6 +291,7 @@ * <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 @@ -426,6 +346,9 @@ public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) { return new DefaultListCellRenderer() { + + private static final long serialVersionUID = 1L; + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String decorated; Added: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java =================================================================== --- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java (rev 0) +++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,260 @@ +package jaxx.runtime; + +import java.awt.Component; +import java.awt.Container; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.util.List; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import javax.swing.text.AbstractDocument; +import javax.swing.text.JTextComponent; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.ListIterator; +import java.util.Map; +import java.util.Map.Entry; +import javax.swing.JComponent; +import jaxx.runtime.swing.I18nTableCellRenderer; +import jaxx.runtime.swing.Item; +import jaxx.runtime.swing.JAXXComboBox; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.jxlayer.JXLayer; + +/** + * The runtime swing util class with some nice stuff. + * + * Note : Replace previous class jaxx.runtime.swing.Utils in previous versions. + * + * @author tony + * @since 1.2 + */ +public class SwingUtil extends Util { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private final Log log = LogFactory.getLog(SwingUtil.class); + private static Field numReaders; + private static Field notifyingListeners; + + public static void setText(final JTextComponent c, final String text) { + try { + // AbstractDocument deadlocks if we try to acquire a write lock while a read lock is held by the current thread + // If there are any readers, dispatch an invokeLater. This should only happen in the event of circular bindings. + // Similarly, circular bindings can result in an "Attempt to mutate in notification" error, which we deal with + // by checking for the 'notifyingListeners' property. + AbstractDocument document = (AbstractDocument) c.getDocument(); + if (numReaders == null) { + numReaders = AbstractDocument.class.getDeclaredField("numReaders"); + numReaders.setAccessible(true); + } + if (notifyingListeners == null) { + notifyingListeners = AbstractDocument.class.getDeclaredField("notifyingListeners"); + notifyingListeners.setAccessible(true); + } + + if (notifyingListeners.get(document).equals(Boolean.TRUE)) { + return; + } + + if ((Integer) numReaders.get(document) > 0) { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + if (!c.getText().equals(text)) { + c.setText(text); + } + } + }); + return; + } + + String oldText = c.getText(); + if (oldText == null || !oldText.equals(text)) { + c.setText(text); + } + } catch (NoSuchFieldException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (SecurityException e) { + c.setText(text); + } + } + + /** + * Fill a combo box model with some datas, and select after all the given object + * + * @param combo the combo to fill + * @param data data ot inject in combo + * @param select the object to select in combo after reflling his model + */ + public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) { + if (!(combo.getModel() instanceof DefaultComboBoxModel)) { + throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + combo.getModel().getClass()); + } + DefaultComboBoxModel model = (DefaultComboBoxModel) combo.getModel(); + // evince the model + model.removeListDataListener(combo); + model.removeAllElements(); + for (Object o : data) { + model.addElement(o); + } + // attach the model + model.addListDataListener(combo); + model.setSelectedItem(select); + } + + /** + * Fill a combo box model with some datas, and select after all the given object + * + * @param combo the combo to fill + * @param data data ot inject in combo + * @param select the object to select in combo after reflling his model + * @param firstNull add a first null element + */ + public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) { + List<Item> items = new ArrayList<Item>(); + if (firstNull) { + items.add(new Item("null", " ", null, false)); + } + for (Object d : data) { + items.add(new Item(d.toString(), d.toString(), d, d.equals(select))); + } + combo.setItems(items); + } + + public static void fixTableColumnWidth(JTable table, int columnIndex, int width) { + TableColumn column = table.getColumnModel().getColumn(columnIndex); + column.setMaxWidth(width); + column.setMinWidth(width); + column.setWidth(width); + column.setPreferredWidth(width); + } + + public static void setTableColumnEditor(JTable table, int columnIndex, TableCellEditor editor) { + TableColumn column = table.getColumnModel().getColumn(columnIndex); + column.setCellEditor(editor); + } + + public static void setTableColumnRenderer(JTable table, int columnIndex, TableCellRenderer editor) { + TableColumn column = table.getColumnModel().getColumn(columnIndex); + column.setCellRenderer(editor); + } + + public static void setI18nTableHeaderRenderer(JTable table, String... libelles) { + table.getTableHeader().setDefaultRenderer(new I18nTableCellRenderer(table.getTableHeader().getDefaultRenderer(), libelles)); + } + + /** + * Box a component in a {@link org.jdesktop.jxlayer.JXLayer}. + * + * @param component the component to box + * @return the {@link org.jdesktop.jxlayer.JXLayer} boxing the component + */ + public static JXLayer boxComponentWithJxLayer(JComponent component) { + JXLayer layer = getLayer(component); + if (layer != null) { + return layer; + } + layer = new org.jdesktop.jxlayer.JXLayer(); + layer.add(component); + return layer; + } + + public static List<JComponent> getLayeredComponents(JAXXObject object) { + List<JComponent> result = new ArrayList<JComponent>(); + for (Entry<String, Object> child : object.get$objectMap().entrySet()) { + if (JComponent.class.isAssignableFrom(child.getValue().getClass())) { + JComponent comp = (JComponent) child.getValue(); + if (isLayered(comp)) { + result.add(comp); + } + } + } + return result; + } + + public static JXLayer<JComponent> getLayer(JComponent comp) { + if (!isLayered(comp)) { + return null; + } + return (JXLayer<JComponent>) comp.getParent(); + } + + public static boolean isLayered(JComponent comp) { + Container parent = comp.getParent(); + return parent != null && parent instanceof JXLayer; + } + + /** + * recherche les composants portant le meme nom que les champs de la classe + * clazz. Cette methode est statique pour pouvoir eventuellement l'utiliser + * dans un autre context (je pense par exemple a la generation jaxx). + * <p/> + * <p/> + * Si la recherche echoue pour quelque raison que se soit, aucune exception + * n'est leve, et la map retournee est tout simplement vide ou incomplete + * + * @param clazz la classe ou recherche les champs + * @param container le container ou rechercher les composants d'edition + * @return le dictionnaire des composants recherches. + */ + public static Map<String, JComponent> lookingForEditor(Class clazz, Container container) { + Map<String, JComponent> result = new HashMap<String, JComponent>(); + try { + // looking for all component with name set + Map<String, JComponent> allNamedComponent = new HashMap<String, JComponent>(); + List<Container> todo = new LinkedList<Container>(); + todo.add(container); + while (todo.size() > 0) { + for (ListIterator<Container> i = todo.listIterator(); i.hasNext();) { + Container parent = i.next(); + i.remove(); + for (Component c : parent.getComponents()) { + if (c instanceof Container) { + i.add((Container) c); + String name = c.getName(); + if (c instanceof JComponent && + name != null && !"".equals(name)) { + allNamedComponent.put(name, (JComponent) c); + } + } + } + } + } + + // looking for all properties on class + BeanInfo info = Introspector.getBeanInfo(clazz); + PropertyDescriptor[] props = info.getPropertyDescriptors(); + + // find if one properties have same name that component + for (PropertyDescriptor prop : props) { + String name = prop.getName(); + if (allNamedComponent.containsKey(name)) { + result.put(name, allNamedComponent.get(name)); + } + } + + } catch (IntrospectionException eee) { + log.warn("Can't introspect bean", eee); + } + + if (log.isDebugEnabled()) { + log.debug("Result: " + result); + } + + return result; + } +} Added: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java =================================================================== --- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java (rev 0) +++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,179 @@ +package jaxx.runtime.swing; + +import java.awt.Component; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import javax.swing.Action; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import org.jdesktop.jxlayer.JXLayer; + +/** + * + * A JXLayer ui implementation that permits to block a component but still + * allow an action when clicking on the right-top icon painted on the layer. + * + * You can change the blocking and accepting icon. + * + * To hook an click on the layer's icon, you can : + * + * <ul><li>pass an Action via method {@link #setAcceptAction(Action)}</li> + * <li>override the method {@link #acceptEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer)}</li> + * </ul> + * + * @author tony + * @since 1.2 + */ +public class BlockingLayerUI extends org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent> { + + public static final String CAN_CLICK_PROPERTY = "canClick"; + public static final String ACCEPT_ICON_PROPERTY = "acceptIcon"; + public static final String BLOCK_ICON_PROPERTY = "blockIcon"; + private static final long serialVersionUID = 1L; + /** + * Action to be treated when click on icon + */ + protected Action acceptAction; + /** + * Icon when you can not click + */ + protected BufferedImage blockIcon; + /** + * Icon when you can click + */ + protected BufferedImage acceptIcon; + /** + * Internal state to known when we can accept click + */ + protected boolean canClick; + + public void setAcceptAction(Action acceptAction) { + this.acceptAction = acceptAction; + } + + public void setAcceptIcon(ImageIcon acceptIcon) { + this.acceptIcon = prepareIcon(acceptIcon); + firePropertyChange(ACCEPT_ICON_PROPERTY, null, acceptIcon); + setDirty(true); + } + + public void setBlockIcon(ImageIcon blockIcon) { + this.blockIcon = prepareIcon(blockIcon); + firePropertyChange(BLOCK_ICON_PROPERTY, null, blockIcon); + setDirty(true); + } + + public void setCanClick(boolean canClick) { + boolean oldvalue = this.canClick; + this.canClick = canClick; + firePropertyChange(CAN_CLICK_PROPERTY, oldvalue, canClick); + if (oldvalue != canClick) { + setDirty(true); + } + } + + public BufferedImage getBlockIcon() { + return blockIcon; + } + + protected BufferedImage getAcceptIcon() { + return acceptIcon; + } + + public boolean isCanClick() { + return canClick; + } + + @Override + public BlockingLayerUI clone() { + BlockingLayerUI clone = new BlockingLayerUI(); + clone.acceptAction = acceptAction; + clone.acceptIcon = acceptIcon; + clone.blockIcon = blockIcon; + clone.setCanClick(false); + return clone; + } + + @Override + protected void processKeyEvent(KeyEvent e, JXLayer<JComponent> l) { + e.consume(); + } + + @Override + protected void processMouseMotionEvent(MouseEvent e, JXLayer<JComponent> l) { + updateCanClickState(l, e); + e.consume(); + } + + @Override + protected void processMouseEvent(MouseEvent e, JXLayer<JComponent> l) { + + switch (e.getID()) { + case MouseEvent.MOUSE_ENTERED: + updateCanClickState(l, e); + break; + case MouseEvent.MOUSE_EXITED: + setCanClick(false); + break; + case MouseEvent.MOUSE_CLICKED: + if (canClick) { + acceptEvent(e, l); + } + break; + } + e.consume(); + } + + @Override + protected void paintLayer(Graphics2D g2, JXLayer<JComponent> l) { + super.paintLayer(g2, l); + if (getCurrentIcon() != null) { + g2.drawImage(getCurrentIcon(), l.getWidth() - getCurrentIcon().getWidth() - 1, 0, null); + } + } + + protected void acceptEvent(MouseEvent e, JXLayer<JComponent> l) { + if (acceptAction != null) { + acceptAction.putValue("layer", l); + Component source = l.getView(); + acceptAction.actionPerformed(new ActionEvent(source, 0, "accept")); + } + } + + protected BufferedImage getCurrentIcon() { + return canClick ? acceptIcon : blockIcon; + } + + protected BufferedImage prepareIcon(ImageIcon image) { + BufferedImage icon = new BufferedImage(image.getIconWidth(), image.getIconHeight(), BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = (Graphics2D) icon.getGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); + g2.drawImage(image.getImage(), 0, 0, null); + g2.dispose(); + return icon; + } + + protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) { + // udpate toolTipText + Point layerLocation = l.getView().getLocation(); + Point mousePoint = e.getPoint(); + BufferedImage currentIcon = getCurrentIcon(); + if (currentIcon == null) { + setCanClick(false); + return; + } + int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); + int maxX = (int) layerLocation.getX() + l.getWidth(); + int minY = 0; + int maxY = currentIcon.getHeight(); + boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; + accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; + setCanClick(accept); + } +} Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java =================================================================== --- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -6,7 +6,6 @@ import java.util.List; import javax.swing.DefaultComboBoxModel; -import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.SwingUtilities; @@ -18,13 +17,18 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; -import jaxx.runtime.swing.Item; - +/** + * + * @author tony + * @deprecatedwill remove in release 1.2, prefer use the {@link jaxx.runtime.SwingUtil} class. + * + */ public class Utils { private static Field numReaders; private static Field notifyingListeners; + @Deprecated public static void setText(final JTextComponent c, final String text) { try { // AbstractDocument deadlocks if we try to acquire a write lock while a read lock is held by the current thread @@ -73,47 +77,13 @@ } /** - * @param path icones from path /icons - * @return the icone - * @deprecated prefer use {@link jaxx.runtime.Util#createImageIcon(String)} - */ - @Deprecated - public static ImageIcon createImageIcon(String path) { - java.net.URL imgURL = Utils.class.getResource("/icons/" + path); - if (imgURL != null) { - return new ImageIcon(imgURL); - } else { - throw new IllegalArgumentException("could not find icon " + path); - } - } - - /** - * @param name icones from path /icons/action-xx.png - * @return the icone - * @deprecated prefer use {@link jaxx.runtime.Util#createActionIcon(String)} - */ - @Deprecated - public static ImageIcon createActionIcon(String name) { - return createImageIcon("action-" + name + ".png"); - } - - /** - * @param name icones from path /icons/i18n/xx-.png icones - * @return the icone - * @deprecated prefer use {@link jaxx.runtime.Util#createI18nIcon(String)} - */ - @Deprecated - public static ImageIcon createI18nIcon(String name) { - return createImageIcon("i18n/" + name + ".png"); - } - - /** * Fill a combo box model with some datas, and select after all the given object * * @param combo the combo to fill * @param data data ot inject in combo * @param select the object to select in combo after reflling his model */ + @Deprecated public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) { if (!(combo.getModel() instanceof DefaultComboBoxModel)) { throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + combo.getModel().getClass()); @@ -138,6 +108,7 @@ * @param select the object to select in combo after reflling his model * @param firstNull add a first null element */ + @Deprecated public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) { List<Item> items = new ArrayList<Item>(); if (firstNull) @@ -147,7 +118,7 @@ } combo.setItems(items); } - + @Deprecated public static void fixTableColumnWidth(JTable table, int columnIndex, int width) { TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setMaxWidth(width); @@ -155,17 +126,17 @@ column.setWidth(width); column.setPreferredWidth(width); } - + @Deprecated public static void setTableColumnEditor(JTable table, int columnIndex, TableCellEditor editor) { TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setCellEditor(editor); } - + @Deprecated public static void setTableColumnRenderer(JTable table, int columnIndex, TableCellRenderer editor) { TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setCellRenderer(editor); } - + @Deprecated public static void setI18nTableHeaderRenderer(JTable table, String... libelles) { table.getTableHeader().setDefaultRenderer(new I18nTableCellRenderer(table.getTableHeader().getDefaultRenderer(), libelles)); } Modified: jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java =================================================================== --- jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -1,7 +1,5 @@ package jaxx.runtime.validator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.BeforeClass; @@ -14,9 +12,6 @@ */ public abstract class AbstractValidatorTest extends Assert { - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(AbstractValidatorTest.class); - static protected BeanValidator<ValidatorBean> validator; static protected File basedir; Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java =================================================================== --- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -217,6 +217,7 @@ /** install ui on required components */ public void installUIs() { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { if (uiClass == null) { // use the default one Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java =================================================================== --- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -22,8 +22,8 @@ public AbstractBeanValidatorUI(ValidatorField field) { this.field = field; - if (log.isInfoEnabled()) { - log.info("install " + this + "<field:" + field + ">"); + if (log.isDebugEnabled()) { + log.debug("install " + this + "<field:" + field + ">"); } } Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -45,6 +45,7 @@ import java.util.Arrays; import java.util.List; import java.util.Set; +import jaxx.compiler.CompiledObjectDecorator; /** * Classe permettant de transformer des sources jaxx vers du source java. @@ -237,6 +238,18 @@ * @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS */ protected String defaultErrorUIFQN; + + /** + * the FQN of the ui to use for error notification. + * <p/> + * If not given, will use the one defined in validator + * + * @parameter expression="${jaxx.defaultDecorator}" default-value="jaxx.compiler.DefaultCompiledObjectDecorator" + * + * @see jaxx.compiler.CompiledObjectDecorator + */ + protected String defaultDecoratorFQN; + /** * a flag to use UIManager to retreave icons. * @@ -255,6 +268,7 @@ protected boolean skip = true; private Class<?> defaultErrorUIClass; + private Class<? extends CompiledObjectDecorator> defaultDecoratorClass; protected ClassLoader cl; private Class<? extends JAXXCompiler> compilerClass; @@ -269,10 +283,11 @@ } compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN); - + defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN); + // check the validator class is correct Class.forName(validatorFQN); - + if (defaultErrorUIFQN != null && !defaultErrorUIFQN.trim().isEmpty()) { defaultErrorUIClass = Class.forName(defaultErrorUIFQN); } @@ -309,21 +324,21 @@ } ds.scan(); - String[] files = ds.getIncludedFiles(); + String[] filesFind = ds.getIncludedFiles(); if (verbose) { - getLog().info("jaxx - discover " + files.length + " jaxx file(s). "); + getLog().info("jaxx - discover " + filesFind.length + " jaxx file(s). "); } updater = (MirroredFileUpdater) FileUpdaterHelper.newJaxxFileUpdater(src, outJava); if (force) { // we will regenerate all files - this.files = files; + this.files = filesFind; } else { // filter files List<String> listFiles = new ArrayList<String>(); - for (String file : files) { + for (String file : filesFind) { if (updater.isFileUpToDate(new File(src, file))) { if (verbose) { getLog().info("jaxx - skip file [" + file + "]."); @@ -367,12 +382,14 @@ result.setExtraImports(extraImports); result.setDefaultErrorUI(defaultErrorUIClass); result.setUseUIManagerForIcon(useUIManagerForIcon); + result.setDefaultDecoratorClass(defaultDecoratorClass); if (cl != null) { result.setClassLoader(cl); } return result; } + @Override public void execute() throws MojoExecutionException, MojoFailureException { try { @@ -492,13 +509,13 @@ getLog().info("will generate " + file); } - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - getLog().info(cl.toString()); - if (cl.getClass().getSimpleName().equals("RealmClassLoader")) { + ClassLoader threadLoader = Thread.currentThread().getContextClassLoader(); + getLog().info(threadLoader.toString()); + if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) { try { - java.lang.reflect.Method m = cl.getClass().getDeclaredMethod("getURLs"); + java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs"); m.setAccessible(true); - URL[] urls = (URL[]) m.invoke(cl); + URL[] urls = (URL[]) m.invoke(threadLoader); for (URL url : urls) { getLog().info("url in class loader " + url); Added: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java (rev 0) +++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,11 @@ +package org.codelutin.jaxx; + +public class DecoratorTest extends JaxxBaseTest { + + public void testDecorator() throws Exception { + mojo.execute(); + assertNumberJaxxFiles(1); + checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true); + } + +} \ No newline at end of file Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-02-23 02:06:29 UTC (rev 1239) @@ -34,6 +34,7 @@ mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName(); mojo.compilerFQN = jaxx.compiler.SwingCompiler.class.getName(); mojo.validatorFQN = jaxx.runtime.validator.swing.SwingValidator.class.getName(); + mojo.defaultDecoratorFQN = jaxx.compiler.DefaultCompiledObjectDecorator.class.getName(); assertNotNull(mojo); } Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <verbose>true</verbose> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <verbose>true</verbose> <resetAfterCompile>false</resetAfterCompile> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/it-1751/java</outJava> - <outResource>${basedir}/target/it-generated-source/it-1751/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <i18nable>true</i18nable> <force>true</force> <verbose>true</verbose> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <i18nable>false</i18nable> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/ClassReferences/*.jaxx</value> Added: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml (rev 0) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <build> + <plugins> + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/src/test/resources</src> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <force>true</force> + <addLogger>false</addLogger> + <includes> + <value>**/decorator/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <jaxxContextImplementorClass>java.lang.String</jaxxContextImplementorClass> <force>true</force> </configuration> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/errors/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/force/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <i18nable>true</i18nable> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <i18nable>true</i18nable> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <i18nable>true</i18nable> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/Initializers/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/InnerClasses/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <addLogger>false</addLogger> <includes> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/OverridingDataBindings/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/Script/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/SpecialSubclassing/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/validator/errors/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> <value>**/validator/ok/*.jaxx</value> Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-02-21 18:17:21 UTC (rev 1238) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-02-23 02:06:29 UTC (rev 1239) @@ -9,8 +9,8 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/src/test/resources</src> - <outJava>${basedir}/target/it-generated-source/java</outJava> - <outResource>${basedir}/target/it-generated-source/resources</outResource> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <addLogger>true</addLogger> <includes> Added: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx =================================================================== --- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx (rev 0) +++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx 2009-02-23 02:06:29 UTC (rev 1239) @@ -0,0 +1,3 @@ +<JPanel id='root'> + <JButton id='boxedButton' decorator='boxed'/> +</JPanel>
participants (1)
-
tchemit@users.labs.libre-entreprise.org