Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 3898 discussions
r1613 - branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:54:21 +0100 (Wed, 28 Oct 2009)
New Revision: 1613
Removed:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
Log:
remove binding from jaxx.compiler package
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-28 07:51:37 UTC (rev 1612)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-28 07:54:21 UTC (rev 1613)
@@ -1,119 +0,0 @@
-/*
- * *##%
- * JAXX Compiler
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-package jaxx.compiler;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Represents a data binding in a JAXX file. <code>DataBinding</code> uses
- * {@link DataSource} to track changes to a source expression and update
- * the destination.
- */
-public class DataBinding {
-
- /**
- * Logger
- */
- protected static final Log log = LogFactory.getLog(DataBinding.class);
- /**
- * Id of the data binding
- */
- private String id;
- /**
- * source of the data binding
- */
- private String source;
- /**
- * A Java snippet which will cause the destination property to be updated with the current value of
- * the binding.
- */
- private String assignment;
-
- /**
- * Creates a new data binding.
- *
- * @param source the Java source code for the data binding expression
- * @param dest the data binding destination in the form <code><id>.<propertyName></code>
- * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding
- */
- public DataBinding(String source, String dest, String assignment) {
- this.id = dest;
- this.source = source;
- this.assignment = assignment;
- if (log.isDebugEnabled()) {
- log.debug("id=" + id + " assignement=" + assignment + " source=" + source);
- }
- }
-
- public String getId() {
- return id;
- }
-
- /**
- * Compiles the data binding expression. This method calls methods in
- * <code>JAXXCompiler</code> to add the Java code that performs the data
- * binding setup.
- *
- * @param compiler compiler which includes the data binding
- * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time
- * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
- * @throws CompilerException if a compilation error occurs
- */
- public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException {
-
- DataSource dataSource = new DataSource(id, source, compiler);
-
- // handles all of the listener additions
- //TC-20091026 use 'this' instead of root object javaCode
-// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")");
- boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")");
-
- String eol = JAXXCompiler.getLineSeparator();
- if (!result && quickNoDependencies) {
- // layout is specially handled early in the chain
- if (!id.endsWith(".layout")) {
- compiler.appendInitDataBindings(assignment + eol);
- }
- return false; // no dependencies, just a static expression
- }
- if (compiler.hasProcessDataBinding()) {
- compiler.appendProcessDataBinding(" else ");
- } else {
- compiler.appendProcessDataBinding(" ");
- }
- compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol);
- String objectCode = dataSource.getObjectCode();
- //TC-20091026 no need to test objectCode not null if on root object
-// boolean needTest = objectCode != null;
- boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
- if (needTest) {
- compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol);
- compiler.appendProcessDataBinding(" ");
- }
- compiler.appendProcessDataBinding(" " + assignment.trim());
- if (needTest) {
- compiler.appendProcessDataBinding(eol + " }");
- }
- compiler.appendProcessDataBinding(eol + " }");
- return true;
- }
-}
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-28 07:51:37 UTC (rev 1612)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-28 07:54:21 UTC (rev 1613)
@@ -1,485 +0,0 @@
-/*
- * *##%
- * JAXX Compiler
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-package jaxx.compiler;
-
-import jaxx.compiler.java.JavaField;
-import jaxx.compiler.java.parser.JavaParser;
-import jaxx.compiler.java.parser.JavaParserConstants;
-import jaxx.compiler.java.parser.JavaParserTreeConstants;
-import jaxx.compiler.java.parser.SimpleNode;
-import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-import jaxx.compiler.reflect.FieldDescriptor;
-import jaxx.compiler.reflect.MethodDescriptor;
-import jaxx.compiler.tags.DefaultObjectHandler;
-import jaxx.compiler.tags.TagManager;
-import jaxx.compiler.types.TypeManager;
-
-import java.beans.Introspector;
-import java.beans.PropertyChangeListener;
-import java.io.StringReader;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be
- * determined that its value may have changed. Events are fired on a "best effort" basis, and events
- * may either be fired too often (the value has not actually changed) or not often enough (the value
- * changed but no event was fired).
- */
-public class DataSource {
-
- /**
- * type attached to "null" constants in parsed expressions
- */
- private class NULL {
- }
- /**
- * id of data source
- */
- private String id;
- /**
- * The Java source code for the expression.
- */
- private String source;
- /**
- * The current <code>JAXXCompiler</code>.
- */
- private JAXXCompiler compiler;
- /**
- * List of symbols which this data source expression depends on.
- */
- private List<String> dependencySymbols = new ArrayList<String>();
- /**
- *
- */
- private StringBuffer addListenerCode = new StringBuffer();
- /**
- *
- */
- private StringBuffer removeListenerCode = new StringBuffer();
- /**
- *
- */
- private boolean compiled;
- /**
- * the delegate of property to be required
- */
- private String objectCode;
-
- /**
- * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile}
- * to cause it to function at runtime.
- *
- * @param id the DataSource's id
- * @param source the Java source code for the data source expression
- * @param compiler the current <code>JAXXCompiler</code>
- */
- public DataSource(String id, String source, JAXXCompiler compiler) {
- this.id = id;
- this.source = source;
- this.compiler = compiler;
- }
-
- public String getId() {
- return id;
- }
-
- public String getSource() {
- return source;
- }
-
- public String getObjectCode() {
- return objectCode;
- }
-
- /**
- * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code>
- * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is
- * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile
- * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this
- * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener.
- *
- * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code>
- * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
- * @throws CompilerException if a compilation error occurs
- * @throws IllegalStateException if data source was already compiled
- */
- public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException {
- if (compiled) {
- throw new IllegalStateException(this + " has already been compiled");
- }
- String autoId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass()));
- JavaParser p = new JavaParser(new StringReader(source + ";"));
- while (!p.Line()) {
- SimpleNode node = p.popNode();
- scanNode(node, autoId);
- }
-
- if (dependencySymbols.size() > 0) {
- //TC 20081108 prefer add a real JavaField instead of raw code
- //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n");
- compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode));
- }
-
- compileListeners();
- compiled = true;
-
- return dependencySymbols.size() > 0;
- }
-
- /** @return a list of symbols on which this data source depends. */
- public Collection<String> getDependencies() {
- return Collections.unmodifiableList(dependencySymbols);
- }
-
- /**
- * Examines a node to identify any dependencies it contains.
- *
- * @param node node to scan
- * @param listenerId id of listener
- * @throws CompilerException ?
- */
- private void scanNode(SimpleNode node, String listenerId) throws CompilerException {
- switch (node.getId()) {
- case JavaParserTreeConstants.JJTMETHODDECLARATION:
- break;
- case JavaParserTreeConstants.JJTFIELDDECLARATION:
- break;
-
- default:
- int count = node.jjtGetNumChildren();
- for (int i = 0; i < count; i++) {
- scanNode(node.getChild(i), listenerId);
- }
- determineNodeType(node, listenerId);
- }
- }
-
- private ClassDescriptor determineLiteralType(SimpleNode node) {
- assert node.getId() == JavaParserTreeConstants.JJTLITERAL;
- if (node.jjtGetNumChildren() == 1) {
- int childId = node.getChild(0).getId();
- if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) {
- return ClassDescriptorLoader.getClassDescriptor(boolean.class);
- }
- if (childId == JavaParserTreeConstants.JJTNULLLITERAL) {
- return ClassDescriptorLoader.getClassDescriptor(NULL.class);
- }
- throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]);
- }
- int nodeId = node.firstToken.kind;
- switch (nodeId) {
- case JavaParserConstants.INTEGER_LITERAL:
- if (node.firstToken.image.toLowerCase().endsWith("l")) {
- return ClassDescriptorLoader.getClassDescriptor(long.class);
- }
- return ClassDescriptorLoader.getClassDescriptor(int.class);
- case JavaParserConstants.CHARACTER_LITERAL:
- return ClassDescriptorLoader.getClassDescriptor(char.class);
- case JavaParserConstants.FLOATING_POINT_LITERAL:
- if (node.firstToken.image.toLowerCase().endsWith("f")) {
- return ClassDescriptorLoader.getClassDescriptor(float.class);
- }
- return ClassDescriptorLoader.getClassDescriptor(double.class);
- case JavaParserConstants.STRING_LITERAL:
- return ClassDescriptorLoader.getClassDescriptor(String.class);
- default:
- throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]);
- }
- }
-
- /**
- * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it.
- *
- * @param symbol symbol to scan
- * @param contextClass current class context
- * @param isMethod flag to search a method
- * @param listenerId id of the listener
- * @return the type of the symbol (or null if it could not be determined).
- */
- private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) {
- String[] tokens = symbol.split("\\s*\\.\\s*");
- StringBuffer currentSymbol = new StringBuffer();
- StringBuffer tokensSeenSoFar = new StringBuffer();
- boolean accepted; // if this ends up false, it means we weren't able to figure out
- // which object the method is being invoked on
- boolean recognizeClassNames = true;
- for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) {
- accepted = false;
-
- if (tokensSeenSoFar.length() > 0) {
- tokensSeenSoFar.append('.');
- }
- tokensSeenSoFar.append(tokens[j]);
- if (currentSymbol.length() > 0) {
- currentSymbol.append('.');
- }
- currentSymbol.append(tokens[j]);
-
- if (currentSymbol.indexOf(".") == -1) {
- String memberName = currentSymbol.toString();
- CompiledObject object = compiler.getCompiledObject(memberName);
- if (object != null) {
- contextClass = object.getObjectClass();
- currentSymbol.setLength(0);
- accepted = true;
- recognizeClassNames = false;
- } else {
- try {
- FieldDescriptor field = contextClass.getFieldDescriptor(memberName);
- trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId);
- contextClass = field.getType();
- currentSymbol.setLength(0);
- accepted = true;
- recognizeClassNames = false;
- } catch (NoSuchFieldException e) {
- if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context
- FieldDescriptor[] newFields = compiler.getScriptFields();
- for (FieldDescriptor newField : newFields) {
- if (newField.getName().equals(memberName)) {
- addListener(tokensSeenSoFar.toString(),
- null,
- "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
- "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
- contextClass = newField.getType();
- assert contextClass != null : "script field '" + memberName + "' is defined, but has type null";
- currentSymbol.setLength(0);
- accepted = true;
- recognizeClassNames = false;
- break;
- }
- }
- }
- }
- }
- }
- if (currentSymbol.length() > 0 && recognizeClassNames) {
- contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler);
- if (contextClass != null) {
- currentSymbol.setLength(0);
- //accepted = true;
- //recognizeClassNames = false;
- // TODO: for now we don't handle statics
- return null;
- }
- }
- if (!accepted) {
- return null;
- }
- }
-
- return contextClass;
- }
-
- /**
- * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
- * can be tracked.
- *
- * @param expression the node to scan
- * @param listenerId id of the listener
- * @return the class descriptor of the return type or null
- */
- private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) {
- assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION;
- SimpleNode prefix = expression.getChild(0);
- if (prefix.jjtGetNumChildren() == 1) {
- int type = prefix.getChild(0).getId();
- if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) {
- prefix.setJavaType(prefix.getChild(0).getJavaType());
- } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) // name with no arguments after it
- {
- prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId));
- }
- }
-
- if (expression.jjtGetNumChildren() == 1) {
- return prefix.getJavaType();
- }
-
- ClassDescriptor contextClass = prefix.getJavaType();
- if (contextClass == null) {
- contextClass = compiler.getRootObject().getObjectClass();
- }
- String lastNode = prefix.getText().trim();
-
- for (int i = 1; i < expression.jjtGetNumChildren(); i++) {
- SimpleNode suffix = expression.getChild(i);
- if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) {
- if (suffix.getChild(0).jjtGetNumChildren() == 0) {
- // at the moment only no-argument methods are trackable
- contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId);
- if (contextClass == null) {
- return null;
- }
- int dotPos = lastNode.lastIndexOf(".");
- String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos);
- for (int j = i - 2; j >= 0; j--) {
- code = expression.getChild(j).getText() + code;
- }
- if (code.length() == 0) {
- code = compiler.getRootObject().getJavaCode();
- }
- String methodName = lastNode.substring(dotPos + 1).trim();
- try {
- MethodDescriptor method = contextClass.getMethodDescriptor(methodName);
- trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId);
- return method.getReturnType();
- } catch (NoSuchMethodException e) {
- // happens for methods defined in the current JAXX file via scripts
- String propertyName = null;
- if (methodName.startsWith("is")) {
- propertyName = Introspector.decapitalize(methodName.substring("is".length()));
- } else if (methodName.startsWith("get")) {
- propertyName = Introspector.decapitalize(methodName.substring("get".length()));
- }
- if (propertyName != null) {
- MethodDescriptor[] newMethods = compiler.getScriptMethods();
- for (MethodDescriptor newMethod : newMethods) {
- if (newMethod.getName().equals(methodName)) {
- addListener(compiler.getRootObject().getId(),
- null,
- "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
- "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
- contextClass = newMethod.getReturnType();
- break;
- }
- }
- }
- }
- }
- }
- lastNode = suffix.getText().trim();
- if (lastNode.startsWith(".")) {
- lastNode = lastNode.substring(1);
- }
- }
-
- return null;
- }
-
- private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) {
- if (objectClass.isInterface()) {
- // might be technically possible to track in some cases, but for now
- // we can't create a DefaultObjectHandler for interfaces
- return;
- }
-
- DefaultObjectHandler handler = TagManager.getTagHandler(objectClass);
- try {
- if (handler.isMemberBound(memberName)) {
- addListener(objectCode + "." + memberName + (method ? "()" : ""),
- objectCode,
- handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler),
- handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler));
- }
- } catch (UnsupportedAttributeException e) {
- // ignore -- this is thrown for methods like toString(), for which there is no tracking and
- // no setting support
- }
- }
-
- /**
- * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
- * can be tracked.
- *
- * @param node node to scan
- * @param listenerId the listener id
- */
- private void determineNodeType(SimpleNode node, String listenerId) {
- ClassDescriptor type = null;
- if (node.jjtGetNumChildren() == 1) {
- type = node.getChild(0).getJavaType();
- }
- switch (node.getId()) {
- case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE:
- type = ClassDescriptorLoader.getClassDescriptor(Class.class);
- break;
- case JavaParserTreeConstants.JJTPRIMARYEXPRESSION:
- type = determineExpressionType(node, listenerId);
- break;
- case JavaParserTreeConstants.JJTLITERAL:
- type = determineLiteralType(node);
- break;
- case JavaParserTreeConstants.JJTCASTEXPRESSION:
- type = TagManager.resolveClass(node.getChild(0).getText(), compiler);
- break;
- }
- node.setJavaType(type);
- }
-
- private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) {
- this.objectCode = objectCode;
- //TC-20091026 no need to test objectCode not null if on root object
- boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
-// boolean needTest = objectCode != null;
- if (!dependencySymbols.contains(dependencySymbol)) {
- dependencySymbols.add(dependencySymbol);
- String eol = JAXXCompiler.getLineSeparator();
- addListenerCode.append(eol);
- if (needTest) {
- addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
- addListenerCode.append(" ");
- }
- addListenerCode.append(" ").append(addCode.trim());
- if (needTest) {
- addListenerCode.append(eol).append(" }");
- }
-
- removeListenerCode.append(eol);
- if (needTest) {
- removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
- removeListenerCode.append(" ");
- }
- removeListenerCode.append(" ").append(removeCode.trim());
- if (needTest) {
- removeListenerCode.append(eol).append(" }");
- }
- }
- }
-
- private void compileListeners() {
- String javaCodeId = TypeManager.getJavaCode(id);
- String eol = JAXXCompiler.getLineSeparator();
- if (addListenerCode.length() > 0) {
- if (compiler.hasApplyDataBinding()) {
- compiler.appendApplyDataBinding(" else ");
- }
-// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
- compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {");
- compiler.appendApplyDataBinding(" " + addListenerCode + eol);
- compiler.appendApplyDataBinding("}");
- }
-
- if (removeListenerCode.length() > 0) {
- if (compiler.hasRemoveDataBinding()) {
- compiler.appendRemoveDataBinding(" else ");
- }
-// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
- compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {");
- compiler.appendRemoveDataBinding(" " + removeListenerCode + eol);
- compiler.appendRemoveDataBinding("}");
- }
- }
-}
1
0
r1612 - in branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin: . DataBinding
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:51:37 +0100 (Wed, 28 Oct 2009)
New Revision: 1612
Modified:
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java
Log:
ajout license
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java 2009-10-28 07:44:28 UTC (rev 1611)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java 2009-10-28 07:51:37 UTC (rev 1612)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Maven plugin
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package org.nuiton.jaxx.plugin.DataBinding;
import java.beans.PropertyChangeListener;
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java 2009-10-28 07:44:28 UTC (rev 1611)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java 2009-10-28 07:51:37 UTC (rev 1612)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Maven plugin
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package org.nuiton.jaxx.plugin.DataBinding;
import java.beans.PropertyChangeListener;
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java 2009-10-28 07:44:28 UTC (rev 1611)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java 2009-10-28 07:51:37 UTC (rev 1612)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Maven plugin
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package org.nuiton.jaxx.plugin;
import java.io.IOException;
1
0
r1611 - branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:44:28 +0100 (Wed, 28 Oct 2009)
New Revision: 1611
Removed:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/
Log:
remove a old empty package
1
0
r1610 - branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:42:33 +0100 (Wed, 28 Oct 2009)
New Revision: 1610
Modified:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
Log:
ajout license
Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java 2009-10-28 07:38:25 UTC (rev 1609)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java 2009-10-28 07:42:33 UTC (rev 1610)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package jaxx.runtime.swing.renderer;
import java.awt.Component;
1
0
r1609 - branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:38:25 +0100 (Wed, 28 Oct 2009)
New Revision: 1609
Added:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java
Log:
add multi table decorator
Added: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java 2009-10-28 07:38:25 UTC (rev 1609)
@@ -0,0 +1,85 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package jaxx.runtime.swing.renderer;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import jaxx.runtime.decorator.Decorator;
+import jaxx.runtime.decorator.JXPathDecorator;
+
+/**
+ * A {@link TableCellRenderer} which compute text with the matching decorator
+ * from {@link #decorators} based on the type of value and leave the hand to
+ * the {@link #delegate} to perform the visual renderer.
+ *
+ * @author chemit
+ * @since 2.0.0
+ */
+public class MultiDecoratorTableCelleRenderer implements TableCellRenderer {
+
+ /**
+ * Delegate cell renderer
+ */
+ protected TableCellRenderer delegate;
+ /**
+ * accepted types
+ */
+ protected List<Class<?>> types;
+ /**
+ * decorators for accepted types
+ */
+ protected Decorator<?>[] decorators;
+
+ public MultiDecoratorTableCelleRenderer(JXPathDecorator<?>... decorator) {
+ this(new DefaultTableCellRenderer(), decorator);
+ }
+
+ public MultiDecoratorTableCelleRenderer(TableCellRenderer delegate, JXPathDecorator<?>... decorator) {
+ this.delegate = delegate;
+
+ this.types = new ArrayList<Class<?>>();
+ List<Decorator<?>> tmp = new ArrayList<Decorator<?>>();
+ for (JXPathDecorator<?> d : decorator) {
+ if (types.contains(d.getInternalClass())) {
+ throw new IllegalArgumentException("can not have twice a decorator of type " + d.getInternalClass());
+ }
+ types.add(d.getInternalClass());
+ tmp.add(d);
+ }
+ decorators = tmp.toArray(new Decorator<?>[tmp.size()]);
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) {
+ if (value != null) {
+ int i = types.indexOf(value.getClass());
+ if (i != -1) {
+ Decorator<?> d = decorators[i];
+ value = d.toString(value);
+ }
+ }
+ return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0
r1608 - in branches/jaxx-2.X/jaxx-demo/src/main: java/jaxx/demo/component/jaxx/editor java/jaxx/demo/component/swing java/jaxx/demo/feature/validation java/jaxx/demo/fun resources/i18n
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:29:27 +0100 (Wed, 28 Oct 2009)
New Revision: 1608
Modified:
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
Log:
update demo from changes in compiler and runtime
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx 2009-10-28 07:29:27 UTC (rev 1608)
@@ -79,7 +79,7 @@
<row>
<cell>
<JLabel border='{new TitledBorder(_("jaxxdemo.i18neditor.selected.locale"))}'
- text='{editor.getSelectedLocale()}'/>
+ text='{editor.getSelectedLocale().toString()}'/>
</cell>
</row>
</Table>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx 2009-10-28 07:29:27 UTC (rev 1608)
@@ -43,7 +43,7 @@
</cell>
<cell>
- <JButton text='{jaxxComboBox.getSelectedItem()}'/>
+ <JButton text='{String.valueOf(jaxxComboBox.getSelectedItem())}'/>
</cell>
</row>
<row>
@@ -58,7 +58,7 @@
</cell>
<cell>
- <JButton text='{comboBox.getSelectedItem()}'/>
+ <JButton text='{comboBox.getSelectedItem()+""}'/>
</cell>
</row>
</Table>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2009-10-28 07:29:27 UTC (rev 1608)
@@ -21,7 +21,7 @@
<jaxx.demo.DemoPanel>
<style source="Validation.css"/>
-<script><![CDATA[
+ <script><![CDATA[
import static org.nuiton.i18n.I18n.n_;
import jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer;
@@ -32,7 +32,7 @@
return new String[]{ getDefaultSource(), "Validation.css", "Model.java", "Identity.java" };
}
]]>
-</script>
+ </script>
<!-- models -->
<Model id='model1'/>
<Model id='model2'/>
@@ -92,7 +92,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JSlider id='ratio' minimum='0' maximum='100'
+ <JSlider id='ratio' minimum='0' maximum='100'
value='{model1.getRatio()}'
_validatorLabel='{n_("form.ratio")}'
onStateChanged='model1.setRatio(ratio.getValue())'/>
@@ -127,7 +127,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JLabel text='{model1.getRatio()}'/>
+ <JLabel text='{model1.getRatio()+""}'/>
</cell>
</row>
</Table>
@@ -165,7 +165,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JSlider id='_ratio' minimum='0' maximum='100'
+ <JSlider id='_ratio' minimum='0' maximum='100'
value='{model2.getRatio()}'
_validatorLabel='{n_("form2.ratio")}'
onStateChanged='model2.setRatio(_ratio.getValue())'/>
@@ -200,7 +200,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JLabel text='{model2.getRatio()}'/>
+ <JLabel text='{model2.getRatio()+""}'/>
</cell>
</row>
</Table>
@@ -254,7 +254,7 @@
<JLabel text='Config file :'/>
</cell>
<cell>
- <JTextField id='config' text='{identity.getConfig()}'
+ <JTextField id='config' text='{identity.getConfig()+""}'
onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/>
</cell>
</row>
@@ -263,7 +263,7 @@
<JLabel text='Working directory:'/>
</cell>
<cell>
- <JTextField id='dir' text='{identity.getDir()}'
+ <JTextField id='dir' text='{identity.getDir()+""}'
onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/>
</cell>
</row>
@@ -303,7 +303,7 @@
<JLabel text='Age:'/>
</cell>
<cell>
- <JLabel text='{identity.getAge()}'/>
+ <JLabel text='{identity.getAge()+""}'/>
</cell>
</row>
<row>
@@ -311,7 +311,7 @@
<JLabel text='Config file:'/>
</cell>
<cell>
- <JLabel text='{identity.getConfig()}'/>
+ <JLabel text='{identity.getConfig()+""}'/>
</cell>
</row>
<row>
@@ -319,7 +319,7 @@
<JLabel text='Directory file:'/>
</cell>
<cell>
- <JLabel text='{identity.getDir()}'/>
+ <JLabel text='{identity.getDir()+""}'/>
</cell>
</row>
</Table>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2009-10-28 07:29:27 UTC (rev 1608)
@@ -133,7 +133,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JLabel text='{model1.getRatio()}'/>
+ <JLabel text='{model1.getRatio()+""}'/>
</cell>
</row>
</Table>
@@ -206,7 +206,7 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JLabel text='{model2.getRatio()}'/>
+ <JLabel text='{model2.getRatio()+""}'/>
</cell>
</row>
</Table>
@@ -260,7 +260,7 @@
<JLabel text='Config file :'/>
</cell>
<cell>
- <JTextField id='config' text='{identity.getConfig()}'
+ <JTextField id='config' text='{identity.getConfig()+""}'
onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/>
</cell>
</row>
@@ -269,7 +269,7 @@
<JLabel text='Working directory:'/>
</cell>
<cell>
- <JTextField id='dir' text='{identity.getDir()}'
+ <JTextField id='dir' text='{identity.getDir()+""}'
onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/>
</cell>
</row>
@@ -309,7 +309,7 @@
<JLabel text='Age:'/>
</cell>
<cell>
- <JLabel text='{identity.getAge()}'/>
+ <JLabel text='{identity.getAge()+""}'/>
</cell>
</row>
<row>
@@ -317,7 +317,7 @@
<JLabel text='Config file:'/>
</cell>
<cell>
- <JLabel text='{identity.getConfig()}'/>
+ <JLabel text='{identity.getConfig()+""}'/>
</cell>
</row>
<row>
@@ -325,7 +325,7 @@
<JLabel text='Directory file:'/>
</cell>
<cell>
- <JLabel text='{identity.getDir()}'/>
+ <JLabel text='{identity.getDir()+""}'/>
</cell>
</row>
</Table>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx 2009-10-28 07:29:27 UTC (rev 1608)
@@ -21,7 +21,7 @@
<jaxx.demo.DemoPanel>
<script>int count;</script>
<JPanel id='demoPanel'>
- <JTextField text='{count}' constraints='BorderLayout.NORTH'/>
+ <JTextField text='{count+""}' constraints='BorderLayout.NORTH'/>
<HBox constraints='BorderLayout.SOUTH'>
<JButton text='Dec (-)' onActionPerformed='count--'/>
<JButton text='Reset' onActionPerformed='count = 0'/>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-10-28 07:29:27 UTC (rev 1608)
@@ -42,6 +42,7 @@
First\ Name\:=
FirstName\:=
Font\ size=
+Font\ size\:\ =
Fool\ me\ once=
Fool\ me\ twice=
Green=
@@ -81,6 +82,7 @@
Supported\ Swing\ components\:=
Text2\:=
Text\:=
+Total\:\ =
Underline=
Upper\ case\ text\:=
Use\ the\ spinner\ to=
@@ -90,6 +92,7 @@
Welcome\ to\ the\ JAXX\ framework\!=
Working\ directory\:=
Yellow=
+You\ entered\:\ =
Your\ name\:=
\\u00f7=
actors=
Modified: branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-10-28 07:20:17 UTC (rev 1607)
+++ branches/jaxx-2.X/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-10-28 07:29:27 UTC (rev 1608)
@@ -42,6 +42,7 @@
First\ Name\:=Pr\u00E9nom
FirstName\:=Pr\u00E9nom \:
Font\ size=Taille de la police
+Font\ size\:\ =
Fool\ me\ once=
Fool\ me\ twice=
Green=Vert
@@ -81,6 +82,7 @@
Supported\ Swing\ components\:=Composants Swing support\u00E9s
Text2\:=Text 2
Text\:=Texte \:
+Total\:\ =
Underline=soulign\u00E9
Upper\ case\ text\:=Texte en majuscule
Use\ the\ spinner\ to=Utiliser la jauge pour
@@ -90,6 +92,7 @@
Welcome\ to\ the\ JAXX\ framework\!=Bienvenu dans le framework JAXX
Working\ directory\:=R\u00E9pertoire de travail
Yellow=Jaune
+You\ entered\:\ =
Your\ name\:=Votre nom \:
\\u00f7=
actors=Acteurs
1
0
Author: tchemit
Date: 2009-10-28 08:20:17 +0100 (Wed, 28 Oct 2009)
New Revision: 1607
Added:
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/log4j.properties
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml
Modified:
branches/jaxx-2.X/maven-jaxx-plugin/pom.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml
Log:
- ajout test sur bindings
- les fichiers generes sont dans target/generated-sources
Modified: branches/jaxx-2.X/maven-jaxx-plugin/pom.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/pom.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/pom.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -129,7 +129,7 @@
</execution>
</executions>
</plugin>
-
+
</plugins>
<pluginManagement>
@@ -491,5 +491,5 @@
</plugin>
</plugins>
</reporting>
-
-</project>
\ No newline at end of file
+
+</project>
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,16 @@
+package org.nuiton.jaxx.plugin.DataBinding;
+
+import java.beans.PropertyChangeListener;
+
+public interface Bean {
+
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
+
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
+
+ String getText();
+}
Property changes on: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,38 @@
+package org.nuiton.jaxx.plugin.DataBinding;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+public class BeanImpl {
+
+ protected String text;
+ PropertyChangeSupport p;
+
+ public BeanImpl() {
+ p = new PropertyChangeSupport(this);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ p.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ p.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ p.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ p.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
Property changes on: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,33 @@
+package org.nuiton.jaxx.plugin;
+
+import java.io.IOException;
+import org.junit.Test;
+
+/**
+ *
+ * @author chemit
+ * @since 2.0.0
+ */
+public class DataBindingTest extends JaxxBaseTest {
+
+ @Test
+ public void simpleBinding() throws Exception {
+
+ GenerateMojo mojo = getMojo();
+ mojo.execute();
+ assertNumberJaxxFiles(1);
+
+ // no bindings
+ checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding1.text\");", false);
+ checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding2.text\");", false);
+
+ // with bindings
+ checkBinding(mojo, "binding8.text");
+ }
+
+ protected void checkBinding(GenerateMojo mojo, String... bindings) throws IOException {
+ for (String b : bindings) {
+ checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"" + b + "\");", true);
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/log4j.properties
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/log4j.properties (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/log4j.properties 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,9 @@
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+
+log4j.logger.jaxx.compiler=INFO
+log4j.logger.jaxx.compiler.binding=DEBUG
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<!--<verbose>true</verbose>-->
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<!--<verbose>true</verbose>-->
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<i18nable>true</i18nable>
<force>true</force>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<i18nable>false</i18nable>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<addLogger>false</addLogger>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<jaxxContextFQN>java.lang.String</jaxxContextFQN>
<force>true</force>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<i18nable>false</i18nable>
<force>true</force>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<addLogger>false</addLogger>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<addLogger>true</addLogger>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -14,7 +14,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<!--<verbose>true</verbose>-->
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<!--<verbose>true</verbose>-->
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,24 @@
+
+<JPanel>
+
+ <java.io.File id='file' constructorParams='""'/>
+ <java.io.File id='file2' javaBean='new File("")'/>
+
+ <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new BeanImpl()'/>
+ <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' javaBean='new BeanImpl()'/>
+
+ <JLabel id='nobinding1' text='{file.getAbsolutePath()}'/>
+ <JLabel id='nobinding2' text='{getFile().getAbsolutePath()}'/>
+
+ <JLabel id='binding0' text='{file2.getAbsolutePath()}' javaBean='new JLabel()'/>
+ <JLabel id='binding1' text='{this.getFile2().getAbsolutePath()}'/>
+ <JLabel id='binding2' text='{getFile2().getAbsolutePath()}'/>
+ <JLabel id='binding3' text='{bean.getText()}'/>
+ <JLabel id='binding4' text='{getBean().getText()}'/>
+ <JLabel id='binding5' text='{beanImpl.getText()}'/>
+ <JLabel id='binding6' text='{getBeanImpl().getText()}'/>
+ <JLabel id='binding7' text='{binding0.getText()}'/>
+ <JLabel id='binding8' text='{getBinding0().getText()}'/>
+ <JLabel id='binding9' text='{binding0.getText() + binding1.getText()}'/>
+
+</JPanel>
Added: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml (rev 0)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton.jaxx.test</groupId>
+ <artifactId>test</artifactId>
+ <version>0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <configuration>
+ <src>${basedir}/target/test-classes</src>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
+ <force>true</force>
+ <!--<verbose>true</verbose>-->
+ <includes>
+ <value>**/DataBindingTest/*.jaxx</value>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<addLogger>false</addLogger>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<!--<verbose>true</verbose>-->
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<i18nable>true</i18nable>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<i18nable>true</i18nable>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml 2009-10-28 07:19:17 UTC (rev 1606)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml 2009-10-28 07:20:17 UTC (rev 1607)
@@ -13,7 +13,7 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/target/test-classes</src>
- <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
<i18nable>true</i18nable>
1
0
r1606 - in branches/jaxx-2.X: jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer jaxx-widgets/src/main/java/jaxx/runtime/swing
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:19:17 +0100 (Wed, 28 Oct 2009)
New Revision: 1606
Added:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
Removed:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java
Modified:
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx
branches/jaxx-2.X/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
Log:
amelioration des renderer sur Decorator (et deplacement vers jaxx.runtime.swing.renderer)
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx 2009-10-28 07:19:17 UTC (rev 1606)
@@ -24,7 +24,7 @@
import jaxx.runtime.SwingUtil;
import jaxx.demo.component.jaxx.navigation.*;
import jaxx.runtime.decorator.DecoratorUtils;
-import jaxx.runtime.decorator.swing.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer;
import jaxx.runtime.swing.navigation.NavigationTreeNode;
@Override
@@ -56,7 +56,7 @@
columnHeaderView='{toolbar}'
horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'>
- <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/>
+ <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/>
</JScrollPane>
<JToolBar id='toolbar' constraints='BorderLayout.SOUTH'
floatable='false'>
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx 2009-10-28 07:19:17 UTC (rev 1606)
@@ -27,10 +27,17 @@
import jaxx.runtime.SwingUtil;
import jaxx.demo.component.jaxx.navigation.*;
import jaxx.runtime.decorator.DecoratorUtils;
-import jaxx.runtime.decorator.swing.DecoratorListCellRenderer;
+import jaxx.runtime.decorator.MultiJXPathDecorator;
+import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer;
import jaxx.runtime.swing.navigation.NavigationTreeNode;
import jaxx.runtime.swing.navigation.NavigationContentUI;
+// init shared list decorator
+MultiJXPathDecorator<?> d0 = (MultiJXPathDecorator<?>)DecoratorUtils.get(People.class.getSimpleName());
+MultiJXPathDecorator<?> d1 = (MultiJXPathDecorator<?>)DecoratorUtils.get(Movie.class.getSimpleName());
+MultiDecoratorListCellRenderer r = new MultiDecoratorListCellRenderer(d0,d1);
+setContextValue(r);
+
ContentUIHandler getHandler() {
return getContextValue(ContentUIHandler.class);
}
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx 2009-10-28 07:19:17 UTC (rev 1606)
@@ -24,7 +24,7 @@
import jaxx.runtime.SwingUtil;
import jaxx.demo.component.jaxx.navigation.*;
import jaxx.runtime.decorator.DecoratorUtils;
-import jaxx.runtime.decorator.swing.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer;
import jaxx.runtime.swing.navigation.NavigationTreeNode;
@Override
@@ -56,7 +56,7 @@
columnHeaderView='{toolbar}'
horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'>
- <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/>
+ <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/>
</JScrollPane>
<JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH'
floatable='false'>
Deleted: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -1,67 +0,0 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-package jaxx.runtime.decorator.swing;
-
-import jaxx.runtime.decorator.*;
-import java.awt.Component;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-
-/**
- * A {@link ListCellRenderer} which compute text with the given {@link #decorator}
- * and leave the hand to the {@link #delegate} to perform the visual renderer.
- *
- * @author chemit
- * @since 1.7.2
- */
-public class DecoratorListCellRenderer implements ListCellRenderer {
-
- /**
- * Delegate cell renderer
- */
- protected ListCellRenderer delegate;
- /**
- * Decorator to produce text to render
- */
- protected Decorator<?> decorator;
-
- public DecoratorListCellRenderer(Decorator<?> decorator) {
- this(new DefaultListCellRenderer(), decorator);
- }
-
- public DecoratorListCellRenderer(ListCellRenderer delegate, Decorator<?> decorator) {
- this.delegate = delegate;
- this.decorator = decorator;
- }
-
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- if (value != null) {
- if (value instanceof String) {
- value = (String) value;
- } else {
- value = decorator.toString(value);
- }
- }
- return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
- }
-}
Deleted: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -1,63 +0,0 @@
-/*
- * *##%
- * JAXX Runtime
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-package jaxx.runtime.decorator.swing;
-
-import jaxx.runtime.decorator.*;
-import javax.swing.JTable;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Component;
-import javax.swing.table.DefaultTableCellRenderer;
-
-/**
- * A {@link TableCellRenderer} which compute text with the given {@link #decorator}
- * and leave the hand to the {@link #delegate} to perform the visual renderer.
- *
- * @author chemit
- * @since 1.7.2 (was previously {@code jaxx.runtime.swing.DecoratorTableCellRenderer}).
- */
-public class DecoratorTableCellRenderer implements TableCellRenderer {
-
- /**
- * Delegate cell renderer
- */
- protected TableCellRenderer delegate;
- /**
- * Decorator to produce text to render
- */
- protected Decorator<?> decorator;
-
- public DecoratorTableCellRenderer(Decorator<?> decorator) {
- this(new DefaultTableCellRenderer(), decorator);
- }
-
- public DecoratorTableCellRenderer(TableCellRenderer delegate, Decorator<?> decorator) {
- this.delegate = delegate;
- this.decorator = decorator;
- }
-
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) {
- if (value != null) {
- value = decorator.toString(value);
- }
- return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column);
- }
-}
Copied: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java (from rev 1603, branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java)
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -0,0 +1,67 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package jaxx.runtime.swing.renderer;
+
+import jaxx.runtime.decorator.*;
+import java.awt.Component;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+
+/**
+ * A {@link ListCellRenderer} which compute text with the given {@link #decorator}
+ * and leave the hand to the {@link #delegate} to perform the visual renderer.
+ *
+ * @author chemit
+ * @since 1.7.2
+ */
+public class DecoratorListCellRenderer implements ListCellRenderer {
+
+ /**
+ * Delegate cell renderer
+ */
+ protected ListCellRenderer delegate;
+ /**
+ * Decorator to produce text to render
+ */
+ protected Decorator<?> decorator;
+
+ public DecoratorListCellRenderer(Decorator<?> decorator) {
+ this(new DefaultListCellRenderer(), decorator);
+ }
+
+ public DecoratorListCellRenderer(ListCellRenderer delegate, Decorator<?> decorator) {
+ this.delegate = delegate;
+ this.decorator = decorator;
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ if (value != null) {
+ if (value instanceof String) {
+ value = (String) value;
+ } else {
+ value = decorator.toString(value);
+ }
+ }
+ return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java (from rev 1603, branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java)
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -0,0 +1,63 @@
+/*
+ * *##%
+ * JAXX Runtime
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package jaxx.runtime.swing.renderer;
+
+import jaxx.runtime.decorator.*;
+import javax.swing.JTable;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Component;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ * A {@link TableCellRenderer} which compute text with the given {@link #decorator}
+ * and leave the hand to the {@link #delegate} to perform the visual renderer.
+ *
+ * @author chemit
+ * @since 1.7.2 (was previously {@code jaxx.runtime.swing.DecoratorTableCellRenderer}).
+ */
+public class DecoratorTableCellRenderer implements TableCellRenderer {
+
+ /**
+ * Delegate cell renderer
+ */
+ protected TableCellRenderer delegate;
+ /**
+ * Decorator to produce text to render
+ */
+ protected Decorator<?> decorator;
+
+ public DecoratorTableCellRenderer(Decorator<?> decorator) {
+ this(new DefaultTableCellRenderer(), decorator);
+ }
+
+ public DecoratorTableCellRenderer(TableCellRenderer delegate, Decorator<?> decorator) {
+ this.delegate = delegate;
+ this.decorator = decorator;
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) {
+ if (value != null) {
+ value = decorator.toString(value);
+ }
+ return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Added: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -0,0 +1,64 @@
+package jaxx.runtime.swing.renderer;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import jaxx.runtime.decorator.Decorator;
+import jaxx.runtime.decorator.JXPathDecorator;
+
+/**
+ * A {@link ListCellRenderer} which compute text with the matching decorator
+ * from {@link #decorators} and leave the hand to the {@link #delegate} to
+ * perform the visual renderer.
+ *
+ * @author chemit
+ * @since 2.0.0
+ */
+public class MultiDecoratorListCellRenderer implements ListCellRenderer {
+
+ /**
+ * Delegate cell renderer
+ */
+ protected ListCellRenderer delegate;
+ /**
+ * accepted types
+ */
+ protected List<Class<?>> types;
+ /**
+ * decorators for accepted types
+ */
+ protected Decorator<?>[] decorators;
+
+ public MultiDecoratorListCellRenderer(ListCellRenderer delegate, JXPathDecorator<?>... decorator) {
+ this.delegate = delegate;
+ this.types = new ArrayList<Class<?>>();
+ List<Decorator<?>> tmp = new ArrayList<Decorator<?>>();
+ for (JXPathDecorator<?> d : decorator) {
+ if (types.contains(d.getInternalClass())) {
+ throw new IllegalArgumentException("can not have twice a decorator of type " + d.getInternalClass());
+ }
+ types.add(d.getInternalClass());
+ tmp.add(d);
+ }
+ decorators = tmp.toArray(new Decorator<?>[tmp.size()]);
+ }
+
+ public MultiDecoratorListCellRenderer(JXPathDecorator<?>... decorator) {
+ this(new DefaultListCellRenderer(), decorator);
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ if (value != null) {
+ int i = types.indexOf(value.getClass());
+ if (i != -1) {
+ Decorator<?> d = decorators[i];
+ value = d.toString(value);
+ }
+ }
+ return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: branches/jaxx-2.X/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-10-28 07:18:13 UTC (rev 1605)
+++ branches/jaxx-2.X/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java 2009-10-28 07:19:17 UTC (rev 1606)
@@ -48,7 +48,7 @@
import jaxx.runtime.decorator.Decorator;
import jaxx.runtime.decorator.JXPathDecorator;
import jaxx.runtime.decorator.MultiJXPathDecorator;
-import jaxx.runtime.decorator.swing.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
import jaxx.runtime.decorator.DecoratorUtils;
import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener;
1
0
r1605 - in branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler: . binding css decorators finalizers tags
by tchemit@users.nuiton.org 28 Oct '09
by tchemit@users.nuiton.org 28 Oct '09
28 Oct '09
Author: tchemit
Date: 2009-10-28 08:18:13 +0100 (Wed, 28 Oct 2009)
New Revision: 1605
Added:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
Log:
- Evolution #105: permettre l'initialisation des objets sans JavaBean
- Evolution #100: am?\195?\169lioration du design du compilateur
- Evolution #99: Am?\195?\169liorer le code g?\195?\169n?\195?\169r?\195?\169
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -117,6 +117,10 @@
* client properties
*/
private Map<String, String> clientProperties;
+ /**
+ * initializer of the object
+ */
+ private String initializer;
public class ChildRef {
@@ -426,6 +430,14 @@
this.constructorParams = constructorParams;
}
+ public String getInitializer() {
+ return initializer;
+ }
+
+ public void setInitializer(String initializer) {
+ this.initializer = initializer;
+ }
+
/**
* Returns the code that performs basic initialization of this object,
* after it has already been constructed.
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -20,6 +20,7 @@
*/
package jaxx.compiler;
+import jaxx.compiler.binding.DataBinding;
import jaxx.compiler.css.StylesheetHelper;
import jaxx.compiler.script.ScriptManager;
import jaxx.compiler.java.JavaMethod;
@@ -632,18 +633,20 @@
expression.append(escapeJavaString(stringValue.substring(lastPos, pos)));
expression.append('"');
}
-
- if (expression.length() > 0) {
+ boolean multi = expression.length() > 0;
+ if (multi) {
expression.append(" + ");
+ expression.append('(');
}
- expression.append('(');
int pos2 = getNextRightBrace(stringValue, pos + 1);
if (pos2 == -1) {
reportError("unmatched '{' in expression: " + stringValue);
return "";
}
expression.append(stringValue.substring(pos + 1, pos2));
- expression.append(')');
+ if (multi) {
+ expression.append(')');
+ }
pos2++;
if (pos2 < stringValue.length()) {
pos = getNextLeftBrace(stringValue, pos2);
@@ -661,7 +664,12 @@
expression.append(escapeJavaString(stringValue.substring(lastPos)));
expression.append('"');
}
- return type == ClassDescriptorLoader.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString();
+ //TC-20091027 : developper must write extact databinding
+ // the fact of adding the String boxed for String type binding is not
+ // a good thing, since it add one more call to process in binding
+ // and add nothing special more ?
+// return type == ClassDescriptorLoader.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString();
+ return expression.toString();
}
return null;
}
@@ -1307,10 +1315,22 @@
}
public String getAutoId(ClassDescriptor objectClass) {
+ String name = objectClass.getName();
+ name = name.substring(name.lastIndexOf(".") + 1);
+ return getAutoId(name);
+// if (configuration.getOptimize()) {
+// return "$" + Integer.toString(autogenID++, 36);
+// } else {
+// String name = objectClass.getName();
+// name = name.substring(name.lastIndexOf(".") + 1);
+// return "$" + name + autogenID++;
+// }
+ }
+
+ public String getAutoId(String name) {
if (configuration.getOptimize()) {
return "$" + Integer.toString(autogenID++, 36);
} else {
- String name = objectClass.getName();
name = name.substring(name.lastIndexOf(".") + 1);
return "$" + name + autogenID++;
}
@@ -1368,26 +1388,26 @@
return javaFile;
}
- public void finalizeCompilers(Iterable<JAXXCompilerFinalizer> generatorIterator) throws Exception {
+ public void finalizeCompiler(Iterable<JAXXCompilerFinalizer> finalizers) throws Exception {
int dotPos = getOutputClassName().lastIndexOf(".");
String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null;
String simpleClassName = getOutputClassName().substring(dotPos + 1);
CompiledObject compiledObject = getRootObject();
- for (JAXXCompilerFinalizer generator : generatorIterator) {
- generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName);
+ for (JAXXCompilerFinalizer finalizer : finalizers) {
+ finalizer.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName);
}
for (CompiledObject object : getObjects().values()) {
object.finalizeCompiler(this);
}
- for (JAXXCompilerFinalizer generator : generatorIterator) {
- generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName);
+ for (JAXXCompilerFinalizer finalizer : finalizers) {
+ finalizer.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName);
}
}
- public void generate(JavaFileGenerator generator, Iterable<JAXXCompilerFinalizer> generatorIterator) throws IOException {
+ public void generate(JavaFileGenerator generator) throws IOException {
File dest;
if (getConfiguration().getTargetDirectory() != null) {
dest = new File(getConfiguration().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java");
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -365,7 +365,7 @@
for (String className : engine.jaxxFileClassNames) {
JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
addStartProfileTime(engine, compiler);
- compiler.finalizeCompilers(engine.finalizers);
+ compiler.finalizeCompiler(engine.finalizers);
addEndProfileTime(engine, compiler);
if (compiler.isFailed()) {
success = false;
@@ -387,7 +387,7 @@
for (String className : engine.jaxxFileClassNames) {
JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
addStartProfileTime(engine, compiler);
- compiler.generate(generator, engine.finalizers);
+ compiler.generate(generator);
addEndProfileTime(engine, compiler);
if (compiler.isFailed()) {
success = false;
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java (from rev 1602, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -0,0 +1,137 @@
+/*
+ * *##%
+ * JAXX Compiler
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package jaxx.compiler.binding;
+
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Represents a data binding in a JAXX file. <code>DataBinding</code> uses
+ * {@link DataSource} to track changes to a source expression and update
+ * the destination.
+ */
+public class DataBinding {
+
+ /**
+ * Logger
+ */
+ protected static final Log log = LogFactory.getLog(DataBinding.class);
+ /**
+ * Id of the data binding
+ */
+ private String id;
+ /**
+ * source of the data binding
+ */
+ private String source;
+ /**
+ * A Java snippet which will cause the destination property to be updated with the current value of
+ * the binding.
+ */
+ private String assignment;
+
+ /**
+ * Creates a new data binding.
+ *
+ * @param source the Java source code for the data binding expression
+ * @param id the data binding destination in the form <code><id>.<propertyName></code>
+ * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding
+ */
+ public DataBinding(String source, String id, String assignment) {
+ this.id = id;
+ this.source = source;
+ this.assignment = assignment;
+ if (log.isDebugEnabled()) {
+ log.debug("id=" + id + " assignement=" + assignment + " source=" + source);
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Compiles the data binding expression. This method calls methods in
+ * <code>JAXXCompiler</code> to add the Java code that performs the data
+ * binding setup.
+ *
+ * @param compiler compiler which includes the data binding
+ * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time
+ * @return {@code true} if the expression has dependencies, {@code false} otherwise
+ * @throws CompilerException if a compilation error occurs
+ */
+ public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException {
+
+ DataSource dataSource = new DataSource(id, source, compiler);
+
+ // handles all of the listener additions
+ //TC-20091026 use 'this' instead of root object javaCode
+// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")");
+ boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")");
+ if (log.isDebugEnabled()) {
+ log.debug(id + " isBinding ? " + result);
+ }
+ String eol = JAXXCompiler.getLineSeparator();
+ if (!result && quickNoDependencies) {
+ // layout is specially handled early in the chain
+ if (!id.endsWith(".layout")) {
+ compiler.appendInitDataBindings(assignment + eol);
+ }
+ return false; // no dependencies, just a static expression
+ }
+
+ StringBuilder buffer = new StringBuilder();
+ if (compiler.hasProcessDataBinding()) {
+ buffer.append(" else ");
+// compiler.appendProcessDataBinding(" else ");
+ } else {
+ buffer.append(" ");
+// compiler.appendProcessDataBinding(" ");
+ }
+ buffer.append("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol);
+// compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol);
+ String objectCode = dataSource.getObjectCode();
+ if (log.isDebugEnabled()) {
+ log.debug(id + " objectCode= " + objectCode);
+ }
+ //TC-20091026 no need to test objectCode not null if on root object
+// boolean needTest = objectCode != null;
+ boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
+ if (needTest) {
+ buffer.append(" if (" + objectCode + " != null) {" + eol);
+ buffer.append(" ");
+// compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol);
+// compiler.appendProcessDataBinding(" ");
+ }
+ buffer.append(" " + assignment.trim());
+// compiler.appendProcessDataBinding(" " + assignment.trim());
+ if (needTest) {
+ buffer.append(eol + " }");
+// compiler.appendProcessDataBinding(eol + " }");
+ }
+ buffer.append(eol + " }");
+// compiler.appendProcessDataBinding(eol + " }");
+ compiler.appendProcessDataBinding(buffer.toString());
+ return true;
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java (from rev 1602, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -0,0 +1,596 @@
+/*
+ * *##%
+ * JAXX Compiler
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package jaxx.compiler.binding;
+
+import jaxx.compiler.CompiledObject;
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.UnsupportedAttributeException;
+import jaxx.compiler.java.JavaField;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserConstants;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.SimpleNode;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.compiler.tags.DefaultObjectHandler;
+import jaxx.compiler.tags.TagManager;
+import jaxx.compiler.types.TypeManager;
+
+import java.beans.Introspector;
+import java.beans.PropertyChangeListener;
+import java.io.StringReader;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be
+ * determined that its value may have changed. Events are fired on a "best effort" basis, and events
+ * may either be fired too often (the value has not actually changed) or not often enough (the value
+ * changed but no event was fired).
+ */
+public class DataSource {
+
+ /**
+ * Logger
+ */
+ protected static final Log log = LogFactory.getLog(DataSource.class);
+
+ /**
+ * type attached to "null" constants in parsed expressions
+ */
+ private class NULL {
+ }
+ /**
+ * id of data source
+ */
+ private String id;
+ /**
+ * The Java source code for the expression.
+ */
+ private String source;
+ /**
+ * The current <code>JAXXCompiler</code>.
+ */
+ private JAXXCompiler compiler;
+ /**
+ * List of symbols which this data source expression depends on.
+ */
+ private List<String> dependencySymbols = new ArrayList<String>();
+ /**
+ *
+ */
+ private StringBuffer addListenerCode = new StringBuffer();
+ /**
+ *
+ */
+ private StringBuffer removeListenerCode = new StringBuffer();
+ /**
+ *
+ */
+ private boolean compiled;
+ /**
+ * the delegate of property to be required
+ */
+ private String objectCode;
+ /**
+ * the data source id
+ */
+ private String listenerId;
+
+ /**
+ * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile}
+ * to cause it to function at runtime.
+ *
+ * @param id the DataSource's id
+ * @param source the Java source code for the data source expression
+ * @param compiler the current <code>JAXXCompiler</code>
+ */
+ public DataSource(String id, String source, JAXXCompiler compiler) {
+ this.id = id;
+ this.source = source;
+ this.compiler = compiler;
+ if (log.isDebugEnabled()) {
+ log.debug("id=" + id + " source=" + source);
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public String getObjectCode() {
+ return objectCode;
+ }
+
+ public String getListenerId() {
+ return listenerId;
+ }
+
+ /**
+ * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code>
+ * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is
+ * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile
+ * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this
+ * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener.
+ *
+ * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code>
+ * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
+ * @throws CompilerException if a compilation error occurs
+ * @throws IllegalStateException if data source was already compiled
+ */
+ public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException {
+ if (compiled) {
+ throw new IllegalStateException(this + " has already been compiled");
+ }
+// String listenerId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass()));
+ listenerId = compiler.getAutoId(getClass().getSimpleName());
+ if (log.isDebugEnabled()) {
+ log.debug("listenerId=" + listenerId);
+ }
+ JavaParser p = new JavaParser(new StringReader(source));
+// JavaParser p = new JavaParser(new StringReader(source + ";"));
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (log.isDebugEnabled()) {
+ log.debug("will scan node " + node.getText());
+ }
+// scanNode(node, listenerId);
+ scanNode(node);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("dependencySymbols=" + dependencySymbols);
+ }
+ if (dependencySymbols.size() > 0) {
+ // a real binding was detected
+
+ // add a dataBinding field
+ //TC 20081108 prefer add a real JavaField instead of raw code
+ //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n");
+ compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), listenerId, false, propertyChangeListenerCode));
+
+ // add listener codes in compiler
+
+// compileListeners();
+ String javaCodeId = TypeManager.getJavaCode(id);
+ String eol = JAXXCompiler.getLineSeparator();
+
+// if (addListenerCode.length() > 0) {
+ if (compiler.hasApplyDataBinding()) {
+ compiler.appendApplyDataBinding(" else ");
+ }
+ compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {");
+ compiler.appendApplyDataBinding(" " + addListenerCode + eol);
+ compiler.appendApplyDataBinding("}");
+// }
+
+// if (removeListenerCode.length() > 0) {
+ if (compiler.hasRemoveDataBinding()) {
+ compiler.appendRemoveDataBinding(" else ");
+ }
+ compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {");
+ compiler.appendRemoveDataBinding(" " + removeListenerCode + eol);
+ compiler.appendRemoveDataBinding("}");
+// }
+ }
+ //TC-20091027 if no dependency symbols then no listeners
+// compileListeners();
+ compiled = true;
+
+ return dependencySymbols.size() > 0;
+ }
+
+ /**
+ * @return a list of symbols on which this data source depends.
+ */
+ public Collection<String> getDependencies() {
+ return Collections.unmodifiableList(dependencySymbols);
+ }
+
+ /**
+ * Examines a node to identify any dependencies it contains.
+ *
+ * @param node node to scan
+ // * @param listenerId id of listener
+ * @throws CompilerException ?
+ */
+ private void scanNode(SimpleNode node) throws CompilerException {
+// private void scanNode(SimpleNode node, String listenerId) throws CompilerException {
+ if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION ||
+ node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) {
+ return;
+ }
+ if (log.isTraceEnabled()) {
+ log.trace(node.getText());
+ }
+ int count = node.jjtGetNumChildren();
+ for (int i = 0; i < count; i++) {
+ scanNode(node.getChild(i));
+ }
+ // determine node type
+ ClassDescriptor type = null;
+ if (node.jjtGetNumChildren() == 1) {
+ type = node.getChild(0).getJavaType();
+ }
+ switch (node.getId()) {
+ case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE:
+ type = ClassDescriptorLoader.getClassDescriptor(Class.class);
+ break;
+ case JavaParserTreeConstants.JJTPRIMARYEXPRESSION:
+// type = determineExpressionType(node, listenerId);
+ type = determineExpressionType(node);
+ break;
+ case JavaParserTreeConstants.JJTLITERAL:
+ type = determineLiteralType(node);
+ break;
+ case JavaParserTreeConstants.JJTCASTEXPRESSION:
+ type = TagManager.resolveClass(node.getChild(0).getText(), compiler);
+ break;
+ }
+ node.setJavaType(type);
+
+// switch (node.getId()) {
+// case JavaParserTreeConstants.JJTMETHODDECLARATION:
+// break;
+// case JavaParserTreeConstants.JJTFIELDDECLARATION:
+// break;
+//
+// default:
+// int count = node.jjtGetNumChildren();
+// for (int i = 0; i < count; i++) {
+// scanNode(node.getChild(i), listenerId);
+// }
+// determineNodeType(node);
+// }
+ }
+
+ /**
+ * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
+ * can be tracked.
+ *
+ * @param expression the node to scan
+ // * @param listenerId id of the listener
+ * @return the class descriptor of the return type or null
+ */
+// private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) {
+ private ClassDescriptor determineExpressionType(SimpleNode expression) {
+ assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION;
+ SimpleNode prefix = expression.getChild(0);
+ if (prefix.jjtGetNumChildren() == 1) {
+ int type = prefix.getChild(0).getId();
+ if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) {
+ prefix.setJavaType(prefix.getChild(0).getJavaType());
+ } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) {
+ // name with no arguments after it
+// prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId));
+ prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false));
+ }
+ }
+
+ if (expression.jjtGetNumChildren() == 1) {
+ return prefix.getJavaType();
+ }
+
+ ClassDescriptor contextClass = prefix.getJavaType();
+ if (contextClass == null) {
+ contextClass = compiler.getRootObject().getObjectClass();
+ }
+ String lastNode = prefix.getText().trim();
+
+ for (int i = 1; i < expression.jjtGetNumChildren(); i++) {
+ SimpleNode suffix = expression.getChild(i);
+ if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) {
+ if (suffix.getChild(0).jjtGetNumChildren() == 0) {
+ // at the moment only no-argument methods are trackable
+// contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId);
+ contextClass = scanCompoundSymbol(lastNode, contextClass, true);
+ if (contextClass == null) {
+ return null;
+ }
+ int dotPos = lastNode.lastIndexOf(".");
+ String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos);
+ for (int j = i - 2; j >= 0; j--) {
+ code = expression.getChild(j).getText() + code;
+ }
+ if (code.length() == 0) {
+ code = compiler.getRootObject().getJavaCode();
+ }
+ String methodName = lastNode.substring(dotPos + 1).trim();
+ try {
+ MethodDescriptor method = contextClass.getMethodDescriptor(methodName);
+// trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId);
+ trackMemberIfPossible(code, contextClass, method.getName(), true);
+ return method.getReturnType();
+ } catch (NoSuchMethodException e) {
+ // happens for methods defined in the current JAXX file via scripts
+ String propertyName = null;
+ if (methodName.startsWith("is")) {
+ propertyName = Introspector.decapitalize(methodName.substring("is".length()));
+ } else if (methodName.startsWith("get")) {
+ propertyName = Introspector.decapitalize(methodName.substring("get".length()));
+ }
+ if (propertyName != null) {
+ //TC-20091026 use the getScriptMethod from compiler
+ MethodDescriptor newMethod = compiler.getScriptMethod(methodName);
+ if (newMethod != null) {
+ addListener(compiler.getRootObject().getId(),
+ null,
+ "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
+ "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
+ contextClass = newMethod.getReturnType();
+ }
+// MethodDescriptor[] newMethods = compiler.getScriptMethods();
+// for (MethodDescriptor newMethod : newMethods) {
+// if (newMethod.getName().equals(methodName)) {
+// addListener(compiler.getRootObject().getId(),
+// null,
+// "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
+// "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
+// contextClass = newMethod.getReturnType();
+// break;
+// }
+// }
+ }
+ }
+ }
+ }
+ lastNode = suffix.getText().trim();
+ if (lastNode.startsWith(".")) {
+ lastNode = lastNode.substring(1);
+ }
+ }
+
+ return null;
+ }
+
+ private ClassDescriptor determineLiteralType(SimpleNode node) {
+ assert node.getId() == JavaParserTreeConstants.JJTLITERAL;
+ if (node.jjtGetNumChildren() == 1) {
+ int childId = node.getChild(0).getId();
+ if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) {
+ return ClassDescriptorLoader.getClassDescriptor(boolean.class);
+ }
+ if (childId == JavaParserTreeConstants.JJTNULLLITERAL) {
+ return ClassDescriptorLoader.getClassDescriptor(NULL.class);
+ }
+ throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]);
+ }
+ int nodeId = node.firstToken.kind;
+ switch (nodeId) {
+ case JavaParserConstants.INTEGER_LITERAL:
+ if (node.firstToken.image.toLowerCase().endsWith("l")) {
+ return ClassDescriptorLoader.getClassDescriptor(long.class);
+ }
+ return ClassDescriptorLoader.getClassDescriptor(int.class);
+ case JavaParserConstants.CHARACTER_LITERAL:
+ return ClassDescriptorLoader.getClassDescriptor(char.class);
+ case JavaParserConstants.FLOATING_POINT_LITERAL:
+ if (node.firstToken.image.toLowerCase().endsWith("f")) {
+ return ClassDescriptorLoader.getClassDescriptor(float.class);
+ }
+ return ClassDescriptorLoader.getClassDescriptor(double.class);
+ case JavaParserConstants.STRING_LITERAL:
+ return ClassDescriptorLoader.getClassDescriptor(String.class);
+ default:
+ throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]);
+ }
+ }
+
+ /**
+ * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it.
+ *
+ * @param symbol symbol to scan
+ * @param contextClass current class context
+ * @param isMethod flag to search a method
+ // * @param listenerId id of the listener
+ * @return the type of the symbol (or null if it could not be determined).
+ */
+// private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) {
+ private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod) {
+ String[] tokens = symbol.split("\\s*\\.\\s*");
+ StringBuffer currentSymbol = new StringBuffer();
+ StringBuffer tokensSeenSoFar = new StringBuffer();
+ boolean accepted; // if this ends up false, it means we weren't able to figure out
+ // which object the method is being invoked on
+ boolean recognizeClassNames = true;
+ for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) {
+ accepted = false;
+
+ if (tokensSeenSoFar.length() > 0) {
+ tokensSeenSoFar.append('.');
+ }
+ tokensSeenSoFar.append(tokens[j]);
+ if (currentSymbol.length() > 0) {
+ currentSymbol.append('.');
+ }
+ currentSymbol.append(tokens[j]);
+
+ if (currentSymbol.indexOf(".") == -1) {
+ String memberName = currentSymbol.toString();
+ CompiledObject object = compiler.getCompiledObject(memberName);
+ if (object != null) {
+ contextClass = object.getObjectClass();
+ currentSymbol.setLength(0);
+ accepted = true;
+ recognizeClassNames = false;
+ } else {
+ try {
+ FieldDescriptor field = contextClass.getFieldDescriptor(memberName);
+// trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId);
+ trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false);
+ contextClass = field.getType();
+ currentSymbol.setLength(0);
+ accepted = true;
+ recognizeClassNames = false;
+ } catch (NoSuchFieldException e) {
+ if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context
+ FieldDescriptor[] newFields = compiler.getScriptFields();
+ for (FieldDescriptor newField : newFields) {
+ if (newField.getName().equals(memberName)) {
+ addListener(tokensSeenSoFar.toString(),
+ null,
+ "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(),
+ "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator());
+ contextClass = newField.getType();
+ assert contextClass != null : "script field '" + memberName + "' is defined, but has type null";
+ currentSymbol.setLength(0);
+ accepted = true;
+ recognizeClassNames = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (currentSymbol.length() > 0 && recognizeClassNames) {
+ contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler);
+ if (contextClass != null) {
+ currentSymbol.setLength(0);
+ //accepted = true;
+ //recognizeClassNames = false;
+ // TODO: for now we don't handle statics
+ return null;
+ }
+ }
+ if (!accepted) {
+ return null;
+ }
+ }
+
+ return contextClass;
+ }
+
+// private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) {
+ private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method) {
+// if (objectClass.isInterface()) {
+// // might be technically possible to track in some cases, but for now
+// // we can't create a DefaultObjectHandler for interfaces
+// return;
+// }
+
+ DefaultObjectHandler handler = TagManager.getTagHandler(objectClass);
+ try {
+ if (handler.isMemberBound(memberName)) {
+ addListener(objectCode + "." + memberName + (method ? "()" : ""),
+ objectCode,
+ handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler),
+ handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler));
+ }
+ } catch (UnsupportedAttributeException e) {
+ // ignore -- this is thrown for methods like toString(), for which there is no tracking and
+ // no setting support
+ }
+ }
+
+ private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) {
+ this.objectCode = objectCode;
+ //TC-20091026 no need to test objectCode not null if on root object
+// boolean needTest = objectCode != null;
+ boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
+ if (!dependencySymbols.contains(dependencySymbol)) {
+ dependencySymbols.add(dependencySymbol);
+ String eol = JAXXCompiler.getLineSeparator();
+ addListenerCode.append(eol);
+ if (needTest) {
+ addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
+ addListenerCode.append(" ");
+ }
+ addListenerCode.append(" ").append(addCode.trim());
+ if (needTest) {
+ addListenerCode.append(eol).append(" }");
+ }
+
+ removeListenerCode.append(eol);
+ if (needTest) {
+ removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
+ removeListenerCode.append(" ");
+ }
+ removeListenerCode.append(" ").append(removeCode.trim());
+ if (needTest) {
+ removeListenerCode.append(eol).append(" }");
+ }
+ }
+ }
+// /**
+// * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which
+// * can be tracked.
+// *
+// * @param node node to scan
+// * @param listenerId the listener id
+// */
+//// private void determineNodeType(SimpleNode node, String listenerId) {
+// private void determineNodeType(SimpleNode node) {
+// ClassDescriptor type = null;
+// if (node.jjtGetNumChildren() == 1) {
+// type = node.getChild(0).getJavaType();
+// }
+// switch (node.getId()) {
+// case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE:
+// type = ClassDescriptorLoader.getClassDescriptor(Class.class);
+// break;
+// case JavaParserTreeConstants.JJTPRIMARYEXPRESSION:
+// type = determineExpressionType(node, listenerId);
+// break;
+// case JavaParserTreeConstants.JJTLITERAL:
+// type = determineLiteralType(node);
+// break;
+// case JavaParserTreeConstants.JJTCASTEXPRESSION:
+// type = TagManager.resolveClass(node.getChild(0).getText(), compiler);
+// break;
+// }
+// node.setJavaType(type);
+// }
+// private void compileListeners() {
+// String javaCodeId = TypeManager.getJavaCode(id);
+// String eol = JAXXCompiler.getLineSeparator();
+// if (addListenerCode.length() > 0) {
+// if (compiler.hasApplyDataBinding()) {
+// compiler.appendApplyDataBinding(" else ");
+// }
+//// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {");
+// compiler.appendApplyDataBinding(" " + addListenerCode + eol);
+// compiler.appendApplyDataBinding("}");
+// }
+//
+// if (removeListenerCode.length() > 0) {
+// if (compiler.hasRemoveDataBinding()) {
+// compiler.appendRemoveDataBinding(" else ");
+// }
+//// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {");
+// compiler.appendRemoveDataBinding(" " + removeListenerCode + eol);
+// compiler.appendRemoveDataBinding("}");
+// }
+// }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -20,6 +20,8 @@
*/
package jaxx.compiler.css;
+import jaxx.compiler.binding.DataSource;
+import jaxx.compiler.binding.DataBinding;
import jaxx.compiler.*;
import jaxx.runtime.css.Selector;
import jaxx.runtime.css.Rule;
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -81,6 +81,8 @@
String init = object.getId() + " = ";
if (object.isJavaBean() && object.getJavaBeanInitCode() != null) {
init += object.getJavaBeanInitCode();
+ } else if (object.getInitializer() != null) {
+ init += object.getInitializer();
} else {
//TC - 20081017 compiledObject can have generics
String canonicalName = JAXXCompiler.getCanonicalName(object);
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -88,23 +88,23 @@
String eol = JAXXCompiler.getLineSeparator();
- if (options.isGenerateHelp()) {
+// if (options.isGenerateHelp()) {
- // add code to init javax help system
- Iterator<CompiledObject> itr = compiler.getObjectCreationOrder();
+ // add code to init javax help system
+ Iterator<CompiledObject> itr = compiler.getObjectCreationOrder();
- for (; itr.hasNext();) {
- CompiledObject o = itr.next();
- String helpID = getHelpId(o);
- if (helpID != null) {
- buffer.append(eol);
- // detects a helpId to register
- buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");");
- //keep the helpID for helpSet generation
- helpIds.add(helpID);
- }
+ for (; itr.hasNext();) {
+ CompiledObject o = itr.next();
+ String helpID = getHelpId(o);
+ if (helpID != null) {
+ buffer.append(eol);
+ // detects a helpId to register
+ buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");");
+ //keep the helpID for helpSet generation
+ helpIds.add(helpID);
}
}
+// }
if (buffer.length() > 0) {
StringBuilder extraCode = new StringBuilder(helpBrokerFQN).append(" _broker = getBroker();");
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -24,7 +24,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompiledObjectDecorator;
-import jaxx.compiler.DataBinding;
+import jaxx.compiler.binding.DataBinding;
import jaxx.compiler.EventHandler;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.java.JavaMethod;
@@ -39,7 +39,6 @@
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXObjectDescriptor;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,6 +47,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import jaxx.runtime.Util;
import static jaxx.compiler.java.JavaFileGenerator.*;
/**
@@ -242,45 +242,10 @@
CompiledObjectDecorator decorator = object.getDecorator();
decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName);
}
- String eol = JAXXCompiler.getLineSeparator();
- // DataBinding
- for (DataBinding dataBinding : compiler.getDataBindings()) {
- if (dataBinding.compile(compiler, true)) {
- String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol;
- compiler.appendInitDataBindings(expression);
- }
- }
+ finalizeBindings(compiler, superclassIsJAXXObject);
- if (superclassIsJAXXObject) {
- boolean hasBind = compiler.hasApplyDataBinding();
- if (hasBind) {
- compiler.appendApplyDataBinding(" else {");
- compiler.appendApplyDataBinding(eol);
- compiler.appendApplyDataBinding(" ");
- }
- compiler.appendApplyDataBinding("super.applyDataBinding($binding);");
- compiler.appendApplyDataBinding(eol);
-
- if (hasBind) {
- compiler.appendApplyDataBinding(" return;");
- compiler.appendApplyDataBinding(eol);
- compiler.appendApplyDataBinding("}");
- }
-
- hasBind = compiler.hasRemoveDataBinding();
- if (hasBind) {
- compiler.appendRemoveDataBinding(" else {");
- compiler.appendRemoveDataBinding(eol);
- compiler.appendRemoveDataBinding(" ");
- }
- compiler.appendRemoveDataBinding("super.removeDataBinding($binding);");
- compiler.appendRemoveDataBinding(eol);
-
- if (hasBind) {
- compiler.appendRemoveDataBinding("}");
- }
- } else {
+ if (!superclassIsJAXXObject) {
javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class));
}
}
@@ -405,7 +370,47 @@
}
+ protected void finalizeBindings(JAXXCompiler compiler, boolean superclassIsJAXXObject) {
+ String eol = JAXXCompiler.getLineSeparator();
+ for (DataBinding dataBinding : compiler.getDataBindings()) {
+ if (dataBinding.compile(compiler, true)) {
+ String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol;
+ compiler.appendInitDataBindings(expression);
+ }
+ }
+
+ if (superclassIsJAXXObject) {
+ boolean hasBind = compiler.hasApplyDataBinding();
+ if (hasBind) {
+ compiler.appendApplyDataBinding(" else {");
+ compiler.appendApplyDataBinding(eol);
+ compiler.appendApplyDataBinding(" ");
+ }
+ compiler.appendApplyDataBinding("super.applyDataBinding($binding);");
+ compiler.appendApplyDataBinding(eol);
+
+ if (hasBind) {
+ compiler.appendApplyDataBinding(" return;");
+ compiler.appendApplyDataBinding(eol);
+ compiler.appendApplyDataBinding("}");
+ }
+
+ hasBind = compiler.hasRemoveDataBinding();
+ if (hasBind) {
+ compiler.appendRemoveDataBinding(" else {");
+ compiler.appendRemoveDataBinding(eol);
+ compiler.appendRemoveDataBinding(" ");
+ }
+ compiler.appendRemoveDataBinding("super.removeDataBinding($binding);");
+ compiler.appendRemoveDataBinding(eol);
+
+ if (hasBind) {
+ compiler.appendRemoveDataBinding("}");
+ }
+ }
+ }
+
/*---------------------------------------------------------------------------------*/
/*-- Create fields ----------------------------------------------------------------*/
/*---------------------------------------------------------------------------------*/
@@ -614,8 +619,9 @@
if (superclassIsJAXXObject) {
code.append(" else {").append(eol);
code.append(" super.processDataBinding($dest, true);").append(eol);
- code.append(" }").append(eol);
+ code.append(" }");
}
+ code.append(eol);
code.append("} finally {").append(eol);
code.append(" $activeBindings.remove($dest);").append(eol);
code.append("}").append(eol);
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-27 10:46:23 UTC (rev 1604)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-28 07:18:13 UTC (rev 1605)
@@ -85,6 +85,7 @@
public static final String GENERICTYPE_ATTRIBUTE = "genericType";
public static final String ID_ATTRIBUTE = "id";
public static final String IMPLEMENTS_ATTRIBUTE = "implements";
+ public static final String INITIALIZER_ATTRIBUTE = "initializer";
public static final String JAVA_BEAN_ATTRIBUTE = "javaBean";
public static final String LAYOUT_ATTRIBUTE = "layout";
public static final String MNEMONIC_ATTRIBUTE = "mnemonic";
@@ -324,7 +325,8 @@
}
ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null;
- if (eventInfo != null) { // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents
+ if (eventInfo != null) {
+ // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents
StringBuffer result = new StringBuffer();
String methodName = "$pr" + compiler.getUniqueId(propertyChangeListenerCode);
boolean methodExists = compiler.hasMethod(methodName);
@@ -665,7 +667,8 @@
continue;
}
if (name.equals(CONSTRAINTS_ATTRIBUTE) || isEventHandlerName(name)) {
- compiler.preprocessScript(value); // adds dependencies as a side effect
+ // adds dependencies as a side effect
+ compiler.preprocessScript(value);
} else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) {
for (String param : value.split("\\s*,\\s*")) {
compiler.preprocessScript(param);
@@ -713,6 +716,14 @@
}
continue;
}
+ if (name.equals(INITIALIZER_ATTRIBUTE)) {
+ if (!value.isEmpty()) {
+ object.setInitializer(value);
+ } else {
+ object.setInitializer("null");
+ }
+ continue;
+ }
if (name.equals(IMPLEMENTS_ATTRIBUTE)) {
if (object != compiler.getRootObject()) {
// can ony be apply to root object
@@ -863,23 +874,25 @@
if (inline) {
compiler.addInlineStyle(object, propertyName, true);
}
- ClassDescriptor propertyType = getPropertyType(object, propertyName, compiler);
- if (propertyType != null &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Boolean.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Byte.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Short.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Integer.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Float.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Double.class) &&
- propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) {
- //binding = "((" + propertyType.getName() + ") " + binding + ")";
- }
+ //TC-20091027 : make sure this code is never used ?
+// ClassDescriptor propertyType = getPropertyType(object, propertyName, compiler);
+// if (propertyType != null &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Boolean.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Byte.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Short.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Integer.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Float.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Double.class) &&
+// propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) {
+// //binding = "((" + propertyType.getName() + ") " + binding + ")";
+// }
+ String setPropertyCode = getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler);
if (propertyName.equals(LAYOUT_ATTRIBUTE)) { // handle containerDelegate (e.g. contentPane on JFrame)
// have to set layout early, before children are added
- object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler));
+ object.appendInitializationCode(setPropertyCode);
}
// object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler);
- compiler.registerDataBinding(binding, object.getId() + "." + propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler));
+ compiler.registerDataBinding(binding, object.getId() + "." + propertyName, setPropertyCode);
} else { // no bindings, convert from string
if (inline) {
compiler.addInlineStyle(object, propertyName, false);
1
0
r1604 - branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime
by tchemit@users.nuiton.org 27 Oct '09
by tchemit@users.nuiton.org 27 Oct '09
27 Oct '09
Author: tchemit
Date: 2009-10-27 11:46:23 +0100 (Tue, 27 Oct 2009)
New Revision: 1604
Modified:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Log:
in Util.initContext add a entry in ui context when parentContext is a JAXXOBbject (it will make possible to walk into UI ancestor without using the getParentContainer method
Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-27 00:40:30 UTC (rev 1603)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-27 10:46:23 UTC (rev 1604)
@@ -54,6 +54,7 @@
* Logger
*/
static private final Log log = LogFactory.getLog(Util.class);
+ public static final String PARENT = "parent";
// Maps root objects to lists of event listeners
private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
@@ -121,17 +122,15 @@
public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
Class<List<O>> castList = Util.<O>castList();
- JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList);
+ JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList);
return contextEntryDef;
}
-
@SuppressWarnings({"unchecked"})
protected static <O> Class<List<O>> castList() {
return (Class<List<O>>) Collections.emptyList().getClass();
}
-
/**
* Method to initialize the context of a ui.
*
@@ -145,6 +144,11 @@
} else {
ui.setContextValue(parentContext);
}
+ // if parentContext is a JAXXObject then
+ // add an special parent entry to can go up
+ if (parentContext instanceof JAXXObject) {
+ ui.setContextValue(parentContext, PARENT);
+ }
}
public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
1
0