Jaxx-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
February 2010
- 3 participants
- 23 discussions
r1751 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field
by tchemit@users.nuiton.org 26 Feb '10
by tchemit@users.nuiton.org 26 Feb '10
26 Feb '10
Author: tchemit
Date: 2010-02-26 19:39:10 +0100 (Fri, 26 Feb 2010)
New Revision: 1751
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java
Log:
reformat code + add logs
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java 2010-02-21 10:26:26 UTC (rev 1750)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java 2010-02-26 18:39:10 UTC (rev 1751)
@@ -29,7 +29,8 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
/**
- * Un validateur basé sur {@link FieldExpressionValidator} qui valide sur une collection de propriéte.
+ * Un validateur basé sur {@link FieldExpressionValidator} qui valide sur une
+ * collection de propriéte.
*
* @author chemit
*/
@@ -152,10 +153,12 @@
useLast = expressionForLast != null && !expressionForLast.trim().isEmpty();
if (useFirst && mode != Mode.ALL) {
- throw new ValidationException("can only use expressionForFirst in mode ALL but was " + mode);
+ throw new ValidationException("can only use expressionForFirst in " +
+ "mode ALL but was " + mode);
}
if (useLast && mode != Mode.ALL) {
- throw new ValidationException("can only use expressionForLast in mode ALL but was " + mode);
+ throw new ValidationException("can only use expressionForLast in " +
+ "mode ALL but was " + mode);
}
String fieldName = getFieldName();
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java 2010-02-21 10:26:26 UTC (rev 1750)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java 2010-02-26 18:39:10 UTC (rev 1751)
@@ -32,7 +32,8 @@
* Un validateur basé sur {@link FieldExpressionValidator} qui valide une clef
* unique sur une collection.
* <p/>
- * Le {@link #fieldName} sert à récupérer la propriété de type de collection du bean.
+ * Le {@link #fieldName} sert à récupérer la propriété de type de collection du
+ * bean.
*
* @author chemit
*/
@@ -40,12 +41,13 @@
/**
* pour indiquer la propriété qui contient la liste à valider.
- *
+ * <p/>
* Si cette prorpiété n'est pas renseignée alors on utilise la
* {@link #getFieldName()} pour obtenir la collection.
- *
+ * <p/>
* Cela permet d'effectuer une validation si une collection mais portant
* en fait sur un autre champs
+ *
* @since 1.5
*/
protected String collectionFieldName;
@@ -62,8 +64,8 @@
protected String againstProperty;
/**
* Lors de l'utilisation de la againstProperty et qu'un ne peut pas utiliser
- * le equals sur l'objet, on peut spécifier une expression pour exclure des tests
- * à exclure lors de la recherche de la violation de clef unique.
+ * le equals sur l'objet, on peut spécifier une expression pour exclure des
+ * tests lors de la recherche de la violation de clef unique.
*/
protected String againstIndexExpression;
@@ -80,7 +82,7 @@
}
public void setKeys(String[] keys) {
- if (keys != null && keys.length == 1 && keys[0].indexOf(",") != -1) {
+ if (keys != null && keys.length == 1 && keys[0].indexOf(',') != -1) {
this.keys = keys[0].split(",");
} else {
this.keys = keys;
@@ -114,9 +116,17 @@
Collection<?> col = getCollection(object);
- Object againstBean = againstProperty == null ? null : getFieldValue(againstProperty, object);
+ if (log.isDebugEnabled()) {
+ log.debug("collection found : " + col);
+ }
+ Object againstBean = againstProperty == null ? null :
+ getFieldValue(againstProperty, object);
- Integer againstIndex = (Integer) (againstIndexExpression == null ? -1 : getFieldValue(againstIndexExpression, object));
+ if (log.isDebugEnabled()) {
+ log.debug("againtBean = " + againstBean);
+ }
+ Integer againstIndex = (Integer) (againstIndexExpression == null ?
+ -1 : getFieldValue(againstIndexExpression, object));
if (againstIndex == null) {
againstIndex = -1;
}
@@ -127,31 +137,42 @@
boolean answer = true;
- Integer againstHashCode = againstBean == null ? null : getUniqueKeyHashCode(againstBean);
-
+ Integer againstHashCode = againstBean == null ?
+ null : getUniqueKeyHashCode(againstBean);
+ if (log.isDebugEnabled()) {
+ log.debug("hash for new key " + againstHashCode);
+ }
List<Integer> hashCodes = new ArrayList<Integer>();
int index = 0;
for (Object o : col) {
Integer hash = getUniqueKeyHashCode(o);
+ if (log.isDebugEnabled()) {
+ log.debug("hash for object " + o + " = " + hash);
+ }
if (againstBean == null) {
if (hashCodes.contains(hash)) {
// on a deja rencontre cette clef unique,
// donc la validation a echouee
answer = false;
+ if (log.isDebugEnabled()) {
+ log.debug("Found same hashcode, not unique!");
+ }
break;
}
} else {
// utilisation de againstBean
if (againstIndex != -1) {
- if (index != againstIndex && hash.equals(againstHashCode)) {
+ if (index != againstIndex &&
+ hash.equals(againstHashCode)) {
// on a deja rencontre cette clef unique,
// donc la validation a echouee
answer = false;
break;
}
} else {
- if (!againstBean.equals(o) && hash.equals(againstHashCode)) {
+ if (!againstBean.equals(o) &&
+ hash.equals(againstHashCode)) {
// on a deja rencontre cette clef unique,
// donc la validation a echouee
answer = false;
@@ -173,11 +194,13 @@
/**
* Calcule pour une entrée donné, le hash de la clef unique
*
- * @param o l'entree de la collection dont on va calculer le hash de la clef unique
+ * @param o l'entree de la collection dont on va calculer le hash de
+ * la clef unique
* @return le hashCode calclé de la clef unique sur l'entrée donné
* @throws ValidationException if any pb to retreave properties values
*/
- protected Integer getUniqueKeyHashCode(Object o) throws ValidationException {
+ protected Integer getUniqueKeyHashCode(Object o)
+ throws ValidationException {
// calcul du hash à la volée
HashCodeBuilder builder = new HashCodeBuilder();
for (String key : this.keys) {
@@ -189,10 +212,12 @@
/**
* @param object the incoming object containing the collection to test
- * @return the collection of the incoming object given by the fieldName property
+ * @return the collection of the incoming object given by the fieldName
+ * property
* @throws ValidationException if any pb to retreave the collection
*/
- protected Collection<?> getCollection(Object object) throws ValidationException {
+ protected Collection<?> getCollection(Object object)
+ throws ValidationException {
String fieldName = getCollectionFieldName();
if (fieldName == null || fieldName.trim().isEmpty()) {
// on travaille directement sur le fieldName
@@ -216,7 +241,8 @@
}
if (!Collection.class.isInstance(obj)) {
- throw new ValidationException("field " + fieldName + " is not a collection type! (" + obj.getClass() + ")");
+ throw new ValidationException("field " + fieldName +
+ " is not a collection type! (" + obj.getClass() + ')');
}
return (Collection<?>) obj;
}
1
0
Author: tchemit
Date: 2010-02-21 11:26:26 +0100 (Sun, 21 Feb 2010)
New Revision: 1750
Modified:
trunk/pom.xml
Log:
Utilisation de mavenpom4redmine 2.0.5
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-20 15:12:34 UTC (rev 1749)
+++ trunk/pom.xml 2010-02-21 10:26:26 UTC (rev 1750)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0.4</version>
+ <version>2.0.5</version>
</parent>
<artifactId>jaxx</artifactId>
1
0
r1749 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator
by tchemit@users.nuiton.org 20 Feb '10
by tchemit@users.nuiton.org 20 Feb '10
20 Feb '10
Author: tchemit
Date: 2010-02-20 16:12:34 +0100 (Sat, 20 Feb 2010)
New Revision: 1749
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
Log:
reformat code
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java 2010-02-18 15:55:04 UTC (rev 1748)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java 2010-02-20 15:12:34 UTC (rev 1749)
@@ -60,7 +60,9 @@
* - a ${ was found in a jxpath token.
* @throws NullPointerException if internalClass parameter is null.
*/
- public static <O> PropertyDecorator<O> newPropertyDecorator(Class<O> internalClass, String property)
+ public static <O> PropertyDecorator<O> newPropertyDecorator(
+ Class<O> internalClass,
+ String property)
throws IllegalArgumentException, NullPointerException {
return new PropertyDecorator<O>(internalClass, property);
}
@@ -69,9 +71,11 @@
* Factory method to instanciate a new {@link JXPathDecorator} for the
* given class {@code internalClass} and expression.
*
- * @param internalClass the class of the objects decorated by the new decorator
+ * @param internalClass the class of the objects decorated by the new
+ * decorator
* @param expression the expression to use to decorated objects
- * @param <O> the generic type of class to be decorated by the new decorator
+ * @param <O> the generic type of class to be decorated by the
+ * new decorator
* @return the new instanciated decorator
* @throws IllegalArgumentException if the expression is not valid, says:
* <p/>
@@ -80,30 +84,47 @@
* - a ${ was found in a jxpath token.
* @throws NullPointerException if internalClass parameter is null.
*/
- public static <O> JXPathDecorator<O> newJXPathDecorator(Class<O> internalClass, String expression)
+ public static <O> JXPathDecorator<O> newJXPathDecorator(
+ Class<O> internalClass,
+ String expression)
throws IllegalArgumentException, NullPointerException {
Context<O> context = createJXPathContext(expression);
return new JXPathDecorator<O>(internalClass, expression, context);
}
- public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass,
- String expression,
- String separator)
+ public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(
+ Class<O> internalClass,
+ String expression,
+ String separator)
throws IllegalArgumentException, NullPointerException {
- return newMultiJXPathDecorator(internalClass, expression, separator, separator);
+ MultiJXPathDecorator<O> decorator = newMultiJXPathDecorator(
+ internalClass,
+ expression,
+ separator,
+ separator);
+ return decorator;
}
- public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass,
- String expression,
- String separator,
- String separatorReplacement)
+ public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(
+ Class<O> internalClass,
+ String expression,
+ String separator,
+ String separatorReplacement)
throws IllegalArgumentException, NullPointerException {
- Context<O>[] contexts = createMultiJXPathContext(expression, separator, separatorReplacement);
+ Context<O>[] contexts = createMultiJXPathContext(
+ expression,
+ separator,
+ separatorReplacement);
- return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts);
+ return new MultiJXPathDecorator<O>(
+ internalClass,
+ expression,
+ separator,
+ separatorReplacement,
+ contexts);
}
/**
@@ -113,9 +134,12 @@
* @param <O> type of data to sort
* @param decorator the decorator to use to sort
* @param datas the list of data to sort
- * @param pos the index of context to used in decorator to obtain sorted property.
+ * @param pos the index of context to used in decorator to obtain
+ * sorted property.
*/
- public static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos) {
+ public static <O> void sort(JXPathDecorator<O> decorator,
+ List<O> datas,
+ int pos) {
Comparator<O> c = null;
boolean cachedComparator = false;
try {
@@ -147,26 +171,34 @@
// seek end of jxpath
end = expression.indexOf("}", start + 1);
if (end == -1) {
- throw new IllegalArgumentException("could not find the rigth brace starting at car " + start + " : " + expression.substring(start + 2));
+ throw new IllegalArgumentException("could not find the rigth " +
+ "brace starting at car " + start + " : " +
+ expression.substring(start + 2));
}
String jxpath = expression.substring(start + 2, end);
// not allowed ${ inside a jxpath token
if (jxpath.indexOf("${") > -1) {
- throw new IllegalArgumentException("could not find a ${ inside a jxpath expression at car " + (start + 2) + " : " + jxpath);
+ throw new IllegalArgumentException("could not find a ${ " +
+ "inside a jxpath expression at car " +
+ (start + 2) + " : " + jxpath);
}
// save the jxpath token
lTokens.add(jxpath);
// replace jxpath token in expresion with a string format variable
- buffer.append("%").append(lTokens.size());
+ buffer.append('%').append(lTokens.size());
}
if (size > (end + 1)) {
// suffix after end jxpath (or all expression if no jxpath)
buffer.append(expression.substring(end + 1));
}
- return new Context<O>(buffer.toString(), lTokens.toArray(new String[lTokens.size()]));
+ return new Context<O>(buffer.toString(), lTokens.toArray(
+ new String[lTokens.size()]));
}
- public static <O> Context<O>[] createMultiJXPathContext(String expression, String separator, String separatorReplacement) {
+ public static <O> Context<O>[] createMultiJXPathContext(
+ String expression,
+ String separator,
+ String separatorReplacement) {
int sep = expression.indexOf(separator);
if (sep == -1) {
Context<O>[] result = newInstance(1);
@@ -190,7 +222,8 @@
//todo replace %index with %j
buffer.append(separatorReplacement).append(str);
}
- contexts[i] = createJXPathContext(buffer.substring(separatorReplacement.length()));
+ contexts[i] = createJXPathContext(
+ buffer.substring(separatorReplacement.length()));
}
return contexts;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-18 15:55:04 UTC (rev 1748)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-20 15:12:34 UTC (rev 1749)
@@ -29,13 +29,16 @@
/**
* JXPath decorator based on {@link String#format(String, Object...)} method.
* <p/>
- * To use it, give to him a expression where all jxpath to apply on bean are boxed in <code>${}</code>.
+ * To use it, give to him a expression where all jxpath to apply on bean are
+ * boxed in <code>${}</code>.
* <p/>
- * After the jxpath token you must specifiy the formatter to apply of the jxpath token.
+ * After the jxpath token you must specifiy the formatter to apply of the
+ * jxpath token.
* <p/>
* For example :
* <pre>
- * Decorator<Object> d = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class,"expr = ${expressions}$s");
+ * Decorator<Object> d = DecoratorUtils.newJXPathDecorator(
+ * JXPathDecorator.class,"expr = ${expressions}$s");
* assert "expr = %1$s" == d.getExpression();
* assert 1 == d.getNbToken();
* assert java.util.Arrays.asList("expression") == d.getTokens();
@@ -67,7 +70,10 @@
*/
protected String initialExpression;
- protected JXPathDecorator(Class<O> internalClass, String expression, Context<O> context) throws IllegalArgumentException, NullPointerException {
+ protected JXPathDecorator(Class<O> internalClass,
+ String expression,
+ Context<O> context)
+ throws IllegalArgumentException, NullPointerException {
super(internalClass);
this.initialExpression = expression;
if (context != null) {
@@ -87,7 +93,9 @@
try {
args[i] = getTokenValue(jxcontext, context.tokens[i]);
} catch (Exception e) {
- log.error("can not obtain token " + context.tokens[i] + "on object " + bean + " for reason " + e.getMessage(), e);
+ log.error("can not obtain token " + context.tokens[i]
+ + "on object " + bean + " for reason " +
+ e.getMessage(), e);
}
}
@@ -117,7 +125,7 @@
@Override
public String toString() {
- return super.toString() + "<" + context + ">";
+ return super.toString() + '<' + context + '>';
}
public void setContext(Context<O> context) {
@@ -137,7 +145,8 @@
}
@SuppressWarnings({"unchecked"})
- protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) {
+ protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext,
+ String token) {
// assume all values are comparable
return (Comparable<Comparable<?>>) jxcontext.getValue(token);
}
@@ -176,7 +185,8 @@
clear();
for (O data : datas) {
JXPathContext jxcontext = JXPathContext.newContext(data);
- Comparable<Comparable<?>> key = decorator.getTokenValue(jxcontext, expression);
+ Comparable<Comparable<?>> key;
+ key = decorator.getTokenValue(jxcontext, expression);
valueCache.put(data, key);
}
}
@@ -185,8 +195,8 @@
public static class Context<O> implements java.io.Serializable {
/**
- * expression to format using {@link String#format(String, Object...)}, all variables are compute
- * using using the jxpath tokens.
+ * expression to format using {@link String#format(String, Object...)},
+ * all variables are compute using using the jxpath tokens.
*/
protected String expression;
/**
@@ -218,13 +228,16 @@
@Override
public String toString() {
- return "<expression:" + expression + ", tokens:" + Arrays.toString(tokens) + ">";
+ return "<expression:" + expression + ", tokens:" +
+ Arrays.toString(tokens) + '>';
}
}
protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) {
if (pos < -1 || pos > decorator.getNbToken()) {
- throw new ArrayIndexOutOfBoundsException("token index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.nbToken + "]");
+ throw new ArrayIndexOutOfBoundsException("token index " + pos +
+ " is out of bound, can be inside [" +
+ 0 + ',' + decorator.nbToken + ']');
}
}
}
1
0
r1748 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 18 Feb '10
by sletellier@users.nuiton.org 18 Feb '10
18 Feb '10
Author: sletellier
Date: 2010-02-18 16:55:04 +0100 (Thu, 18 Feb 2010)
New Revision: 1748
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
Log:
Add javadoc for deprecated methods
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-17 19:16:35 UTC (rev 1747)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-18 15:55:04 UTC (rev 1748)
@@ -102,9 +102,13 @@
return r;
}
+ /**
+ * @deprecated please use {@link #getModel(JAXXContext)}, will be remove soon
+ * @param context
+ */
@Deprecated
public NavigationTreeModel getTreeModel(JAXXContext context) {
- NavigationModel r = getModelContextEntry().getContextValue(context);
+ NavigationModel r = getModel(context);
if (r instanceof NavigationTreeModel){
return (NavigationTreeModel)r;
}
@@ -143,7 +147,7 @@
*/
@Deprecated
public void setTreeModel(JAXXContext context, NavigationModel model) {
- getModelContextEntry().setContextValue(context, model);
+ setModel(context, model);
}
public void setModel(JAXXContext context, NavigationModel model) {
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-17 19:16:35 UTC (rev 1747)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-18 15:55:04 UTC (rev 1748)
@@ -250,12 +250,13 @@
}
}
+ /**
+ * @deprecated please use {@link #getSafeModel(JAXXContext)}, will be remove soon
+ * @param context
+ */
@Deprecated
public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException {
- NavigationModel model = getModel(context);
- if (model == null) {
- throw new NullPointerException("could not find tree model with key " + getModelContextEntry() + " in context " + context);
- }
+ NavigationModel model = getSafeModel(context);
if (model instanceof NavigationTreeModel){
return (NavigationTreeModel) model;
}
1
0
r1747 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by tchemit@users.nuiton.org 17 Feb '10
by tchemit@users.nuiton.org 17 Feb '10
17 Feb '10
Author: tchemit
Date: 2010-02-17 20:16:35 +0100 (Wed, 17 Feb 2010)
New Revision: 1747
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
Log:
reformat code
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-17 19:10:30 UTC (rev 1746)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-17 19:16:35 UTC (rev 1747)
@@ -39,7 +39,8 @@
* @author chemit
* @since 1.7.2
*/
-public class NavigationTreeModel extends DefaultTreeModel implements NavigationModel{
+public class NavigationTreeModel extends DefaultTreeModel implements
+ NavigationModel{
static private final long serialVersionUID = 1L;
/**
@@ -103,14 +104,19 @@
/**
* @see NavigationModel#findNode(NavigationTreeNode, String, String)
*/
- public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) {
- return findNode(root, path, regex == null ? null : Pattern.compile(regex));
+ public NavigationTreeNode findNode(NavigationTreeNode root,
+ String path,
+ String regex) {
+ return findNode(root, path,
+ regex == null ? null : Pattern.compile(regex));
}
/**
* @see NavigationModel#findNode(NavigationTreeNode, String, Pattern)
*/
- public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) {
+ public NavigationTreeNode findNode(NavigationTreeNode root,
+ String path,
+ Pattern regex) {
if (regex != null) {
Matcher matcher = regex.matcher(path);
if (!matcher.matches() || matcher.groupCount() < 1) {
1
0
r1746 - in trunk/jaxx-runtime/src: main/java/jaxx/runtime/swing/navigation test/java/jaxx/runtime/validator
by tchemit@users.nuiton.org 17 Feb '10
by tchemit@users.nuiton.org 17 Feb '10
17 Feb '10
Author: tchemit
Date: 2010-02-17 20:10:30 +0100 (Wed, 17 Feb 2010)
New Revision: 1746
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java
Log:
fix javadoc + clean contracts + improve AbstractBeanValidatorDetectorTest
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java 2010-02-17 14:49:35 UTC (rev 1745)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java 2010-02-17 19:10:30 UTC (rev 1746)
@@ -30,20 +30,23 @@
/**
* Init the ui just before been opened by the method
- * {@link NavigationTreeHandler#openUI(java.awt.Component, jaxx.runtime.swing.navigation.NavigationTreeNode)}.
+ * {@link NavigationTreeHandler#openUI(java.awt.Component,
+ * jaxx.runtime.swing.navigation.NavigationTreeNode)}.
*
* @param node the selected node associated to the ui
- * @throws Exception
- * @see NavigationTreeHandler#openUI(java.awt.Component, jaxx.runtime.swing.navigation.NavigationTreeNode)
+ * @throws Exception if any pb while opening the content's ui
+ * @see NavigationTreeHandler#openUI(java.awt.Component,
+ * jaxx.runtime.swing.navigation.NavigationTreeNode)
*/
void openUI(NavigationTreeNode node) throws Exception;
/**
- * Clean the ui after been closed by the method {@link NavigationTreeHandler#closeUI(java.awt.Component)}.
+ * Clean the ui after been closed by the method
+ * {@link NavigationTreeHandler#closeUI(java.awt.Component)}.
*
* @param node the selected node associated to the ui
- * @throws Exception
- * @see NavigationTreeHandler#closeUI(java.awt.Component)
+ * @throws Exception if any pb when closing the content'sui
+ * @see NavigationTreeHandler#closeUI(java.awt.Component)
*/
void closeUI(NavigationTreeNode node) throws Exception;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java 2010-02-17 14:49:35 UTC (rev 1745)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java 2010-02-17 19:10:30 UTC (rev 1746)
@@ -21,9 +21,7 @@
package jaxx.runtime.swing.navigation;
import jaxx.runtime.JAXXContext;
-import org.jdesktop.swingx.treetable.TreeTableNode;
-import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import java.util.regex.Pattern;
@@ -37,28 +35,31 @@
*/
public interface NavigationModel {
- public Object getRoot();
+ Object getRoot();
- public TreeNode[] getPathToRoot(TreeNode aNode);
+ TreeNode[] getPathToRoot(TreeNode aNode);
/**
- * Search from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by dot.
+ * Search from the root node a node named by his fully path (concatenation
+ * of nodes {@link NavigationTreeNode#path} valued separated by dot.
* <p/>
* Example :
* <p/>
* <pre>$root.child1.leaf1</pre>
*
* @param path the fully path of the searched node.
- * @return the node matching the fully context from the root node, or <code>null</code> if not find.
+ * @return the node matching the fully context from the root node,
+ * or <code>null</code> if not find.
*/
- public NavigationTreeNode findNode(String path);
+ NavigationTreeNode findNode(String path);
/**
- * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null.
+ * Apply first the regex pattern to obtain the searched node fi the given
+ * <code>regex</code> is not null.
* <p/>
- * Search then from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * Search then from the root node a node named by his fully path
+ * (concatenation of nodes {@link NavigationTreeNode#path} valued separated
+ * by {@link #getPathSeparator()}.
* <p/>
* <p/>
* Example :
@@ -67,15 +68,17 @@
*
* @param path the fully path of the searched node.
* @param regex a optional regex to apply to path before searching
- * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ * @return the node matching the fully context from the root node, or
+ * <code>null</code> if not found.
*/
- public NavigationTreeNode findNode(String path, String regex);
+ NavigationTreeNode findNode(String path, String regex);
/**
* Apply first the regex pattern to obtain the searched node.
* <p/>
- * Search then from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * Search then from the root node a node named by his fully path
+ * (concatenation of nodes {@link NavigationTreeNode#path} valued separated
+ * by {@link #getPathSeparator()}.
* <p/>
* Example :
* <p/>
@@ -83,55 +86,65 @@
*
* @param path the fully path of the searched node.
* @param regex a optional regex to apply to path before searching
- * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ * @return the node matching the fully context from the root node, or
+ * <code>null</code> if not found.
*/
- public NavigationTreeNode findNode(String path, Pattern regex);
+ NavigationTreeNode findNode(String path, Pattern regex);
/**
- * Search from a given root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * Search from a given root node a node named by his fully path
+ * (concatenation of nodes {@link NavigationTreeNode#path} valued separated
+ * by {@link #getPathSeparator()}.
*
* @param root root node to be used
* @param path the fully path of the searched node.
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @return the node matching the fully context from the given root node, or
+ * <code>null</code> if not found.
*/
- public NavigationTreeNode findNode(NavigationTreeNode root, String path);
+ NavigationTreeNode findNode(NavigationTreeNode root, String path);
/**
* Apply first the regex pattern to obtain the searched node.
* <p/>
- * Search then from a given root node a node named by his fully path (concatenation of nodes)
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * Search then from a given root node a node named by his fully path
+ * (concatenation of nodes) {@link NavigationTreeNode#path} valued
+ * separated by {@link #getPathSeparator()}.
*
* @param root root node to be used
* @param path the fully path of the searched node.
* @param regex a previous regex to apply to path : must have a matches
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @return the node matching the fully context from the given root node,
+ * or <code>null</code> if not found.
*/
- public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex);
+ NavigationTreeNode findNode(NavigationTreeNode root, String path,
+ String regex);
/**
* Apply first the regex pattern to obtain the searched node.
* <p/>
- * Search then from a given root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * Search then from a given root node a node named by his fully path
+ * (concatenation of nodes {@link NavigationTreeNode#path} valued separated
+ * by {@link #getPathSeparator()}.
*
* @param root root node to be used
* @param path the fully path of the searched node.
* @param regex a previous regex to apply to path : must have a matches
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @return the node matching the fully context from the given root node,
+ * or <code>null</code> if not found.
*/
- public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex);
+ NavigationTreeNode findNode(NavigationTreeNode root, String path,
+ Pattern regex);
- public JAXXContext getContext();
+ JAXXContext getContext();
/**
- * Obtain the associated bean value from context corresponding to node from given navigation path.
+ * Obtain the associated bean value from context corresponding to node
+ * from given navigation path.
*
* @param navigationPath the current context path of the node
* @return the value associated in context with the given navigation path
*/
- public Object getBean(String navigationPath);
+ Object getBean(String navigationPath);
/**
* Obtain the associated bean value from context corresponding to node
@@ -139,13 +152,13 @@
* @param node the current node
* @return the value associated in context with the given node.
*/
- public Object getBean(NavigationTreeNode node);
+ Object getBean(NavigationTreeNode node);
- public void nodeChanged(TreeNode node);
+ void nodeChanged(TreeNode node);
- public void nodeStructureChanged(TreeNode node);
+ void nodeStructureChanged(TreeNode node);
- public void nodeChanged(TreeNode node, boolean deep);
+ void nodeChanged(TreeNode node, boolean deep);
- public String getPathSeparator();
+ String getPathSeparator();
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java 2010-02-17 14:49:35 UTC (rev 1745)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java 2010-02-17 19:10:30 UTC (rev 1746)
@@ -21,75 +21,80 @@
package jaxx.runtime.swing.navigation;
import jaxx.runtime.JAXXAction;
-import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.decorator.Decorator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import java.util.Enumeration;
-
/**
- * Interface to create a builder, this object is design to build a {@link NavigationModel}.
+ * Interface to create a builder, this object is design to build a
+ * {@link NavigationModel}.
*
* @author sletellier
* @since 2.0.0
*/
public interface NavigationModelBuilder {
- public NavigationModel getModel();
+ NavigationModel getModel();
- public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName);
+ NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef,
+ String contextName);
- public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
- JAXXContextEntryDef<?> entryDef,
- String entryPath,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
- JAXXContextEntryDef<?> entryDef,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
- String entryPath,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ String libelle,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
- JAXXContextEntryDef<?> entryDef,
- String entryPath,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
- JAXXContextEntryDef<?> entryDef,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
- String entryPath,
- String contextName,
- Class<? extends JAXXObject> uiClass,
- Class<? extends JAXXAction> actionClass);
+ NavigationTreeNode build(NavigationTreeNode parentNode,
+ Decorator<?> decorator,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
- public NavigationTreeNode removeChildNode(NavigationTreeNode node);
+ NavigationTreeNode removeChildNode(NavigationTreeNode node);
- public void addI18nNodeRenderer(NavigationTreeNode node, String libelle);
+ void addI18nNodeRenderer(NavigationTreeNode node,
+ String libelle);
- public void addDecoratorNodeRenderer(NavigationTreeNode node, Decorator<?> decorator);
+ void addDecoratorNodeRenderer(NavigationTreeNode node,
+ Decorator<?> decorator);
- public void addNodeJaxxClasses(
+ void addNodeJaxxClasses(
NavigationTreeNode node,
Class<? extends JAXXObject> uIClass,
Class<? extends JAXXAction> uIHandlerClass);
- public void printModel(NavigationTreeNode node);
+ void printModel(NavigationTreeNode node);
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-17 14:49:35 UTC (rev 1745)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-17 19:10:30 UTC (rev 1746)
@@ -65,7 +65,7 @@
}
/**
- * @see {NavigationModel#getRoot()}
+ * @see NavigationModel#getRoot()
*/
@Override
public NavigationTreeNode getRoot() {
@@ -73,42 +73,42 @@
}
/**
- * @see {NavigationModel#findNode(String)}
+ * @see NavigationModel#findNode(String)
*/
public NavigationTreeNode findNode(String path) {
return findNode(getRoot(), path, (Pattern) null);
}
/**
- * @see {NavigationModel#findNode(String, String)}
+ * @see NavigationModel#findNode(String, String)
*/
public NavigationTreeNode findNode(String path, String regex) {
return findNode(getRoot(), path, regex);
}
/**
- * @see {NavigationModel#findNode(String, Pattern)}
+ * @see NavigationModel#findNode(String, Pattern)
*/
public NavigationTreeNode findNode(String path, Pattern regex) {
return findNode(getRoot(), path, regex);
}
/**
- * @see {NavigationModel#findNode(NavigationTreeNode, String)}
+ * @see NavigationModel#findNode(NavigationTreeNode, String)
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path) {
return findNode(root, path, (Pattern) null);
}
/**
- * @see {NavigationModel#findNode(NavigationTreeNode, String, String)}
+ * @see NavigationModel#findNode(NavigationTreeNode, String, String)
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) {
return findNode(root, path, regex == null ? null : Pattern.compile(regex));
}
/**
- * @see {NavigationModel#findNode(NavigationTreeNode, String, Pattern)}
+ * @see NavigationModel#findNode(NavigationTreeNode, String, Pattern)
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) {
if (regex != null) {
@@ -138,14 +138,14 @@
}
/**
- * @see {NavigationModel#getContext()}
+ * @see NavigationModel#getContext()
*/
public JAXXContext getContext() {
return context;
}
/**
- * @see {NavigationModel#getBean(String)}
+ * @see NavigationModel#getBean(String)
*/
public Object getBean(String navigationPath) {
Object result;
@@ -155,7 +155,7 @@
}
/**
- * @see {NavigationModel#getBean(NavigationTreeNode)}
+ * @see NavigationModel#getBean(NavigationTreeNode)
*/
public Object getBean(NavigationTreeNode node) {
if (node == null) {
@@ -167,7 +167,7 @@
}
/**
- * @see {NavigationModel#nodeChanged(TreeNode)}
+ * @see NavigationModel#nodeChanged(TreeNode)
*/
@Override
public void nodeChanged(TreeNode node) {
@@ -178,7 +178,7 @@
}
/**
- * @see {NavigationModel#nodeStructureChanged(TreeNode)}
+ * @see NavigationModel#nodeStructureChanged(TreeNode)
*/
@Override
public void nodeStructureChanged(TreeNode node) {
@@ -192,7 +192,7 @@
}
/**
- * @see {NavigationModel#nodeChanged(TreeNode, boolean)}
+ * @see NavigationModel#nodeChanged(TreeNode, boolean)
*/
public void nodeChanged(TreeNode node, boolean deep) {
@@ -222,7 +222,7 @@
}
/**
- * @see {NavigationModel#getPathSeparator()}
+ * @see NavigationModel#getPathSeparator()
*/
public String getPathSeparator() {
return pathSeparator;
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java 2010-02-17 14:49:35 UTC (rev 1745)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java 2010-02-17 19:10:30 UTC (rev 1746)
@@ -23,8 +23,10 @@
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Iterator;
import java.util.SortedSet;
import java.util.regex.Pattern;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After;
@@ -34,35 +36,41 @@
/**
* An abstract test to detects validators for a given list of objets types and
- *
+ * <p/>
* a given sourceroot directory where to find validations definitions.
- *
+ * <p/>
* You just have to implements to {@link #assertDetect(SortedSet)} which contains
* the set of validators detected.
- *
+ * <p/>
* See {@link BeanValidatorDetectorTest} for an example.
- *
+ * <p/>
* Note : An implementation of this test should be produced in evry projects which
* defines some validation definitions just to test they are syntax valid.
- *
+ *
* @author chemit
* @since 1.6.0
*/
public abstract class AbstractBeanValidatorDetectorTest {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- private static final Log log = LogFactory.getLog(AbstractBeanValidatorDetectorTest.class);
+ /** Logger */
+ private static final Log log =
+ LogFactory.getLog(AbstractBeanValidatorDetectorTest.class);
protected static File basedir;
protected BeanValidatorDetector instance;
protected Class<?>[] classes;
protected Class<?> validatorClass;
protected File sourceRoot;
- protected AbstractBeanValidatorDetectorTest(File sourceRoot, Class<?>... classes) {
+ protected AbstractBeanValidatorDetectorTest(
+ File sourceRoot,
+ Class<?>... classes) {
this(BeanValidator.class, sourceRoot, classes);
}
- protected AbstractBeanValidatorDetectorTest(Class<?> validatorClass, File sourceRoot, Class<?>... classes) {
+ protected AbstractBeanValidatorDetectorTest(
+ Class<?> validatorClass,
+ File sourceRoot,
+ Class<?>... classes) {
this.sourceRoot = sourceRoot;
this.classes = classes;
this.validatorClass = validatorClass;
@@ -72,7 +80,9 @@
log.info("classes " + Arrays.toString(classes));
}
- protected AbstractBeanValidatorDetectorTest(File sourceRoot, Collection<Class<?>> classes) {
+ protected AbstractBeanValidatorDetectorTest(
+ File sourceRoot,
+ Collection<Class<?>> classes) {
this(sourceRoot, classes.toArray(new Class<?>[classes.size()]));
}
@@ -105,23 +115,67 @@
assertDetect(result);
}
- protected abstract void assertDetect(SortedSet<BeanValidator<?>> validators);
+ protected abstract void assertDetect(
+ SortedSet<BeanValidator<?>> validators);
- protected SortedSet<BeanValidator<?>> detect(File sourceRoot, Class<?>[] classes, Pattern contextPattern) {
- SortedSet<BeanValidator<?>> result = instance.detect(validatorClass, sourceRoot, contextPattern, classes);
+ protected SortedSet<BeanValidator<?>> detect(
+ File sourceRoot,
+ Class<?>[] classes,
+ Pattern contextPattern) {
+
+ SortedSet<BeanValidator<?>> result = instance.detect(
+ validatorClass,
+ sourceRoot,
+ contextPattern,
+ classes);
return result;
}
- protected void assertValidator(Class<?> expectedBeanClass, String expectedContextName, BeanValidator<?> validator) {
+ protected static void assertValidator(
+ Class<?> expectedBeanClass,
+ String expectedContextName,
+ BeanValidator<?> validator) {
assertEquals(expectedBeanClass, validator.getBeanClass());
assertEquals(expectedContextName, validator.getContextName());
}
- protected String printValidators(String prefix, SortedSet<BeanValidator<?>> result) {
- StringBuilder buffer = new StringBuilder();
- buffer.append(prefix).append(result.size()).append("\n");
+ protected static void assertValidatorSetWithSameContextName(
+ SortedSet<BeanValidator<?>> validators,
+ String contextName,
+ Class<?>... expectedClasses) {
+
+ assertEquals(expectedClasses.length, validators.size());
+ Iterator<BeanValidator<?>> itrV = validators.iterator();
+
+ for (Class<?> expectedClass : expectedClasses) {
+ assertValidator(expectedClass, contextName, itrV.next());
+ }
+ }
+
+ protected static void assertValidatorSetWithMultiContextName(
+ SortedSet<BeanValidator<?>> validators,
+ Object... expecteds) {
+
+ assertEquals(expecteds.length % 2, 0);
+ assertEquals(expecteds.length / 2, validators.size());
+ Iterator<BeanValidator<?>> itrV = validators.iterator();
+
+ for (int i = 0; i < expecteds.length / 2; i++) {
+ String contextName = (String) expecteds[2 * i];
+ Class<?> expectedClass = (Class<?>) expecteds[2 * i + 1];
+ assertValidator(expectedClass, contextName, itrV.next());
+ }
+
+ }
+
+ protected static String printValidators(
+ String prefix,
+ SortedSet<BeanValidator<?>> result) {
+ StringBuilder buffer;
+ buffer = new StringBuilder(result.size() * (prefix.length() + 50));
+ buffer.append(prefix).append(result.size()).append('\n');
for (BeanValidator<?> v : result) {
- buffer.append(prefix).append(v).append("\n");
+ buffer.append(prefix).append(v).append('\n');
}
return buffer.toString();
}
1
0
17 Feb '10
Author: tchemit
Date: 2010-02-17 15:49:35 +0100 (Wed, 17 Feb 2010)
New Revision: 1745
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
Log:
Evolution #322: Improve editable and focusable properties on EntityComboBox
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2010-02-17 10:58:26 UTC (rev 1744)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx 2010-02-17 14:49:35 UTC (rev 1745)
@@ -104,7 +104,7 @@
toolTipText='entitycombobox.action.reset.tip'
focusable='false'
focusPainted='false'
- enabled='{isEnabled()}'
+ enabled='{isEditable() && isEnabled()}'
onActionPerformed='setSelectedItem(null)'/>
</JToolBar>
@@ -115,6 +115,7 @@
selectedItem='{getSelectedItem()}'
enabled='{isEnabled()}'
editable='{isEditable()}'
+ focusable='{isEnabled() && isEditable()}'
onFocusGained='hidePopup()'
onItemStateChanged='setSelectedItem(combobox.getSelectedItem())'/>
</cell>
1
0
r1744 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor
by tchemit@users.nuiton.org 17 Feb '10
by tchemit@users.nuiton.org 17 Feb '10
17 Feb '10
Author: tchemit
Date: 2010-02-17 11:58:26 +0100 (Wed, 17 Feb 2010)
New Revision: 1744
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java
Log:
Evolution #320: Can build EnumEditor on restricted values of enum universe
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java 2010-02-15 17:09:42 UTC (rev 1743)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java 2010-02-17 10:58:26 UTC (rev 1744)
@@ -21,6 +21,8 @@
import javax.swing.JComboBox;
import java.util.EnumSet;
+import java.util.Iterator;
+
import org.nuiton.util.ReflectUtil;
/**
@@ -34,18 +36,64 @@
*/
public class EnumEditor<E extends Enum<E>> extends JComboBox {
- /** serialVersionUID */
- private static final long serialVersionUID = 2693771553067104538L;
+ private static final long serialVersionUID = 2L;
+ /**
+ * Type of enumeration
+ */
protected Class<E> type;
+ /**
+ * Creates a {@link EnumEditor} for the given enumeration {@code type}, with
+ * all values of enumeration.
+ *
+ * @param type type of enumeration
+ * @param <E> generci type of enumeration
+ * @return the instanciated editor
+ */
public static <E extends Enum<E>> EnumEditor<E> newEditor(Class<E> type) {
return new EnumEditor<E>(type);
}
+
+ /**
+ * Creates a {@link EnumEditor} for the given enumeration {@code type}, with
+ * all values of enumeration which {@code ordinal} is strictly lower than
+ * the given {@code maxOrdinal}.
+ *
+ * @param type type of enumeration
+ * @param maxOrdinal the upper (strict) bound of ordinal values allowed
+ * @param <E> generic type of enumeration
+ * @return the instanciated editor
+ */
+ public static <E extends Enum<E>> EnumEditor<E> newEditor(Class<E> type,
+ int maxOrdinal) {
+ return new EnumEditor<E>(type, maxOrdinal);
+ }
+
+ /**
+ * Creates a {@link EnumEditor} for the given enumeration {@code type}, with
+ * all given {@code universe} values of enumeration.
+ *
+ * @param universe enumerations to put in editor
+ * @param <E> generci type of enumeration
+ * @return the instanciated editor
+ */
+ public static <E extends Enum<E>> EnumEditor<E> newEditor(E... universe) {
+ return new EnumEditor<E>(universe);
+ }
+
public EnumEditor(Class<E> type) {
super(buildModel(type));
}
+ public EnumEditor(Class<E> type, int maxOrdinal) {
+ super(buildModel(type, maxOrdinal));
+ }
+
+ public EnumEditor(E... universe) {
+ super(universe);
+ }
+
@Override
public E getSelectedItem() {
return (E) super.getSelectedItem();
@@ -56,4 +104,19 @@
EnumSet<E> result = EnumSet.allOf(enumClass);
return result.toArray(new Object[result.size()]);
}
+
+
+ protected static <E extends Enum<E>> Object[] buildModel(Class<E> type,
+ int maxOrdinal) {
+ Class<E> enumClass = ReflectUtil.getEnumClass(type);
+ EnumSet<E> result = EnumSet.allOf(enumClass);
+ Iterator<E> itr = result.iterator();
+ while (itr.hasNext()) {
+ E e = itr.next();
+ if (e.ordinal() > maxOrdinal) {
+ itr.remove();
+ }
+ }
+ return result.toArray(new Object[result.size()]);
+ }
}
1
0
r1743 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 15 Feb '10
by sletellier@users.nuiton.org 15 Feb '10
15 Feb '10
Author: sletellier
Date: 2010-02-15 18:09:42 +0100 (Mon, 15 Feb 2010)
New Revision: 1743
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
Log:
Revert class cast exception
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 16:56:21 UTC (rev 1742)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 17:09:42 UTC (rev 1743)
@@ -44,7 +44,7 @@
* <p/>
* Il est composé de {@link NavigationTreeNode}
*
- * FIXME : Essayer d'enlever les copier coller {@link NavigationTreeModel}
+ * FIXME : Essayer d'enlever les copier coller {@link NavigationTreeModel}
*
* @author sletellier
* @since 2.0.0
@@ -228,7 +228,7 @@
*/
public void nodeChanged(TreeNode node) {
if (node != null){
- MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
@@ -246,7 +246,7 @@
*/
public void nodeStructureChanged(TreeNode node) {
if (node != null){
- MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireTreeStructureChanged(new TreePath(treeNodes));
@@ -264,7 +264,7 @@
*/
public void nodeChanged(TreeNode node, boolean deep) {
if (node != null){
- MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
1
0
r1742 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 15 Feb '10
by sletellier@users.nuiton.org 15 Feb '10
15 Feb '10
Author: sletellier
Date: 2010-02-15 17:56:21 +0100 (Mon, 15 Feb 2010)
New Revision: 1742
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
Log:
Fix class cast exception
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 16:29:38 UTC (rev 1741)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 16:56:21 UTC (rev 1742)
@@ -40,10 +40,12 @@
import java.util.regex.Pattern;
/**
- * Model of the tree used for a navigation tree table.
+ * Model of the tree table used for a navigation tree table.
* <p/>
* Il est composé de {@link NavigationTreeNode}
*
+ * FIXME : Essayer d'enlever les copier coller {@link NavigationTreeModel}
+ *
* @author sletellier
* @since 2.0.0
*/
@@ -226,7 +228,7 @@
*/
public void nodeChanged(TreeNode node) {
if (node != null){
- MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
@@ -244,7 +246,7 @@
*/
public void nodeStructureChanged(TreeNode node) {
if (node != null){
- MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireTreeStructureChanged(new TreePath(treeNodes));
@@ -262,7 +264,7 @@
*/
public void nodeChanged(TreeNode node, boolean deep) {
if (node != null){
- MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ MutableTreeTableNode parent = (MutableTreeTableNode)node.getParent();
TreeNode[] treeNodes = getPathToRoot(parent);
if (treeNodes != null){
modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
1
0
r1741 - in trunk: jaxx-demo/src/main/java/jaxx/demo jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation jaxx-runtime/src/main/java/jaxx/runtime jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 15 Feb '10
by sletellier@users.nuiton.org 15 Feb '10
15 Feb '10
Author: sletellier
Date: 2010-02-15 17:29:38 +0100 (Mon, 15 Feb 2010)
New Revision: 1741
Removed:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
Log:
Final implementation of NavigationTreeTable :
- remove hack
- NavigationTreeHandler is a TreeSelectionListener and TreeSelectionModel
- adding expandTreeTable and addExpendOnClickListener method for JXTreeTable in swingUtil
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -42,7 +42,6 @@
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
import jaxx.runtime.swing.navigation.*;
-import jaxx.runtime.swing.navigation.NavigationInstanciationStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n.n_;
@@ -149,7 +148,7 @@
handler = new NavigationTreeHandlerWithCardLayout(
getPrefix(),
context,
- NavigationInstanciationStrategy.PER_UI_TYPE) {
+ NavigationTreeHandler.Strategy.PER_UI_TYPE) {
private static final long serialVersionUID = 1L;
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -27,7 +27,6 @@
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
import jaxx.runtime.swing.navigation.*;
-import jaxx.runtime.swing.navigation.NavigationInstanciationStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -123,7 +122,7 @@
handler = new NavigationTreeHandlerWithCardLayout(
getPrefix(),
context,
- NavigationInstanciationStrategy.PER_UI_TYPE) {
+ NavigationTreeHandler.Strategy.PER_UI_TYPE) {
private static final long serialVersionUID = 1L;
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -36,7 +36,7 @@
import java.io.InputStream;
import java.util.List;
import javax.swing.*;
-import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
@@ -55,12 +55,11 @@
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Properties;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.TreeSelectionListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import jaxx.runtime.swing.navigation.NavigationTreeNode;
import jaxx.runtime.swing.renderer.BooleanCellRenderer;
import jaxx.runtime.swing.renderer.EmptyNumberTableCellRenderer;
import jaxx.runtime.swing.renderer.EnumTableCellRenderer;
@@ -70,6 +69,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.jxlayer.JXLayer;
+import org.jdesktop.swingx.JXTreeTable;
/**
* The runtime swing util class with some nice stuff.
@@ -793,6 +793,26 @@
}
/**
+ * Expand all childs of a tree table.
+ *
+ * FIXME : Voir pour enlever le copier coller
+ *
+ * @param treeTable the tree to expand
+ */
+ public static void expandTreeTable(final JXTreeTable treeTable) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ int i = 0;
+ while (i < treeTable.getRowCount()) {
+ treeTable.expandRow(i++);
+ }
+ }
+ });
+ }
+
+ /**
* Add a listener of tree selection model to expand a new selected node
* when it is selected.
*
@@ -826,6 +846,41 @@
}
/**
+ * Add a listener of tree table selection model to expand a new selected node
+ * when it is selected.
+ *
+ * FIXME : Voir pour enlever le copier coller
+ *
+ * @param treeTable the tree to treate
+ */
+ public static void addExpandOnClickListener(final JXTreeTable treeTable) {
+
+ treeTable.addTreeSelectionListener(new TreeSelectionListener() {
+
+ @Override
+ public void valueChanged(final TreeSelectionEvent e) {
+ TreeNode node = (TreeNode) e.getPath().getLastPathComponent();
+ if (node != null && !node.isLeaf()) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ for (TreePath path : e.getPaths()) {
+ if (e.isAddedPath(path) && !treeTable.isExpanded(path)) {
+ log.info("expand node [" + path + "]");
+ // will expand the node
+ treeTable.expandPath(path);
+ }
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+
+ /**
* Set the width of the given component
*
* @param component the component to resize
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -1,45 +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.swing.navigation;
-
-import jaxx.runtime.JAXXContext;
-
-/**
- * Interface to create an handler of a navigation tree.
- *
- * @author sletellier
- * @since 2.0.0
- */
-public interface NavigationHandler {
-
- /**
- * To get the context will be used by handler
- * @return {@link JAXXContext} to use
- */
- public JAXXContext getContext();
-
- /**
- * To get helper will be used by handler
- * @return {@link NavigationTreeContextHelper} to use
- */
- public NavigationTreeContextHelper getContextHelper();
-
-}
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -1,33 +0,0 @@
-package jaxx.runtime.swing.navigation;
-
-/**
- * Strategy of instanciation of ui.
- * <p/>
- * For a given {@code node}, the method {@link #getId(jaxx.runtime.swing.navigation.NavigationTreeNode)}
- * returns the id of ui to use.
- */
-public enum NavigationInstanciationStrategy {
-
- /**
- * instanciate a ui for a node
- */
- PER_NODE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getFullPath();
- }
- },
- /**
- * instanciate only one a ui for a type,nodes will share the instanciation
- */
- PER_UI_TYPE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getUIClass().getName();
- }
- };
-
- public abstract String getId(NavigationTreeNode node);
-}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -66,7 +66,7 @@
protected JAXXContextEntryDef<Object> selectedBeanContextEntry;
protected JAXXContextEntryDef<NavigationTreeNode> selectedNodeContextEntry;
protected JAXXContextEntryDef<NavigationModel> modelContextEntry;
- protected JAXXContextEntryDef<NavigationHandler> handlerContextEntry;
+ protected JAXXContextEntryDef<NavigationTreeHandler> handlerContextEntry;
protected JAXXContextEntryDef<JTree> treeContextEntry;
protected JAXXContextEntryDef<JXTreeTable> treeTableContextEntry;
// protected JAXXContextEntryDef<Component> selectedUIContextEntry;
@@ -76,7 +76,7 @@
treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
treeTableContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-table", JXTreeTable.class);
modelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-model", NavigationModel.class);
- handlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-handler", NavigationHandler.class);
+ handlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-handler", NavigationTreeHandler.class);
selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
@@ -111,14 +111,8 @@
return null;
}
- /**
- * @deprecated please use {@link #getHandler(JAXXContext)}, will be remove soon
- * @param context
- * @return handler
- */
- @Deprecated
- public NavigationHandler getTreeHandler(JAXXContext context) {
- NavigationHandler r = getTreeHandlerContextEntry().getContextValue(context);
+ public NavigationTreeHandler getTreeHandler(JAXXContext context) {
+ NavigationTreeHandler r = getTreeHandlerContextEntry().getContextValue(context);
return r;
}
@@ -164,20 +158,10 @@
getTreeTableContextEntry().setContextValue(context, treeTable);
}
- /**
- * @deprecated please use {@link #setHandler(JAXXContext, NavigationHandler)}, will be remove soon
- * @param context
- * @param handler
- */
- @Deprecated
- public void setTreeHandler(JAXXContext context, NavigationHandler handler) {
+ public void setTreeHandler(JAXXContext context, NavigationTreeHandler handler) {
getTreeHandlerContextEntry().setContextValue(context, handler);
}
- public void setHandler(JAXXContext context, NavigationHandler handler) {
- getHandlerContextEntry().setContextValue(context, handler);
- }
-
public void setSelectedPath(JAXXContext context, String path) {
if (path == null) {
getSelectedPathContextEntry().removeContextValue(context);
@@ -214,15 +198,10 @@
return modelContextEntry;
}
- @Deprecated
- protected JAXXContextEntryDef<NavigationHandler> getTreeHandlerContextEntry() {
+ protected JAXXContextEntryDef<NavigationTreeHandler> getTreeHandlerContextEntry() {
return handlerContextEntry;
}
- public JAXXContextEntryDef<NavigationHandler> getHandlerContextEntry() {
- return handlerContextEntry;
- }
-
protected JAXXContextEntryDef<Object> getSelectedBeanContextEntry() {
return selectedBeanContextEntry;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -42,7 +42,7 @@
* @author tony
* @since 1.7.2
*/
-public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel implements NavigationHandler{
+public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel implements TreeSelectionListener{
private static final long serialVersionUID = 1L;
/**
@@ -51,13 +51,44 @@
static private final Log log = LogFactory.getLog(NavigationTreeHandler.class);
/**
+ * Strategy of instanciation of ui.
+ * <p/>
+ * For a given {@code node}, the method {@link #getId(NavigationTreeNode)}
+ * returns the id of ui to use.
+ */
+ public enum Strategy {
+
+ /**
+ * instanciate a ui for a node
+ */
+ PER_NODE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getFullPath();
+ }
+ },
+ /**
+ * instanciate only one a ui for a type,nodes will share the instanciation
+ */
+ PER_UI_TYPE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getUIClass().getName();
+ }
+ };
+
+ public abstract String getId(NavigationTreeNode node);
+ }
+ /**
* UI which contains navigation tree
*/
protected JAXXContext context;
/**
* UI Instanciation strategy
*/
- protected NavigationInstanciationStrategy strategy;
+ protected Strategy strategy;
/**
* JAXXContext access helper.
@@ -66,22 +97,25 @@
*/
protected NavigationTreeContextHelper contextHelper;
- protected NavigationTreeHandler(String contextPrefix, JAXXObject context, NavigationInstanciationStrategy strategy) {
+ protected NavigationTreeHandler(String contextPrefix, JAXXObject context, Strategy strategy) {
this.contextHelper = new NavigationTreeContextHelper(contextPrefix);
this.context = context;
this.strategy = strategy;
- addTreeSelectionListener(new TreeSelectionListener() {
+ addTreeSelectionListener(this);
+ }
- @Override
- public void valueChanged(TreeSelectionEvent event) {
- if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) {
- // do not treate this if no path changed
- return;
- }
- NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent();
- selectNodeUI(node);
- }
- });
+ @Override
+ public void valueChanged(TreeSelectionEvent event) {
+ if (log.isDebugEnabled()){
+ log.debug("Value changed for path : " + event.getPath());
+ log.debug("Old lead selection path : " + event.getOldLeadSelectionPath());
+ }
+ if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) {
+ // do not treate this if no path changed
+ return;
+ }
+ NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent();
+ selectNodeUI(node);
}
/**
@@ -133,16 +167,10 @@
*/
protected abstract void treateError(Exception e);
- /**
- * {@see NavigationHandler#getContext()
- **/
public JAXXContext getContext() {
return context;
}
- /**
- * {@see NavigationHandler#getContextHelper()
- **/
public NavigationTreeContextHelper getContextHelper() {
return contextHelper;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -61,7 +61,7 @@
*/
protected abstract CardLayout2 getContentLayout();
- public NavigationTreeHandlerWithCardLayout(String contextPrefix, JAXXObject context, NavigationInstanciationStrategy strategy) {
+ public NavigationTreeHandlerWithCardLayout(String contextPrefix, JAXXObject context, Strategy strategy) {
super(contextPrefix, context, strategy);
if (getContentContainer() == null) {
throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context);
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -62,7 +62,7 @@
* @param context the context to associate with fresh handler
* @return the new handler
*/
- public abstract NavigationHandler createTreeHandler(JAXXObject context);
+ public abstract NavigationTreeHandler createTreeHandler(JAXXObject context);
public NavigationTreeHelper(String contextPrefix) {
super(contextPrefix);
@@ -141,7 +141,15 @@
log.debug(node);
}
TreePath path = new TreePath(navigationModel.getPathToRoot(node));
- JTree tree = getSafeTree(context);
+ JTree tree = getTree(context);
+ if (tree == null){
+ // FIXME : Refactor in other helper ?
+ // If its JXTreeTable
+ JXTreeTable treeTable = getSafeTreeTable(context);
+ treeTable.getTreeSelectionModel().setSelectionPath(path);
+ treeTable.scrollPathToVisible(path);
+ return;
+ }
tree.setSelectionPath(path);
tree.scrollPathToVisible(path);
}
Deleted: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -1,253 +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.swing.navigation;
-
-import jaxx.runtime.JAXXAction;
-import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXObject;
-import jaxx.runtime.context.JAXXInitialContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-import java.awt.*;
-
-/**
- * The handler of a navigation tree table.
- *
- * This is also the selection model to use, since we must check before moving
- * from a node we can not just listen selection model changed, we must control
- * it.
- *
- * TODO : Chercher une solution pour limiter le copier/coller.... @see {NavigationTreeHandler}
- *
- * @author sletellier
- * @since 2.0.0
- */
-public abstract class NavigationTreeTableHandler extends DefaultListSelectionModel implements NavigationHandler {
-
- private static final long serialVersionUID = 1L;
- /**
- * Logger
- */
- static private final Log log = LogFactory.getLog(NavigationTreeTableHandler.class);
-
- /**
- * UI which contains navigation tree
- */
- protected JAXXContext context;
- /**
- * UI Instanciation strategy
- */
- protected NavigationInstanciationStrategy strategy;
- /**
- * JAXXContext access helper.
- *
- * @since 1.7.2
- */
- protected NavigationTreeContextHelper contextHelper;
-
- protected NavigationTreeTableHandler(String contextPrefix, final JAXXObject context, NavigationInstanciationStrategy strategy, TreeSelectionModel selectModel) {
- this.contextHelper = new NavigationTreeContextHelper(contextPrefix);
- this.context = context;
- this.strategy = strategy;
- addListSelectionListener(new ListSelectionListener(){
- @Override
- public void valueChanged(ListSelectionEvent event) {
- log.info("Value changed old : " + event.getFirstIndex() + " last " + event.getLastIndex() + " source " + event.getSource());
- if (event.getSource() == null || !event.getValueIsAdjusting()) {
- // do not treate this if no path changed
- return;
- }
-
- // FIXME : event.getSource devrais retourner le navigationTreeNode....
- NavigationTreeNode node = (NavigationTreeNode) contextHelper.getTreeTable(context).getModel().getValueAt(event.getLastIndex(), 0);
- selectNodeUI(node);
- }
- });
- }
-
- /**
- * @return le modèle de navigation associé
- */
- protected abstract NavigationModel getNavigationTreeModel();
-
- /**
- * @return le composent actuellement visible associé au noeud courant ou
- * au noeud précédent lors d'un changement de noeud.
- */
- protected abstract Component getCurrentUI();
-
- /**
- * @param node le noeud associé à l'ui à retrouver
- * @return l'ui associé au novueau noeud sélectionné
- */
- protected abstract Component getUI(NavigationTreeNode node);
-
- /**
- * @param component le composent actuellement visible
- * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon
- * @throws Exception if any
- */
- protected abstract boolean closeUI(Component component) throws Exception;
-
- /**
- * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation
- *
- * @param node le noeud associé à l'ui à créer
- * @return la nouvelle ui associée au noeud
- * @throws Exception if any
- */
- protected abstract Component createUI(NavigationTreeNode node) throws Exception;
-
- /**
- * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation.
- *
- * @param newUI l'ui associé au noeud sélectionné à ouvrir
- * @param node le node de l'ui a ouvrir
- * @throws Exception if any
- */
- protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception;
-
- /**
- * Traitement des exceptions.
- *
- * @param e l'erreur recontrée (ou null si pas d"erreur)
- */
- protected abstract void treateError(Exception e);
-
- /**
- * @see NavigationHandler#getContext()
- */
- public JAXXContext getContext() {
- return context;
- }
-
- /**
- * @see NavigationHandler#getContextHelper()
- */
- public NavigationTreeContextHelper getContextHelper() {
- return contextHelper;
- }
-
- protected void selectNodeUI(NavigationTreeNode node) {
-
- try {
-
- String path = node.getFullPath();
-
- if (log.isTraceEnabled()) {
- log.trace(path);
- }
-
- Component newUI = getUI(node);
-
- // now, we are free to open the ui associated with the selected node in navigation
-
- // get the bean associated with the node
- Object data = getNavigationTreeModel().getBean(path);
-
- // save it in context (must be done before init ui)
- addSelectedBeanInContext(node, data);
-
- if (newUI == null) {
-
- // a new ui instance is required
- newUI = createUI(node);
- }
-
- JAXXContext ctxt = getContext();
- NavigationTreeContextHelper helper = getContextHelper();
-
- // save in context current node context path
- helper.setSelectedPath(ctxt, node.getFullPath());
-
- // save in context current node
- helper.setSelectedNode(ctxt, node);
-
- // save in context current ui
-// helper.setSelectedUI(ctxt, newUI);
-
- // really open the ui associated with the selected node
- // init ui before to be visible
- if (newUI instanceof NavigationContentUI) {
- ((NavigationContentUI) newUI).openUI(node);
- }
-
- // set ui in content
- openUI(newUI, node);
-
- } catch (Exception e) {
- // remove data from context
-
- // if any error, go back to previvous node
- treateError(e);
- }
- }
-
- /**
- * Prepare le context a utiliser pour initialiser une nouvelle ui.
- *
- * @param node le noeud associé à l'ui à créer
- * @return le context à utiliser pour instancier l'ui
- * @throws Exception if any
- */
- protected JAXXContext createUIContext(NavigationTreeNode node) throws Exception {
-
- if (node.getUIHandlerClass() == null) {
- if (log.isWarnEnabled()) {
- log.warn("no action associated with ui " + node.getUIClass());
- }
- // no action associated, just
- return getContext();
- }
-
- JAXXAction action = node.getUIHandlerClass().newInstance();
-
- // init context with
- JAXXInitialContext uiContext = action.init(getContext());
- return uiContext;
- }
-
- protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) {
-
- if (log.isDebugEnabled()) {
- log.debug("find data for contextPath <" + node.getFullPath() + "> : " + (data == null ? null : data.getClass()));
- }
- JAXXContext ctxt = getContext();
- NavigationTreeContextHelper helper = getContextHelper();
-
- // remove previous selected bean
- //TODO-TC-20091004 should have an automatic clean context method while
- helper.setSelectedBean(ctxt, null);
-
- if (data != null) {
-
- helper.setSelectedBean(ctxt, data);
- }
- }
-}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 12:35:35 UTC (rev 1740)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-15 16:29:38 UTC (rev 1741)
@@ -103,8 +103,8 @@
* nodesWereRemoved to create the appropriate event. This is the preferred
* way to remove a node as it handles the event creation for you.
*/
- public void removeNodeFromParent(MutableTreeNode node) {
- MutableTreeTableNode parent = (MutableTreeTableNode) node.getParent();
+ public void removeNodeFromParent(NavigationTreeNode node) {
+ NavigationTreeTableNode parent = (NavigationTreeTableNode)node.getParent();
if (parent == null) {
throw new IllegalArgumentException("node does not have a parent.");
1
0
r1740 - in trunk: jaxx-demo/src/main/java/jaxx/demo jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation jaxx-demo/src/main/resources/i18n jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 15 Feb '10
by sletellier@users.nuiton.org 15 Feb '10
15 Feb '10
Author: sletellier
Date: 2010-02-15 13:35:35 +0100 (Mon, 15 Feb 2010)
New Revision: 1740
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
Log:
Refactor Stratgie inner class to NavigationInstanciationStrategy class
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -42,7 +42,7 @@
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
import jaxx.runtime.swing.navigation.*;
-import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy;
+import jaxx.runtime.swing.navigation.NavigationInstanciationStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n.n_;
@@ -149,7 +149,7 @@
handler = new NavigationTreeHandlerWithCardLayout(
getPrefix(),
context,
- Strategy.PER_UI_TYPE) {
+ NavigationInstanciationStrategy.PER_UI_TYPE) {
private static final long serialVersionUID = 1L;
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -26,11 +26,8 @@
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.swing.CardLayout2;
import jaxx.runtime.swing.ErrorDialogUI;
-import jaxx.runtime.swing.navigation.NavigationTreeHandler;
-import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy;
-import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout;
-import jaxx.runtime.swing.navigation.NavigationTreeHelper;
-import jaxx.runtime.swing.navigation.NavigationTreeModel;
+import jaxx.runtime.swing.navigation.*;
+import jaxx.runtime.swing.navigation.NavigationInstanciationStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -126,7 +123,7 @@
handler = new NavigationTreeHandlerWithCardLayout(
getPrefix(),
context,
- Strategy.PER_UI_TYPE) {
+ NavigationInstanciationStrategy.PER_UI_TYPE) {
private static final long serialVersionUID = 1L;
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-15 12:35:35 UTC (rev 1740)
@@ -20,7 +20,7 @@
Blue=Bleu
Blue\:=bleu \:
Bold=En gras
-Button\ label\:=Libell\u00e9 de l'action
+Button\ label\:=Libell\u00E9 de l'action
C=C
CE=CE
Cancel=Annuler
@@ -34,12 +34,12 @@
Editable=Editable
Email\ Address\:=Courriel
Email\:=Courriel
-Enabled=Activ\u00e9
+Enabled=Activ\u00E9
EnumEditor\ (country)\ \:=Editeur de pays
EnumEditor\ (language)\ \:=Editeur de langue
Fancy\ Button=Bouton 'Fancy'
-First\ Name\:=Pr\u00e9nom
-FirstName\:=Pr\u00e9nom \:
+First\ Name\:=Pr\u00E9nom
+FirstName\:=Pr\u00E9nom \:
Font\ size=Taille de la police
Font\ size\:\ =
Fool\ me\ once=
@@ -48,7 +48,7 @@
Green\:=Vert \:
Greet=
Help=
-Inc\ (+)=Incr\u00e9menter (+)
+Inc\ (+)=Incr\u00E9menter (+)
Italic=Italique
JAXX\ Demo=
JMenu\ demo=
@@ -69,26 +69,26 @@
Red\:=rouge \:
Reset=Reinitialiser
Show\ Background=Voir le fond
-Show\ password\ dialog=Voir l'\u00e9diteur de mot de passe
+Show\ password\ dialog=Voir l'\u00E9diteur de mot de passe
Sign\ on=Signer
Simple\ Button=Bouton simple
Size\:=Taille \:
Sources=Sources
Spacing\:=Espacement \:
-Start=D\u00e9marrer
-Stop=Arr\u00eater
-Supported\ Swing\ components\:=Composants Swing support\u00e9s
+Start=D\u00E9marrer
+Stop=Arr\u00EAter
+Supported\ Swing\ components\:=Composants Swing support\u00E9s
Text2\:=Text 2
Text\:=Texte \:
Total\:\ =
-Underline=soulign\u00e9
+Underline=soulign\u00E9
Upper\ case\ text\:=Texte en majuscule
Use\ the\ spinner\ to=Utiliser la jauge pour
Username\:=Utilisateur \:
-Vegetable=L\u00e9gumes
+Vegetable=L\u00E9gumes
View=Vue
Welcome\ to\ the\ JAXX\ framework\!=Bienvenu dans le framework JAXX
-Working\ directory\:=R\u00e9pertoire de travail
+Working\ directory\:=R\u00E9pertoire de travail
Yellow=Jaune
You\ entered\:\ =
Your\ name\:=Votre nom \:
@@ -98,8 +98,8 @@
between\ these\ lines=
button\ A=Bouton A
button\ B=Bouton B
-button\ C\ (full\ block)=Bouton C (blocage compl\u00eat)
-button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00eat)
+button\ C\ (full\ block)=Bouton C (blocage compl\u00EAt)
+button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00EAt)
cancel=Annuler
close=Fermer
close2=Fermer 2
@@ -143,12 +143,12 @@
jaxxdemo.action.configuration.tip=Modifier la configuration
jaxxdemo.action.exit=Quitter
jaxxdemo.action.exit.tip=Quitter JAXX Demo
-jaxxdemo.action.fullscreen=Plein \u00e9cran
-jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00e9cran
+jaxxdemo.action.fullscreen=Plein \u00E9cran
+jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00E9cran
jaxxdemo.action.help=Aide
jaxxdemo.action.help.tip=Affichier l'aide
-jaxxdemo.action.locale.fr=Fran\u00e7ais
-jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00e7ais
+jaxxdemo.action.locale.fr=Fran\u00E7ais
+jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00E7ais
jaxxdemo.action.locale.uk=Anglais
jaxxdemo.action.locale.uk.tip=Changer la langue en anglais
jaxxdemo.action.normalscreen=Ecran normal
@@ -156,43 +156,43 @@
jaxxdemo.action.remove=
jaxxdemo.action.show=
jaxxdemo.action.site=Site internet
-jaxxdemo.action.site.tip=Acc\u00e9der au site de l'application sur internet
-jaxxdemo.config.category.directories=R\u00e9pertoires
-jaxxdemo.config.category.directories.description=R\u00e9pertoires de l'application
+jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet
+jaxxdemo.config.category.directories=R\u00E9pertoires
+jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'application
jaxxdemo.config.category.other=Autre
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
-jaxxdemo.config.ui.demo.path=Chemin de la d\u00e9mo par d\u00e9faut
-jaxxdemo.config.ui.fontSize=La taille de la police \u00e0 utiliser pour visualiser dans les sources
-jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00e9cran
-jaxxdemo.config.ui.locale=La langue utilis\u00e9e par l'application
+jaxxdemo.config.ui.demo.path=Chemin de la d\u00E9mo par d\u00E9faut
+jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
+jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Titre de la popup
-jaxxdemo.i18neditor.selected.locale=Langue s\u00e9lectionn\u00e9e
+jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
jaxxdemo.i18neditor.showIcon=Afficher les icones
jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup
jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup
jaxxdemo.i18neditor.showText=Afficher le text
-jaxxdemo.init.closed=JAXX Demo a \u00e9t\u00e9 ferm\u00e9 \u00e0 %1$s
-jaxxdemo.init.context.done=Initialisation du contexte termin\u00e9e en %1$s.
-jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00e9e.
+jaxxdemo.init.closed=JAXX Demo a \u00E9t\u00E9 ferm\u00E9 \u00E0 %1$s
+jaxxdemo.init.context.done=Initialisation du contexte termin\u00E9e en %1$s.
+jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00E9e.
jaxxdemo.menu.file=Fichier
jaxxdemo.menu.file.locale=Langues
jaxxdemo.menu.help=Aide
-jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00e9e.
-jaxxdemo.message.goto.site=Acc\u00e9der au site de JAXX Demo (%1$s)
+jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e.
+jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s)
jaxxdemo.navigation.actor.title=
jaxxdemo.navigation.actors.title=
jaxxdemo.navigation.movie.title=
jaxxdemo.navigation.movies.title=
jaxxdemo.numbereditor.autoPopup=Affichage automatique popup
jaxxdemo.numbereditor.configuration=Configuration
-jaxxdemo.numbereditor.model=R\u00e9sultat
-jaxxdemo.numbereditor.model.float=Valeur d\u00e9cimale \: %1$s
-jaxxdemo.numbereditor.model.int=Valeur enti\u00e8re \: %1$s
+jaxxdemo.numbereditor.model=R\u00E9sultat
+jaxxdemo.numbereditor.model.float=Valeur d\u00E9cimale \: %1$s
+jaxxdemo.numbereditor.model.int=Valeur enti\u00E8re \: %1$s
jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup
jaxxdemo.numbereditor.showReset=Afficher le boutton de reset
-jaxxdemo.numbereditor.useFloat=Utiliser les d\u00e9cimales
+jaxxdemo.numbereditor.useFloat=Utiliser les d\u00E9cimales
jaxxdemo.numbereditor.useSign=Utiliser le signe
jaxxdemo.title.about=A propos de JAXX Demo...
jaxxdemo.tree.component.jaxx=Composants JAXX
@@ -204,13 +204,13 @@
jaxxdemo.tree.component.swing.form.text=Texte
jaxxdemo.tree.component.swing.layout=Layouts
jaxxdemo.tree.component.swing.menu=Menus
-jaxxdemo.tree.component.swing.window=Fen\u00eatres
-jaxxdemo.tree.feature=Fonctionnalit\u00e9s
+jaxxdemo.tree.component.swing.window=Fen\u00EAtres
+jaxxdemo.tree.feature=Fonctionnalit\u00E9s
jaxxdemo.tree.features.databinding=Data binding
jaxxdemo.tree.features.validation=Validation
jaxxdemo.tree.fun=Fun
-jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00e9t\u00e9 trouv\u00e9, il faut au moins la version 1.6u10 de java.
-jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00e9tect\u00e9
+jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java.
+jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9
model0.f0=
model0.f1=
model0.file...=
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -31,38 +31,6 @@
public interface NavigationHandler {
/**
- * Strategy of instanciation of ui.
- * <p/>
- * For a given {@code node}, the method {@link #getId(NavigationTreeNode)}
- * returns the id of ui to use.
- */
- public enum Strategy {
-
- /**
- * instanciate a ui for a node
- */
- PER_NODE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getFullPath();
- }
- },
- /**
- * instanciate only one a ui for a type,nodes will share the instanciation
- */
- PER_UI_TYPE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getUIClass().getName();
- }
- };
-
- public abstract String getId(NavigationTreeNode node);
- }
-
- /**
* To get the context will be used by handler
* @return {@link JAXXContext} to use
*/
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationInstanciationStrategy.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -0,0 +1,33 @@
+package jaxx.runtime.swing.navigation;
+
+/**
+ * Strategy of instanciation of ui.
+ * <p/>
+ * For a given {@code node}, the method {@link #getId(jaxx.runtime.swing.navigation.NavigationTreeNode)}
+ * returns the id of ui to use.
+ */
+public enum NavigationInstanciationStrategy {
+
+ /**
+ * instanciate a ui for a node
+ */
+ PER_NODE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getFullPath();
+ }
+ },
+ /**
+ * instanciate only one a ui for a type,nodes will share the instanciation
+ */
+ PER_UI_TYPE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getUIClass().getName();
+ }
+ };
+
+ public abstract String getId(NavigationTreeNode node);
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -57,7 +57,8 @@
/**
* UI Instanciation strategy
*/
- protected Strategy strategy;
+ protected NavigationInstanciationStrategy strategy;
+
/**
* JAXXContext access helper.
*
@@ -65,7 +66,7 @@
*/
protected NavigationTreeContextHelper contextHelper;
- protected NavigationTreeHandler(String contextPrefix, JAXXObject context, Strategy strategy) {
+ protected NavigationTreeHandler(String contextPrefix, JAXXObject context, NavigationInstanciationStrategy strategy) {
this.contextHelper = new NavigationTreeContextHelper(contextPrefix);
this.context = context;
this.strategy = strategy;
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -61,7 +61,7 @@
*/
protected abstract CardLayout2 getContentLayout();
- public NavigationTreeHandlerWithCardLayout(String contextPrefix, JAXXObject context, Strategy strategy) {
+ public NavigationTreeHandlerWithCardLayout(String contextPrefix, JAXXObject context, NavigationInstanciationStrategy strategy) {
super(contextPrefix, context, strategy);
if (getContentContainer() == null) {
throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context);
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java 2010-02-15 12:35:35 UTC (rev 1740)
@@ -63,7 +63,7 @@
/**
* UI Instanciation strategy
*/
- protected Strategy strategy;
+ protected NavigationInstanciationStrategy strategy;
/**
* JAXXContext access helper.
*
@@ -71,7 +71,7 @@
*/
protected NavigationTreeContextHelper contextHelper;
- protected NavigationTreeTableHandler(String contextPrefix, final JAXXObject context, Strategy strategy, TreeSelectionModel selectModel) {
+ protected NavigationTreeTableHandler(String contextPrefix, final JAXXObject context, NavigationInstanciationStrategy strategy, TreeSelectionModel selectModel) {
this.contextHelper = new NavigationTreeContextHelper(contextPrefix);
this.context = context;
this.strategy = strategy;
1
0
r1739 - in trunk: . jaxx-runtime jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
by sletellier@users.nuiton.org 12 Feb '10
by sletellier@users.nuiton.org 12 Feb '10
12 Feb '10
Author: sletellier
Date: 2010-02-12 19:49:48 +0100 (Fri, 12 Feb 2010)
New Revision: 1739
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModelBuilder.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableNode.java
Modified:
trunk/jaxx-runtime/pom.xml
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java
trunk/pom.xml
Log:
- Add SwingX dependency
- Add implementation to use JXTreeTable with helper using JXPath
- TODO : Fix hack to get selected value (in NavigationTreeTableHandler)
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/pom.xml 2010-02-12 18:49:48 UTC (rev 1739)
@@ -1,3 +1,4 @@
+
<?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">
@@ -56,6 +57,13 @@
<artifactId>junit</artifactId>
</dependency>
+ <!-- pour utiliser JTreeTable -->
+
+ <dependency>
+ <groupId>org.swinglabs</groupId>
+ <artifactId>swingx</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,77 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXContext;
+
+/**
+ * Interface to create an handler of a navigation tree.
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public interface NavigationHandler {
+
+ /**
+ * Strategy of instanciation of ui.
+ * <p/>
+ * For a given {@code node}, the method {@link #getId(NavigationTreeNode)}
+ * returns the id of ui to use.
+ */
+ public enum Strategy {
+
+ /**
+ * instanciate a ui for a node
+ */
+ PER_NODE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getFullPath();
+ }
+ },
+ /**
+ * instanciate only one a ui for a type,nodes will share the instanciation
+ */
+ PER_UI_TYPE {
+
+ @Override
+ public String getId(NavigationTreeNode node) {
+ return node.getUIClass().getName();
+ }
+ };
+
+ public abstract String getId(NavigationTreeNode node);
+ }
+
+ /**
+ * To get the context will be used by handler
+ * @return {@link JAXXContext} to use
+ */
+ public JAXXContext getContext();
+
+ /**
+ * To get helper will be used by handler
+ * @return {@link NavigationTreeContextHelper} to use
+ */
+ public NavigationTreeContextHelper getContextHelper();
+
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModel.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,151 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXContext;
+import org.jdesktop.swingx.treetable.TreeTableNode;
+
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreeNode;
+import java.util.regex.Pattern;
+
+/**
+ * Interface to create model of the tree used for a navigation tree.
+ * <p/>
+ * Il est composé de {@link NavigationTreeNode}
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public interface NavigationModel {
+
+ public Object getRoot();
+
+ public TreeNode[] getPathToRoot(TreeNode aNode);
+
+ /**
+ * Search from the root node a node named by his fully path (concatenation of nodes
+ * {@link NavigationTreeNode#path} valued separated by dot.
+ * <p/>
+ * Example :
+ * <p/>
+ * <pre>$root.child1.leaf1</pre>
+ *
+ * @param path the fully path of the searched node.
+ * @return the node matching the fully context from the root node, or <code>null</code> if not find.
+ */
+ public NavigationTreeNode findNode(String path);
+
+ /**
+ * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null.
+ * <p/>
+ * Search then from the root node a node named by his fully path (concatenation of nodes
+ * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * <p/>
+ * <p/>
+ * Example :
+ * <p/>
+ * <pre>$root.child1.leaf1</pre>
+ *
+ * @param path the fully path of the searched node.
+ * @param regex a optional regex to apply to path before searching
+ * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ */
+ public NavigationTreeNode findNode(String path, String regex);
+
+ /**
+ * Apply first the regex pattern to obtain the searched node.
+ * <p/>
+ * Search then from the root node a node named by his fully path (concatenation of nodes
+ * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ * <p/>
+ * Example :
+ * <p/>
+ * <pre>$root.child1.leaf1</pre>
+ *
+ * @param path the fully path of the searched node.
+ * @param regex a optional regex to apply to path before searching
+ * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ */
+ public NavigationTreeNode findNode(String path, Pattern regex);
+
+ /**
+ * Search from a given root node a node named by his fully path (concatenation of nodes
+ * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ *
+ * @param root root node to be used
+ * @param path the fully path of the searched node.
+ * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path);
+
+ /**
+ * Apply first the regex pattern to obtain the searched node.
+ * <p/>
+ * Search then from a given root node a node named by his fully path (concatenation of nodes)
+ * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ *
+ * @param root root node to be used
+ * @param path the fully path of the searched node.
+ * @param regex a previous regex to apply to path : must have a matches
+ * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex);
+
+ /**
+ * Apply first the regex pattern to obtain the searched node.
+ * <p/>
+ * Search then from a given root node a node named by his fully path (concatenation of nodes
+ * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
+ *
+ * @param root root node to be used
+ * @param path the fully path of the searched node.
+ * @param regex a previous regex to apply to path : must have a matches
+ * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex);
+
+ public JAXXContext getContext();
+
+ /**
+ * Obtain the associated bean value from context corresponding to node from given navigation path.
+ *
+ * @param navigationPath the current context path of the node
+ * @return the value associated in context with the given navigation path
+ */
+ public Object getBean(String navigationPath);
+
+ /**
+ * Obtain the associated bean value from context corresponding to node
+ *
+ * @param node the current node
+ * @return the value associated in context with the given node.
+ */
+ public Object getBean(NavigationTreeNode node);
+
+ public void nodeChanged(TreeNode node);
+
+ public void nodeStructureChanged(TreeNode node);
+
+ public void nodeChanged(TreeNode node, boolean deep);
+
+ public String getPathSeparator();
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationModelBuilder.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,95 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXAction;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import jaxx.runtime.decorator.Decorator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Enumeration;
+
+/**
+ * Interface to create a builder, this object is design to build a {@link NavigationModel}.
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public interface NavigationModelBuilder {
+
+ public NavigationModel getModel();
+
+ public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass);
+
+ public NavigationTreeNode removeChildNode(NavigationTreeNode node);
+
+ public void addI18nNodeRenderer(NavigationTreeNode node, String libelle);
+
+ public void addDecoratorNodeRenderer(NavigationTreeNode node, Decorator<?> decorator);
+
+ public void addNodeJaxxClasses(
+ NavigationTreeNode node,
+ Class<? extends JAXXObject> uIClass,
+ Class<? extends JAXXAction> uIHandlerClass);
+
+ public void printModel(NavigationTreeNode node);
+}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -25,6 +25,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
+import org.jdesktop.swingx.JXTreeTable;
/**
* To help getting and setting navigation tree objects from a {@link JAXXContext}.
@@ -64,16 +65,18 @@
protected JAXXContextEntryDef<String> selectedPathContextEntry;
protected JAXXContextEntryDef<Object> selectedBeanContextEntry;
protected JAXXContextEntryDef<NavigationTreeNode> selectedNodeContextEntry;
- protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry;
- protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry;
+ protected JAXXContextEntryDef<NavigationModel> modelContextEntry;
+ protected JAXXContextEntryDef<NavigationHandler> handlerContextEntry;
protected JAXXContextEntryDef<JTree> treeContextEntry;
+ protected JAXXContextEntryDef<JXTreeTable> treeTableContextEntry;
// protected JAXXContextEntryDef<Component> selectedUIContextEntry;
public NavigationTreeContextHelper(String prefix) {
this.prefix = prefix;
treeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree", JTree.class);
- treeModelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class);
- treeHandlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class);
+ treeTableContextEntry = JAXXUtil.newContextEntryDef(prefix + "-tree-table", JXTreeTable.class);
+ modelContextEntry = JAXXUtil.newContextEntryDef(prefix + "-model", NavigationModel.class);
+ handlerContextEntry = JAXXUtil.newContextEntryDef(prefix + "-handler", NavigationHandler.class);
selectedBeanContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-bean", Object.class);
selectedNodeContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class);
selectedPathContextEntry = JAXXUtil.newContextEntryDef(prefix + "-selected-path", String.class);
@@ -89,16 +92,36 @@
return r;
}
- public NavigationTreeModel getTreeModel(JAXXContext context) {
- NavigationTreeModel r = getTreeModelContextEntry().getContextValue(context);
+ public JXTreeTable getTreeTable(JAXXContext context) {
+ JXTreeTable r = getTreeTableContextEntry().getContextValue(context);
return r;
}
- public NavigationTreeHandler getTreeHandler(JAXXContext context) {
- NavigationTreeHandler r = getTreeHandlerContextEntry().getContextValue(context);
+ public NavigationModel getModel(JAXXContext context) {
+ NavigationModel r = getModelContextEntry().getContextValue(context);
return r;
}
+ @Deprecated
+ public NavigationTreeModel getTreeModel(JAXXContext context) {
+ NavigationModel r = getModelContextEntry().getContextValue(context);
+ if (r instanceof NavigationTreeModel){
+ return (NavigationTreeModel)r;
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated please use {@link #getHandler(JAXXContext)}, will be remove soon
+ * @param context
+ * @return handler
+ */
+ @Deprecated
+ public NavigationHandler getTreeHandler(JAXXContext context) {
+ NavigationHandler r = getTreeHandlerContextEntry().getContextValue(context);
+ return r;
+ }
+
public String getSelectedPath(JAXXContext context) {
String r = getSelectedPathContextEntry().getContextValue(context);
return r;
@@ -119,18 +142,42 @@
// return r;
// }
- public void setTreeModel(JAXXContext context, NavigationTreeModel model) {
- getTreeModelContextEntry().setContextValue(context, model);
+ /**
+ * @deprecated please use {@link #setModel(JAXXContext, NavigationModel)}, will be remove soon
+ * @param context
+ * @param model
+ */
+ @Deprecated
+ public void setTreeModel(JAXXContext context, NavigationModel model) {
+ getModelContextEntry().setContextValue(context, model);
}
+ public void setModel(JAXXContext context, NavigationModel model) {
+ getModelContextEntry().setContextValue(context, model);
+ }
+
public void setTree(JAXXContext context, JTree tree) {
getTreeContextEntry().setContextValue(context, tree);
}
- public void setTreeHandler(JAXXContext context, NavigationTreeHandler handler) {
+ public void setTreeTable(JAXXContext context, JXTreeTable treeTable) {
+ getTreeTableContextEntry().setContextValue(context, treeTable);
+ }
+
+ /**
+ * @deprecated please use {@link #setHandler(JAXXContext, NavigationHandler)}, will be remove soon
+ * @param context
+ * @param handler
+ */
+ @Deprecated
+ public void setTreeHandler(JAXXContext context, NavigationHandler handler) {
getTreeHandlerContextEntry().setContextValue(context, handler);
}
+ public void setHandler(JAXXContext context, NavigationHandler handler) {
+ getHandlerContextEntry().setContextValue(context, handler);
+ }
+
public void setSelectedPath(JAXXContext context, String path) {
if (path == null) {
getSelectedPathContextEntry().removeContextValue(context);
@@ -163,14 +210,19 @@
// }
// }
- protected JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() {
- return treeModelContextEntry;
+ protected JAXXContextEntryDef<NavigationModel> getModelContextEntry() {
+ return modelContextEntry;
}
- protected JAXXContextEntryDef<NavigationTreeHandler> getTreeHandlerContextEntry() {
- return treeHandlerContextEntry;
+ @Deprecated
+ protected JAXXContextEntryDef<NavigationHandler> getTreeHandlerContextEntry() {
+ return handlerContextEntry;
}
+ public JAXXContextEntryDef<NavigationHandler> getHandlerContextEntry() {
+ return handlerContextEntry;
+ }
+
protected JAXXContextEntryDef<Object> getSelectedBeanContextEntry() {
return selectedBeanContextEntry;
}
@@ -187,7 +239,13 @@
return treeContextEntry;
}
+ protected JAXXContextEntryDef<JXTreeTable> getTreeTableContextEntry() {
+ return treeTableContextEntry;
+ }
+
// public JAXXContextEntryDef<Component> getSelectedUIContextEntry() {
+
// return selectedUIContextEntry;
+
// }
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -42,7 +42,7 @@
* @author tony
* @since 1.7.2
*/
-public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel {
+public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel implements NavigationHandler{
private static final long serialVersionUID = 1L;
/**
@@ -50,37 +50,6 @@
*/
static private final Log log = LogFactory.getLog(NavigationTreeHandler.class);
- /**
- * Strategy of instanciation of ui.
- * <p/>
- * For a given {@code node}, the method {@link #getId(NavigationTreeNode)}
- * returns the id of ui to use.
- */
- public enum Strategy {
-
- /**
- * instanciate a ui for a node
- */
- PER_NODE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getFullPath();
- }
- },
- /**
- * instanciate only one a ui for a type,nodes will share the instanciation
- */
- PER_UI_TYPE {
-
- @Override
- public String getId(NavigationTreeNode node) {
- return node.getUIClass().getName();
- }
- };
-
- public abstract String getId(NavigationTreeNode node);
- }
/**
* UI which contains navigation tree
*/
@@ -117,10 +86,10 @@
/**
* @return le modèle de navigation associé
*/
- protected abstract NavigationTreeModel getNavigationTreeModel();
+ protected abstract NavigationModel getNavigationTreeModel();
/**
- * @return le composent actuellement visible associé au noeud courant ou
+ * @return le composent actuellement visible associé au noeud courant ou
* au noeud précédent lors d'un changement de noeud.
*/
protected abstract Component getCurrentUI();
@@ -163,10 +132,16 @@
*/
protected abstract void treateError(Exception e);
+ /**
+ * {@see NavigationHandler#getContext()
+ **/
public JAXXContext getContext() {
return context;
}
+ /**
+ * {@see NavigationHandler#getContextHelper()
+ **/
public NavigationTreeContextHelper getContextHelper() {
return contextHelper;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -24,11 +24,13 @@
import java.util.Enumeration;
import java.util.regex.Pattern;
import javax.swing.JTree;
+import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTreeTable;
/**
* Helper object associated to a given navigation tree system.
@@ -47,12 +49,12 @@
static private final Log log = LogFactory.getLog(NavigationTreeHelper.class);
/**
- * Create the tree model.
+ * Create the model.
*
* @param context the context to associate with fresh model
* @return the new model build with data from the given context
*/
- public abstract NavigationTreeModel createTreeModel(JAXXContext context);
+ public abstract NavigationModel createTreeModel(JAXXContext context);
/**
* Create the tree handler.
@@ -60,36 +62,36 @@
* @param context the context to associate with fresh handler
* @return the new handler
*/
- public abstract NavigationTreeHandler createTreeHandler(JAXXObject context);
+ public abstract NavigationHandler createTreeHandler(JAXXObject context);
public NavigationTreeHelper(String contextPrefix) {
super(contextPrefix);
}
public Object getContextValue(JAXXContext context, String path) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
return treeModel.getBean(path);
}
public NavigationTreeNode findNode(JAXXContext context, String path) {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
return treeModel.findNode(path);
}
public NavigationTreeNode findNode(JAXXContext context, String path, String regex) {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
return treeModel.findNode(path, regex);
}
public NavigationTreeNode findNode(JAXXContext context, String path, Pattern regex) {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
return treeModel.findNode(path, regex);
}
public NavigationTreeNode findNode(JAXXContext context, String path, String regex, String suffix) {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
NavigationTreeNode navigationTreeNode = treeModel.findNode(path, regex);
if (navigationTreeNode != null && suffix != null) {
@@ -100,7 +102,7 @@
public NavigationTreeNode findNode(JAXXContext context, String path, Pattern regex, String suffix) {
- NavigationTreeModel treeModel = getSafeTreeModel(context);
+ NavigationModel treeModel = getSafeModel(context);
NavigationTreeNode navigationTreeNode = treeModel.findNode(path, regex);
if (navigationTreeNode != null && suffix != null) {
@@ -134,7 +136,7 @@
public void selectNode(JAXXContext context, NavigationTreeNode node) {
- NavigationTreeModel navigationModel = getSafeTreeModel(context);
+ NavigationModel navigationModel = getSafeModel(context);
if (log.isDebugEnabled()) {
log.debug(node);
}
@@ -224,7 +226,7 @@
* @param deep un flag pour activer la repainte de la descendance du noeud
*/
public void repaintNode(JAXXContext context, NavigationTreeNode node, boolean deep) {
- NavigationTreeModel navigationModel = getSafeTreeModel(context);
+ NavigationModel navigationModel = getSafeModel(context);
if (log.isDebugEnabled()) {
log.debug(node);
}
@@ -240,14 +242,26 @@
}
}
+ @Deprecated
public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException {
- NavigationTreeModel treeModel = getTreeModel(context);
- if (treeModel == null) {
- throw new NullPointerException("could not find tree model with key " + getTreeModelContextEntry() + " in context " + context);
+ NavigationModel model = getModel(context);
+ if (model == null) {
+ throw new NullPointerException("could not find tree model with key " + getModelContextEntry() + " in context " + context);
}
- return treeModel;
+ if (model instanceof NavigationTreeModel){
+ return (NavigationTreeModel) model;
+ }
+ return null;
}
+ public NavigationModel getSafeModel(JAXXContext context) throws NullPointerException {
+ NavigationModel model = getModel(context);
+ if (model == null) {
+ throw new NullPointerException("could not find tree model with key " + getModelContextEntry() + " in context " + context);
+ }
+ return model;
+ }
+
public JTree getSafeTree(JAXXContext context) throws NullPointerException {
JTree tree = getTree(context);
if (tree == null) {
@@ -255,4 +269,12 @@
}
return tree;
}
+
+ public JXTreeTable getSafeTreeTable(JAXXContext context) throws NullPointerException {
+ JXTreeTable treeTable = getTreeTable(context);
+ if (treeTable == null) {
+ throw new NullPointerException("could not find tree with key " + getTreeTableContextEntry() + " in context " + context);
+ }
+ return treeTable;
+ }
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -39,7 +39,7 @@
* @author chemit
* @since 1.7.2
*/
-public class NavigationTreeModel extends DefaultTreeModel {
+public class NavigationTreeModel extends DefaultTreeModel implements NavigationModel{
static private final long serialVersionUID = 1L;
/**
@@ -64,100 +64,51 @@
this.context = context;
}
+ /**
+ * @see {NavigationModel#getRoot()}
+ */
@Override
public NavigationTreeNode getRoot() {
return (NavigationTreeNode) super.getRoot();
}
/**
- * Search from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by dot.
- * <p/>
- * Example :
- * <p/>
- * <pre>$root.child1.leaf1</pre>
- *
- * @param path the fully path of the searched node.
- * @return the node matching the fully context from the root node, or <code>null</code> if not find.
+ * @see {NavigationModel#findNode(String)}
*/
public NavigationTreeNode findNode(String path) {
return findNode(getRoot(), path, (Pattern) null);
}
/**
- * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null.
- * <p/>
- * Search then from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
- * <p/>
- * <p/>
- * Example :
- * <p/>
- * <pre>$root.child1.leaf1</pre>
- *
- * @param path the fully path of the searched node.
- * @param regex a optional regex to apply to path before searching
- * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ * @see {NavigationModel#findNode(String, String)}
*/
public NavigationTreeNode findNode(String path, String regex) {
return findNode(getRoot(), path, regex);
}
/**
- * Apply first the regex pattern to obtain the searched node.
- * <p/>
- * Search then from the root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
- * <p/>
- * Example :
- * <p/>
- * <pre>$root.child1.leaf1</pre>
- *
- * @param path the fully path of the searched node.
- * @param regex a optional regex to apply to path before searching
- * @return the node matching the fully context from the root node, or <code>null</code> if not found.
+ * @see {NavigationModel#findNode(String, Pattern)}
*/
public NavigationTreeNode findNode(String path, Pattern regex) {
return findNode(getRoot(), path, regex);
}
/**
- * Search from a given root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
- *
- * @param root root node to be used
- * @param path the fully path of the searched node.
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @see {NavigationModel#findNode(NavigationTreeNode, String)}
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path) {
return findNode(root, path, (Pattern) null);
}
/**
- * Apply first the regex pattern to obtain the searched node.
- * <p/>
- * Search then from a given root node a node named by his fully path (concatenation of nodes)
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
- *
- * @param root root node to be used
- * @param path the fully path of the searched node.
- * @param regex a previous regex to apply to path : must have a matches
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @see {NavigationModel#findNode(NavigationTreeNode, String, String)}
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) {
return findNode(root, path, regex == null ? null : Pattern.compile(regex));
}
/**
- * Apply first the regex pattern to obtain the searched node.
- * <p/>
- * Search then from a given root node a node named by his fully path (concatenation of nodes
- * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}.
- *
- * @param root root node to be used
- * @param path the fully path of the searched node.
- * @param regex a previous regex to apply to path : must have a matches
- * @return the node matching the fully context from the given root node, or <code>null</code> if not found.
+ * @see {NavigationModel#findNode(NavigationTreeNode, String, Pattern)}
*/
public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) {
if (regex != null) {
@@ -186,15 +137,15 @@
return result;
}
+ /**
+ * @see {NavigationModel#getContext()}
+ */
public JAXXContext getContext() {
return context;
}
/**
- * Obtain the associated bean value from context corresponding to node from given navigation path.
- *
- * @param navigationPath the current context path of the node
- * @return the value associated in context with the given navigation path
+ * @see {NavigationModel#getBean(String)}
*/
public Object getBean(String navigationPath) {
Object result;
@@ -204,10 +155,7 @@
}
/**
- * Obtain the associated bean value from context corresponding to node
- *
- * @param node the current node
- * @return the value associated in context with the given node.
+ * @see {NavigationModel#getBean(NavigationTreeNode)}
*/
public Object getBean(NavigationTreeNode node) {
if (node == null) {
@@ -218,6 +166,9 @@
return node.getBean(getContext());
}
+ /**
+ * @see {NavigationModel#nodeChanged(TreeNode)}
+ */
@Override
public void nodeChanged(TreeNode node) {
nodeChanged(node, false);
@@ -226,6 +177,9 @@
}
}
+ /**
+ * @see {NavigationModel#nodeStructureChanged(TreeNode)}
+ */
@Override
public void nodeStructureChanged(TreeNode node) {
NavigationTreeNode n = (NavigationTreeNode) node;
@@ -237,6 +191,9 @@
}
}
+ /**
+ * @see {NavigationModel#nodeChanged(TreeNode, boolean)}
+ */
public void nodeChanged(TreeNode node, boolean deep) {
NavigationTreeNode n = (NavigationTreeNode) node;
@@ -264,6 +221,9 @@
}
}
+ /**
+ * @see {NavigationModel#getPathSeparator()}
+ */
public String getPathSeparator() {
return pathSeparator;
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -31,11 +31,13 @@
/**
* This object is design to build a {@link NavigationTreeModel}.
+ *
+ * @see NavigationModelBuilder
*
* @author chemit
* @since 17.2
*/
-public class NavigationTreeModelBuilder {
+public class NavigationTreeModelBuilder implements NavigationModelBuilder{
/**
* Logger
@@ -95,6 +97,7 @@
Class<? extends JAXXObject> uiClass,
Class<? extends JAXXAction> actionClass) {
NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef);
+ // TODO : Must be : NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, null, entryDef); ???
addI18nNodeRenderer(node, libelle);
addNodeJaxxClasses(node, uiClass, actionClass);
return addChildNode(parentNode, node);
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableHandler.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,253 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXAction;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.context.JAXXInitialContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.*;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+import java.awt.*;
+
+/**
+ * The handler of a navigation tree table.
+ *
+ * This is also the selection model to use, since we must check before moving
+ * from a node we can not just listen selection model changed, we must control
+ * it.
+ *
+ * TODO : Chercher une solution pour limiter le copier/coller.... @see {NavigationTreeHandler}
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public abstract class NavigationTreeTableHandler extends DefaultListSelectionModel implements NavigationHandler {
+
+ private static final long serialVersionUID = 1L;
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(NavigationTreeTableHandler.class);
+
+ /**
+ * UI which contains navigation tree
+ */
+ protected JAXXContext context;
+ /**
+ * UI Instanciation strategy
+ */
+ protected Strategy strategy;
+ /**
+ * JAXXContext access helper.
+ *
+ * @since 1.7.2
+ */
+ protected NavigationTreeContextHelper contextHelper;
+
+ protected NavigationTreeTableHandler(String contextPrefix, final JAXXObject context, Strategy strategy, TreeSelectionModel selectModel) {
+ this.contextHelper = new NavigationTreeContextHelper(contextPrefix);
+ this.context = context;
+ this.strategy = strategy;
+ addListSelectionListener(new ListSelectionListener(){
+ @Override
+ public void valueChanged(ListSelectionEvent event) {
+ log.info("Value changed old : " + event.getFirstIndex() + " last " + event.getLastIndex() + " source " + event.getSource());
+ if (event.getSource() == null || !event.getValueIsAdjusting()) {
+ // do not treate this if no path changed
+ return;
+ }
+
+ // FIXME : event.getSource devrais retourner le navigationTreeNode....
+ NavigationTreeNode node = (NavigationTreeNode) contextHelper.getTreeTable(context).getModel().getValueAt(event.getLastIndex(), 0);
+ selectNodeUI(node);
+ }
+ });
+ }
+
+ /**
+ * @return le modèle de navigation associé
+ */
+ protected abstract NavigationModel getNavigationTreeModel();
+
+ /**
+ * @return le composent actuellement visible associé au noeud courant ou
+ * au noeud précédent lors d'un changement de noeud.
+ */
+ protected abstract Component getCurrentUI();
+
+ /**
+ * @param node le noeud associé à l'ui à retrouver
+ * @return l'ui associé au novueau noeud sélectionné
+ */
+ protected abstract Component getUI(NavigationTreeNode node);
+
+ /**
+ * @param component le composent actuellement visible
+ * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon
+ * @throws Exception if any
+ */
+ protected abstract boolean closeUI(Component component) throws Exception;
+
+ /**
+ * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation
+ *
+ * @param node le noeud associé à l'ui à créer
+ * @return la nouvelle ui associée au noeud
+ * @throws Exception if any
+ */
+ protected abstract Component createUI(NavigationTreeNode node) throws Exception;
+
+ /**
+ * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation.
+ *
+ * @param newUI l'ui associé au noeud sélectionné à ouvrir
+ * @param node le node de l'ui a ouvrir
+ * @throws Exception if any
+ */
+ protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception;
+
+ /**
+ * Traitement des exceptions.
+ *
+ * @param e l'erreur recontrée (ou null si pas d"erreur)
+ */
+ protected abstract void treateError(Exception e);
+
+ /**
+ * @see NavigationHandler#getContext()
+ */
+ public JAXXContext getContext() {
+ return context;
+ }
+
+ /**
+ * @see NavigationHandler#getContextHelper()
+ */
+ public NavigationTreeContextHelper getContextHelper() {
+ return contextHelper;
+ }
+
+ protected void selectNodeUI(NavigationTreeNode node) {
+
+ try {
+
+ String path = node.getFullPath();
+
+ if (log.isTraceEnabled()) {
+ log.trace(path);
+ }
+
+ Component newUI = getUI(node);
+
+ // now, we are free to open the ui associated with the selected node in navigation
+
+ // get the bean associated with the node
+ Object data = getNavigationTreeModel().getBean(path);
+
+ // save it in context (must be done before init ui)
+ addSelectedBeanInContext(node, data);
+
+ if (newUI == null) {
+
+ // a new ui instance is required
+ newUI = createUI(node);
+ }
+
+ JAXXContext ctxt = getContext();
+ NavigationTreeContextHelper helper = getContextHelper();
+
+ // save in context current node context path
+ helper.setSelectedPath(ctxt, node.getFullPath());
+
+ // save in context current node
+ helper.setSelectedNode(ctxt, node);
+
+ // save in context current ui
+// helper.setSelectedUI(ctxt, newUI);
+
+ // really open the ui associated with the selected node
+ // init ui before to be visible
+ if (newUI instanceof NavigationContentUI) {
+ ((NavigationContentUI) newUI).openUI(node);
+ }
+
+ // set ui in content
+ openUI(newUI, node);
+
+ } catch (Exception e) {
+ // remove data from context
+
+ // if any error, go back to previvous node
+ treateError(e);
+ }
+ }
+
+ /**
+ * Prepare le context a utiliser pour initialiser une nouvelle ui.
+ *
+ * @param node le noeud associé à l'ui à créer
+ * @return le context à utiliser pour instancier l'ui
+ * @throws Exception if any
+ */
+ protected JAXXContext createUIContext(NavigationTreeNode node) throws Exception {
+
+ if (node.getUIHandlerClass() == null) {
+ if (log.isWarnEnabled()) {
+ log.warn("no action associated with ui " + node.getUIClass());
+ }
+ // no action associated, just
+ return getContext();
+ }
+
+ JAXXAction action = node.getUIHandlerClass().newInstance();
+
+ // init context with
+ JAXXInitialContext uiContext = action.init(getContext());
+ return uiContext;
+ }
+
+ protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("find data for contextPath <" + node.getFullPath() + "> : " + (data == null ? null : data.getClass()));
+ }
+ JAXXContext ctxt = getContext();
+ NavigationTreeContextHelper helper = getContextHelper();
+
+ // remove previous selected bean
+ //TODO-TC-20091004 should have an automatic clean context method while
+ helper.setSelectedBean(ctxt, null);
+
+ if (data != null) {
+
+ helper.setSelectedBean(ctxt, data);
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModel.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,314 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.tree.TreeModelSupport;
+import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
+import org.jdesktop.swingx.treetable.MutableTreeTableNode;
+import org.jdesktop.swingx.treetable.TreeTableNode;
+
+import javax.swing.table.TableModel;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.MutableTreeNode;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Model of the tree used for a navigation tree table.
+ * <p/>
+ * Il est composé de {@link NavigationTreeNode}
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public class NavigationTreeTableModel extends DefaultTreeTableModel implements NavigationModel {
+
+ static private final long serialVersionUID = 1L;
+
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(NavigationTreeTableModel.class);
+
+ /**
+ * The path separator used to build the {@link NavigationTreeNode#fullPath}.
+ *
+ * @see NavigationTreeNode#getNodePath()
+ * @see NavigationTreeNode#getFullPath()
+ */
+ protected final String pathSeparator;
+
+ /**
+ * Context to retrieve beans
+ */
+ private JAXXContext context;
+
+ protected List<String> columnsName;
+
+ public NavigationTreeTableModel(String pathSeparator, JAXXContext context, List<String> columnsName) {
+ super(null);
+ this.pathSeparator = pathSeparator;
+ this.context = context;
+ this.columnsName = columnsName;
+ }
+
+ /**
+ * @see NavigationModel#getRoot()
+ */
+ public NavigationTreeTableNode getRoot() {
+ return (NavigationTreeTableNode) super.root;
+ }
+
+ public TreeNode[] getPathToRoot(TreeNode aNode) {
+ if (aNode == null){
+ return null;
+ }
+ return super.getPathToRoot((TreeTableNode)aNode);
+
+ }
+
+ public void setRoot(NavigationTreeTableNode root) {
+ this.root = root;
+ getModelSupport().fireNewRoot();
+ }
+
+ /**
+ * Message this to remove node from its parent. This will message
+ * nodesWereRemoved to create the appropriate event. This is the preferred
+ * way to remove a node as it handles the event creation for you.
+ */
+ public void removeNodeFromParent(MutableTreeNode node) {
+ MutableTreeTableNode parent = (MutableTreeTableNode) node.getParent();
+
+ if (parent == null) {
+ throw new IllegalArgumentException("node does not have a parent.");
+ }
+
+ int index = parent.getIndex(node);
+ node.removeFromParent();
+
+ modelSupport.fireChildRemoved(new TreePath(getPathToRoot(parent)),
+ index, node);
+ }
+
+ /**
+ * @see NavigationModel#findNode(String)
+ */
+ public NavigationTreeNode findNode(String path) {
+ return findNode(getRoot(), path, (Pattern) null);
+ }
+
+ /**
+ * @see NavigationModel#findNode(String, String)
+ */
+ public NavigationTreeNode findNode(String path, String regex) {
+ return findNode(getRoot(), path, regex);
+ }
+
+ /**
+ * @see NavigationModel#findNode(String, Pattern)
+ */
+ public NavigationTreeNode findNode(String path, Pattern regex) {
+ return findNode(getRoot(), path, regex);
+ }
+
+ /**
+ * @see NavigationModel#findNode(NavigationTreeNode, String)
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path) {
+ return findNode(root, path, (Pattern) null);
+ }
+
+ /**
+ * @see NavigationModel#findNode(NavigationTreeNode, String, String)
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) {
+ return findNode(root, path, regex == null ? null : Pattern.compile(regex));
+ }
+
+ /**
+ * @see NavigationModel#findNode(NavigationTreeNode, String, Pattern)
+ */
+ public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) {
+ if (regex != null) {
+ Matcher matcher = regex.matcher(path);
+ if (!matcher.matches() || matcher.groupCount() < 1) {
+ log.warn("no matching regex " + regex + " to " + path);
+ return null;
+ }
+ path = matcher.group(1);
+ if (log.isDebugEnabled()) {
+ log.debug("matching regex " + regex + " : " + path);
+ }
+ }
+ StringTokenizer stk = new StringTokenizer(path, pathSeparator);
+ NavigationTreeNode result = root;
+ // pas the first token (matches the root node)
+ if (root.isRoot() && stk.hasMoreTokens()) {
+ String rootPath = stk.nextToken();
+ if (!rootPath.equals(root.getNodePath())) {
+ return null;
+ }
+ }
+ while (stk.hasMoreTokens()) {
+ result = result.getChild(stk.nextToken());
+ }
+ return result;
+ }
+
+ /**
+ * @see NavigationModel#getContext()
+ */
+ public JAXXContext getContext() {
+ return context;
+ }
+
+ /**
+ * @see NavigationModel#getBean(String)
+ */
+ public Object getBean(String navigationPath) {
+ Object result;
+ NavigationTreeNode node = findNode(navigationPath, (Pattern) null);
+ result = getBean(node);
+ return result;
+ }
+
+ /**
+ * @see NavigationModel#getBean(NavigationTreeNode)
+ */
+ public Object getBean(NavigationTreeNode node) {
+ if (node == null) {
+ return null;
+ //fixme should throw a NPE exception
+ //throw new NullPointerException("node can not be null");
+ }
+ return node.getBean(getContext());
+ }
+
+
+ /**
+ * Accessor to tree model support.
+ *
+ * @return tree model support
+ */
+ protected TreeModelSupport getModelSupport() {
+ return modelSupport;
+ }
+
+ /**
+ * @see NavigationModel#nodeChanged(TreeNode)
+ */
+ public void nodeChanged(TreeNode node) {
+ if (node != null){
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ TreeNode[] treeNodes = getPathToRoot(parent);
+ if (treeNodes != null){
+ modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
+ } else {
+ log.error("[Node changed] Path to root is null !");
+ }
+ reload((NavigationTreeTableNode)node, true);
+ } else {
+ log.error("Node is null !");
+ }
+ }
+
+ /**
+ * @see NavigationModel#nodeStructureChanged(TreeNode)
+ */
+ public void nodeStructureChanged(TreeNode node) {
+ if (node != null){
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ TreeNode[] treeNodes = getPathToRoot(parent);
+ if (treeNodes != null){
+ modelSupport.fireTreeStructureChanged(new TreePath(treeNodes));
+ } else {
+ log.error("[Node structure changed] Path to root is null !");
+ }
+ reload((NavigationTreeTableNode)node, true);
+ } else {
+ log.error("Node is null !");
+ }
+ }
+
+ /**
+ * @see NavigationModel#nodeChanged(TreeNode, boolean)
+ */
+ public void nodeChanged(TreeNode node, boolean deep) {
+ if (node != null){
+ MutableTreeNode parent = (MutableTreeNode)node.getParent();
+ TreeNode[] treeNodes = getPathToRoot(parent);
+ if (treeNodes != null){
+ modelSupport.fireChildChanged(new TreePath(treeNodes), parent.getIndex(node), node);
+ } else {
+ log.error("[Node changed] Path to root is null !");
+ }
+ reload((NavigationTreeTableNode)node, deep);
+ } else {
+ log.error("Node is null !");
+ }
+ }
+
+ protected void reload(NavigationTreeTableNode node) {
+ reload(node, false);
+ }
+
+ protected void reload(NavigationTreeTableNode node, boolean deep) {
+ if (node == null) {
+ return;
+ }
+ node.reload(getContext());
+
+ if (deep) {
+ Enumeration<?> childs = node.children();
+ while (childs.hasMoreElements()) {
+ NavigationTreeTableNode o = (NavigationTreeTableNode) childs.nextElement();
+ reload(o, true);
+ }
+ }
+ }
+
+ /**
+ * @see NavigationModel#getPathSeparator()
+ */
+ public String getPathSeparator() {
+ return pathSeparator;
+ }
+
+ @Override
+ public int getColumnCount(){
+ return columnsName.size();
+ }
+
+ @Override
+ public String getColumnName(int column){
+ return columnsName.get(column);
+ }
+
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModelBuilder.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModelBuilder.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableModelBuilder.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,264 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.JAXXAction;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import jaxx.runtime.decorator.Decorator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Enumeration;
+
+/**
+ * This object is design to build a {@link NavigationTreeTableModel}.
+ *
+ * @see NavigationModelBuilder
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public abstract class NavigationTreeTableModelBuilder implements NavigationModelBuilder{
+
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(NavigationTreeModelBuilder.class);
+ /**
+ * The model dealed by the builder.
+ *
+ * <b>Note:</b> It is a good idea to keep only one instance of the model.
+ * If reset is required, should empty the model but not reinstanciate it.
+ */
+ protected NavigationTreeTableModel model;
+ /**
+ * default ui class to use if node does not define an ui class
+ */
+ protected Class<? extends JAXXObject> defaultUIClass;
+ /**
+ * [optional] default action class
+ */
+ protected Class<? extends JAXXAction> defaultUIHandlerClass;
+
+ public NavigationTreeTableModelBuilder(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, NavigationTreeTableModel model) {
+ this.defaultUIClass = defaultUIClass;
+ this.defaultUIHandlerClass = defaultUIHandlerClass;
+ this.model = model;
+ }
+
+ public NavigationTreeTableModel getModel() {
+ return model;
+ }
+
+ public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, entryDef, null);
+ addI18nNodeRenderer(node, "");
+ return addChildNode(null, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, entryDef, entryPath);
+ addI18nNodeRenderer(node, libelle);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, entryDef, null);
+ addI18nNodeRenderer(node, libelle);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, null, entryPath);
+ addI18nNodeRenderer(node, libelle);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, entryDef, entryPath);
+ addDecoratorNodeRenderer(node, decorator);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ JAXXContextEntryDef<?> entryDef,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, entryDef, null);
+ addDecoratorNodeRenderer(node, decorator);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator,
+ String entryPath,
+ String contextName,
+ Class<? extends JAXXObject> uiClass,
+ Class<? extends JAXXAction> actionClass) {
+ NavigationTreeTableNode node = createNavigationTreeTableNode(model.pathSeparator, contextName, null, entryPath);
+ addDecoratorNodeRenderer(node, decorator);
+ addNodeJaxxClasses(node, uiClass, actionClass);
+ return addChildNode(parentNode, node);
+ }
+
+ protected NavigationTreeNode addChildNode(NavigationTreeNode parentNode, NavigationTreeTableNode node) {
+
+ if (node.getUIClass() == null) {
+ // no ui is associated with this node, use the default one
+ node.setUIClass(defaultUIClass);
+ }
+
+ if (node.getUIHandlerClass() == null) {
+ // no ui handler associated with this node, use the default one
+ node.setUIHandlerClass(defaultUIHandlerClass);
+ }
+ if (parentNode == null) {
+ model.setRoot(node);
+ } else {
+ parentNode.add(node);
+ }
+ model.nodeStructureChanged(node);
+ return node;
+ }
+
+ public NavigationTreeNode removeChildNode(NavigationTreeNode node) {
+ NavigationTreeNode parentNode = node.getParent();
+ model.removeNodeFromParent(node);
+ return parentNode;
+ }
+
+ public void addI18nNodeRenderer(NavigationTreeNode node, String libelle) {
+ node.setRenderer(new NavigationTreeNodeRendererI18nImpl(libelle));
+ }
+
+ public void addDecoratorNodeRenderer(NavigationTreeNode node, Decorator<?> decorator) {
+ node.setRenderer(new NavigationTreeNodeRendererDecoratorImpl(decorator));
+ }
+
+ public void addNodeJaxxClasses(
+ NavigationTreeNode node,
+ Class<? extends JAXXObject> uIClass,
+ Class<? extends JAXXAction> uIHandlerClass) {
+ node.setUIClass(uIClass);
+ node.setUIHandlerClass(uIHandlerClass);
+ }
+
+ public void printModel(NavigationTreeNode node) {
+ if (node == null) {
+ return;
+ }
+ log.info("node " + node.getFullPath() + ", jxpath: " + node.getJaxxContextEntryPath() + ", entryContextDef: " + node.getJaxxContextEntryDef());
+ if (log.isDebugEnabled()) {
+ log.debug("node userObject" + node.getUserObject());
+ log.debug("value from node " + node.getBean(getModel().getContext()));
+ log.debug("value from model " + getModel().getBean(node));
+ }
+ Enumeration<?> children = node.children();
+ while (children.hasMoreElements()) {
+ printModel((NavigationTreeNode) children.nextElement());
+ }
+ }
+
+ // To create your own instance of NavigationTreeTableNode
+ public abstract NavigationTreeTableNode createNavigationTreeTableNode(String pathSeparator, String contextName, JAXXContextEntryDef<?> jaxxContextEntryDef, String jaxxContextEntryPath);
+
+ public static abstract class ChildBuilder<O> {
+
+ protected NavigationTreeModelBuilder builder;
+
+ protected ChildBuilder(NavigationTreeModelBuilder builder) {
+ this.builder = builder;
+ }
+
+ protected abstract void init(Class<? extends O> klass);
+
+ protected abstract Decorator<? extends O> getDecorator(O child);
+
+ protected abstract String getJXPath(O child);
+
+ protected abstract String getNavigationPath(O child);
+
+ public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, java.util.Collection<? extends O> beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) {
+
+ if (beans == null || beans.isEmpty()) {
+ // no bean to treate
+ return;
+ }
+
+ init(klass);
+
+ NavigationTreeNode node;
+
+ for (O o : beans) {
+ node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass);
+ if (cacheValues) {
+ // cache the bean value to improve performance
+ node.setBean(o);
+ }
+ }
+ }
+
+ public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, O[] beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) {
+
+ if (beans == null || beans.length == 0) {
+ // no bean to treate
+ return;
+ }
+
+ init(klass);
+
+ NavigationTreeNode node;
+
+ for (O o : beans) {
+ node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass);
+ if (cacheValues) {
+ // cache the bean value to improve performance
+ node.setBean(o);
+ }
+ }
+ }
+ }
+}
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableNode.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableNode.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeTableNode.java 2010-02-12 18:49:48 UTC (rev 1739)
@@ -0,0 +1,78 @@
+/*
+ * *##%
+ * 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.navigation;
+
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.jdesktop.swingx.treetable.TreeTableNode;
+
+import java.util.Enumeration;
+
+/**
+ * Node of the {@link NavigationTreeTableModel}.
+ *
+ * @see NavigationTreeNode
+ *
+ * @author sletellier
+ * @since 2.0.0
+ */
+public abstract class NavigationTreeTableNode extends NavigationTreeNode implements TreeTableNode{
+
+ public NavigationTreeTableNode(String pathSeparator, String navigationPath, Object jaxxContextEntryDef) {
+ super(pathSeparator, navigationPath, jaxxContextEntryDef);
+ }
+
+ public NavigationTreeTableNode(String pathSeparator, String navigationPath, JAXXContextEntryDef<?> jaxxContextEntryDef, String jaxxContextEntryPath) {
+ super(pathSeparator, navigationPath, jaxxContextEntryDef, jaxxContextEntryPath);
+ }
+
+ @Override
+ public NavigationTreeTableNode getChildAt(int index) {
+ return (NavigationTreeTableNode) super.getChildAt(index);
+ }
+
+ @Override
+ public NavigationTreeTableNode getParent() {
+ return (NavigationTreeTableNode) super.getParent();
+ }
+
+ /**
+ * @see NavigationTreeNode#getChild(String)
+ */
+ @Override
+ public NavigationTreeTableNode getChild(String path) {
+ Enumeration<?> childs = children();
+ while (childs.hasMoreElements()) {
+ NavigationTreeTableNode son = (NavigationTreeTableNode) childs.nextElement();
+ if (path.equals(son.getNodePath())) {
+ return son;
+ }
+ }
+ return null;
+ }
+
+ public abstract Object getValueAt(int column);
+
+ public abstract int getColumnCount();
+
+ public abstract boolean isEditable(int column);
+
+ public abstract void setValueAt(Object aValue, int column);
+}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
+++ trunk/pom.xml 2010-02-12 18:49:48 UTC (rev 1739)
@@ -249,6 +249,7 @@
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6</version>
+ <scope>compile</scope>
</dependency>
<!--dependency>
2
1
r1738 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 08 Feb '10
by tchemit@users.nuiton.org 08 Feb '10
08 Feb '10
Author: tchemit
Date: 2010-02-08 16:58:19 +0100 (Mon, 08 Feb 2010)
New Revision: 1738
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/jaxx-compiler/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/jaxx-demo/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/jaxx-runtime/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/jaxx-swing-action/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/jaxx-widgets/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/maven-jaxx-plugin/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-08 15:58:16 UTC (rev 1737)
+++ trunk/pom.xml 2010-02-08 15:58:19 UTC (rev 1738)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5</version>
+ <version>2.0.0-beta-6-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
@@ -413,9 +413,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-5</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-5</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-5</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
</project>
1
0
Author: tchemit
Date: 2010-02-08 16:58:16 +0100 (Mon, 08 Feb 2010)
New Revision: 1737
Added:
tags/jaxx-2.0.0-beta-5/
Log:
[maven-scm] copy for tag jaxx-2.0.0-beta-5
1
0
r1736 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 08 Feb '10
by tchemit@users.nuiton.org 08 Feb '10
08 Feb '10
Author: tchemit
Date: 2010-02-08 16:58:13 +0100 (Mon, 08 Feb 2010)
New Revision: 1736
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-2.0.0-beta-5
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/jaxx-compiler/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/jaxx-demo/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/jaxx-runtime/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/jaxx-swing-action/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/jaxx-widgets/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/maven-jaxx-plugin/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-08 15:55:36 UTC (rev 1735)
+++ trunk/pom.xml 2010-02-08 15:58:13 UTC (rev 1736)
@@ -14,7 +14,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-5-SNAPSHOT</version>
+ <version>2.0.0-beta-5</version>
<modules>
<module>jaxx-runtime</module>
@@ -413,9 +413,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-5</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-5</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-5</url>
</scm>
</project>
1
0
r1735 - in trunk: jaxx-compiler/src/main/java/jaxx/compiler jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation jaxx-runtime/src/test/java/jaxx/runtime/validator/field jaxx-swing-action/src/main/java/org/nuiton/jaxx/action
by tchemit@users.nuiton.org 08 Feb '10
by tchemit@users.nuiton.org 08 Feb '10
08 Feb '10
Author: tchemit
Date: 2010-02-08 16:55:36 +0100 (Mon, 08 Feb 2010)
New Revision: 1735
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java
trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java
Log:
fix javadoc
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java 2010-02-08 15:54:46 UTC (rev 1734)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java 2010-02-08 15:55:36 UTC (rev 1735)
@@ -1,23 +1,23 @@
-/*
- * *##%
- * 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>.
- * ##%*
- */
+/*
+ * *##%
+ * 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.lang.builder.ToStringBuilder;
@@ -27,7 +27,7 @@
import jaxx.runtime.JAXXContext;
/**
- * Options of the {@link JAXXCompiler} and {@link JAXXCompilerLaunchor}.
+ * Options of the {@link JAXXCompiler} and {@link JAXXEngine}.
*
*/
public class DefaultCompilerConfiguration implements CompilerConfiguration {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java 2010-02-08 15:54:46 UTC (rev 1734)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java 2010-02-08 15:55:36 UTC (rev 1735)
@@ -27,7 +27,7 @@
import java.util.List;
/**
- * I18n methods to add {@link org.nuiton.i18n.I18n#_(java.lang.String, java.lang.Object[])} method on some attributes.
+ * I18n methods to add {@link org.nuiton.i18n.I18n#_(String, Object...)} method on some attributes.
* <p/>
* Make sure to set an i18nable compiler to have his {@link CompilerConfiguration#isI18nable()} returning true.
*
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-02-08 15:54:46 UTC (rev 1734)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java 2010-02-08 15:55:36 UTC (rev 1735)
@@ -102,7 +102,7 @@
}
/**
- * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point
+ * Test the {@link NavigationTreeModel#getBean(String)}} with an entry point
* as a bean.
* <p/>
* Tree is like this
@@ -222,7 +222,7 @@
}
/**
- * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point
+ * Test the {@link NavigationTreeModel#getBean(String)} with an entry point
* as a list.
* <p/>
* Tree is like this
Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java
===================================================================
--- trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java 2010-02-08 15:54:46 UTC (rev 1734)
+++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java 2010-02-08 15:55:36 UTC (rev 1735)
@@ -18,10 +18,10 @@
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* ##%*
*/
-package jaxx.runtime.validator.field;
+package jaxx.runtime.validator.field;
/**
- * Abstract class to test a specific validator for the {@link Validatorbean}.
+ * Abstract class to test a specific validator for the {@link ValidatorBean}.
*
* @author chemit
* @since 1.3
Modified: trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java
===================================================================
--- trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java 2010-02-08 15:54:46 UTC (rev 1734)
+++ trunk/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java 2010-02-08 15:55:36 UTC (rev 1735)
@@ -39,12 +39,12 @@
/**
* The contract to be realized to resolve an {@link MyAbstractAction} configuration.
* <p/>
- * Configuration is done by a Annotation of type {@link A} placed on the action class.
+ * Configuration is done by a Annotation of type {@code A} placed on the action class.
* <p/>
* If the instanciated action box the real action, we should always search on the boxed action.
* <p/>
* Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
- * of the component type is given by the {@link C} class.
+ * of the component type is given by the {@code C} class.
*
* @param <A> type of annotation for config
* @param <C> type of component
1
0
Author: tchemit
Date: 2010-02-08 16:54:46 +0100 (Mon, 08 Feb 2010)
New Revision: 1734
Modified:
trunk/pom.xml
Log:
add checkstyle report
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-07 11:40:13 UTC (rev 1733)
+++ trunk/pom.xml 2010-02-08 15:54:46 UTC (rev 1734)
@@ -398,6 +398,15 @@
</build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version> 2.4</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
1
0
r1733 - in trunk/jaxx-runtime/src/main/java/jaxx/runtime: decorator swing
by tchemit@users.nuiton.org 07 Feb '10
by tchemit@users.nuiton.org 07 Feb '10
07 Feb '10
Author: tchemit
Date: 2010-02-07 12:40:13 +0100 (Sun, 07 Feb 2010)
New Revision: 1733
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java
Log:
Anomalie #302: Fix NPE in Decorator sort when context data is null
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-01 01:40:24 UTC (rev 1732)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java 2010-02-07 11:40:13 UTC (rev 1733)
@@ -156,6 +156,15 @@
public int compare(O o1, O o2) {
Comparable<Comparable<?>> c1 = valueCache.get(o1);
Comparable<Comparable<?>> c2 = valueCache.get(o2);
+ if (c1 == null) {
+ if (c2 == null) {
+ return 0;
+ }
+ return 1;
+ }
+ if (c2 == null) {
+ return -1;
+ }
return c1.compareTo(c2);
}
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java 2010-02-01 01:40:24 UTC (rev 1732)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java 2010-02-07 11:40:13 UTC (rev 1733)
@@ -34,7 +34,7 @@
*/
public class OneClicListSelectionModel implements ListSelectionModel {
- /** to use log facility, just put in your code: log.info("..."); */
+ /** Logger */
static private Log log = LogFactory.getLog(OneClicListSelectionModel.class);
protected ListSelectionModel delegate;
protected final ListModel model;
1
0
Author: tchemit
Date: 2010-02-01 02:40:24 +0100 (Mon, 01 Feb 2010)
New Revision: 1732
Modified:
trunk/jaxx-demo/pom.xml
Log:
clean imports
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-02-01 01:32:44 UTC (rev 1731)
+++ trunk/jaxx-demo/pom.xml 2010-02-01 01:40:24 UTC (rev 1732)
@@ -169,6 +169,7 @@
<groupId>org.nuiton.i18n</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
+ <treateDefaultEntry>true</treateDefaultEntry>
<entries>
<entry>
<basedir>${maven.gen.dir}/java/</basedir>
1
0
Author: tchemit
Date: 2010-02-01 02:32:44 +0100 (Mon, 01 Feb 2010)
New Revision: 1731
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
Log:
clean imports
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:32:44 UTC (rev 1731)
@@ -0,0 +1,234 @@
+-=
+.=
+0=
+1=
+10=
+12=
+14=
+18=
+2=
+24=
+3=
+4=
+5=
+6=
+7=
+8=
+9=
+Age\:=
+Animal=
+Blue=
+Blue\:=
+Bold=
+Button\ label\:=
+C=
+CE=
+Cancel=
+Comments\:=
+Config\ file\ \:=
+Config\ file\:=
+Cyan=
+Dec\ (-)=
+Demo=
+Directory\ file\:=
+Editable=
+Email\ Address\:=
+Email\:=
+Enabled=
+EnumEditor\ (country)\ \:=
+EnumEditor\ (language)\ \:=
+Fancy\ Button=
+First\ Name\:=
+FirstName\:=
+Font\ size=
+Font\ size\:\ =
+Fool\ me\ once=
+Fool\ me\ twice=
+Green=
+Green\:=
+Greet=
+Help=
+Inc\ (+)=
+Italic=
+JAXX\ Demo=
+JMenu\ demo=
+Label\ 1=
+Label\ 2=
+Last\ Name\:=
+LastName\:=
+Locale\ editor\:=
+Message\ Box=
+Mineral=
+Normal\ text\:=
+OK=
+Orange=
+Password\:=
+Purple=
+Ratio\:=
+Red=
+Red\:=
+Reset=
+Show\ Background=
+Show\ password\ dialog=
+Sign\ on=
+Simple\ Button=
+Size\:=
+Sources=
+Spacing\:=
+Start=
+Stop=
+Supported\ Swing\ components\:=
+Text2\:=
+Text\:=
+Total\:\ =
+Underline=
+Upper\ case\ text\:=
+Use\ the\ spinner\ to=
+Username\:=
+Vegetable=
+View=
+Welcome\ to\ the\ JAXX\ framework\!=
+Working\ directory\:=
+Yellow=
+You\ entered\:\ =
+Your\ name\:=
+\\u00f7=
+actors=
+adjust\ the\ spacing=
+between\ these\ lines=
+button\ A=
+button\ B=
+button\ C\ (full\ block)=
+button\ D\ (full\ block\ 2)=
+cancel=
+close=Disable
+close2=Disable 2
+close3=Disable 3
+demo.action.reload.application=Reload application
+demo.action.reload.ui=Reload UI
+edit=Edit
+edit2=Edit 2
+edit3=Edit 3
+f0=
+f1=
+file...=
+form.ratio=Ratio
+form.text=Text
+form.text2=Text 2
+form2.ratio=Form 2 Ratio
+form2.text=Form 2 Text
+form2.text2=Form 2 Text 2
+getModel0().isF0()=
+getModel0().isF0()\ &&\ getModel0().isF1()=
+getModel0().isF0()\ ||\ getModel0().isF1()=
+getModel0().isF1()=
+getModel1().isF0()=
+getModel1().isF0()\ &&\ getModel1().isF1()=
+getModel1().isF0()\ ||\ getModel1().isF1()=
+getModel1().isF1()=
+getT0().isSelected()=
+getT0().isSelected()\ &&\ getT1().isSelected()=
+getT0().isSelected()\ ||\ getT1().isSelected()=
+getT1().isSelected()=
+i18neditor.popup.title=
+isF0()=
+isF0()\ &&\ isF1()=
+isF0()\ ||\ isF1()=
+isF1()=
+jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>.
+jaxxdemo.action.about=About...
+jaxxdemo.action.about.tip=About JAXXDemo...
+jaxxdemo.action.add=
+jaxxdemo.action.configuration=Preferences
+jaxxdemo.action.configuration.tip=Change the preferences of the application
+jaxxdemo.action.exit=Quit
+jaxxdemo.action.exit.tip=Quit JAXXDemo
+jaxxdemo.action.fullscreen=Full screen
+jaxxdemo.action.fullscreen.tip=Change to full screen mode
+jaxxdemo.action.help=
+jaxxdemo.action.help.tip=Display help
+jaxxdemo.action.locale.fr=French
+jaxxdemo.action.locale.fr.tip=Change to french language
+jaxxdemo.action.locale.uk=English
+jaxxdemo.action.locale.uk.tip=Change to english language
+jaxxdemo.action.normalscreen=Normal screen
+jaxxdemo.action.normalscreen.tip=Change to normal screen mode
+jaxxdemo.action.remove=Remove
+jaxxdemo.action.show=show
+jaxxdemo.action.site=Web site
+jaxxdemo.action.site.tip=Go to the web site
+jaxxdemo.config.category.directories=Files
+jaxxdemo.config.category.directories.description=Files used by application
+jaxxdemo.config.category.other=Others
+jaxxdemo.config.category.other.description=Others preferences
+jaxxdemo.config.configFileName.description=Configuration file name
+jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
+jaxxdemo.config.ui.fontSize=default font size to use in sources
+jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
+jaxxdemo.config.ui.locale=Language used in application
+jaxxdemo.i18neditor.configuration=Configuration
+jaxxdemo.i18neditor.popupBorderText=Popup title
+jaxxdemo.i18neditor.selected.locale=Selected Language
+jaxxdemo.i18neditor.showIcon=Show icons
+jaxxdemo.i18neditor.showPopupIcon=Show icons in popup
+jaxxdemo.i18neditor.showPopupText=Show texts in popup
+jaxxdemo.i18neditor.showText=Show text
+jaxxdemo.init.closed=JAXXDemo was closed at %1$s
+jaxxdemo.init.context.done=Context initialized in %1$s
+jaxxdemo.init.ui.done=UI initialized.
+jaxxdemo.menu.file=File
+jaxxdemo.menu.file.locale=Languages
+jaxxdemo.menu.help=
+jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
+jaxxdemo.message.goto.site=Go to JAXXDemo Web site
+jaxxdemo.navigation.actor.title=
+jaxxdemo.navigation.actors.title=
+jaxxdemo.navigation.movie.title=
+jaxxdemo.navigation.movies.title=
+jaxxdemo.numbereditor.autoPopup=
+jaxxdemo.numbereditor.configuration=
+jaxxdemo.numbereditor.model=
+jaxxdemo.numbereditor.model.float=
+jaxxdemo.numbereditor.model.int=
+jaxxdemo.numbereditor.showPopupButton=
+jaxxdemo.numbereditor.showReset=
+jaxxdemo.numbereditor.useFloat=
+jaxxdemo.numbereditor.useSign=
+jaxxdemo.title.about=About JAXXDemo...
+jaxxdemo.tree.component.jaxx=JAXX Components
+jaxxdemo.tree.component.jaxx.editor=Editors
+jaxxdemo.tree.component.jaxx.tree.navigation=Navigation trees
+jaxxdemo.tree.component.swing=Swing Components
+jaxxdemo.tree.component.swing.buttons=Buttons
+jaxxdemo.tree.component.swing.form=Form elements
+jaxxdemo.tree.component.swing.form.text=Text
+jaxxdemo.tree.component.swing.layout=Layouts
+jaxxdemo.tree.component.swing.menu=Menus
+jaxxdemo.tree.component.swing.window=windows
+jaxxdemo.tree.feature=Features
+jaxxdemo.tree.features.databinding=Data Binding
+jaxxdemo.tree.features.validation=Validation
+jaxxdemo.tree.fun=Fun
+jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java.
+jaxxdemo.warning.no.ui=No ui environnement detected
+model0.f0=
+model0.f1=
+model0.file...=
+model0.isF0()=
+model0.isF0()\ &&\ model0.isF1()=
+model0.isF0()\ ||\ model0.isF1()=
+model0.isF1()=
+model1.f0=
+model1.f1=
+model1.file...=
+model1.isF0()=
+model1.isF0()\ &&\ model1.isF1()=
+model1.isF0()\ ||\ model1.isF1()=
+model1.isF1()=
+movies=Movies
+t0.isSelected()=
+t0.isSelected()\ &&\ t1.isSelected()=
+t0.isSelected()\ ||\ t1.isSelected()=
+t1.isSelected()=
+valid=
+x=
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:32:44 UTC (rev 1731)
@@ -0,0 +1,234 @@
+-=-
+.=.
+0=0
+1=1
+10=10
+12=12
+14=14
+18=18
+2=2
+24=24
+3=3
+4=4
+5=5
+6=6
+7=7
+8=8
+9=9
+Age\:=Age \:
+Animal=Animal
+Blue=Bleu
+Blue\:=bleu \:
+Bold=En gras
+Button\ label\:=Libell\u00e9 de l'action
+C=C
+CE=CE
+Cancel=Annuler
+Comments\:=Commentaire
+Config\ file\ \:=Fichier de configuration
+Config\ file\:=Fichier de configuration \:
+Cyan=Bleu cyan
+Dec\ (-)=
+Demo=Demonstration
+Directory\ file\:=
+Editable=Editable
+Email\ Address\:=Courriel
+Email\:=Courriel
+Enabled=Activ\u00e9
+EnumEditor\ (country)\ \:=Editeur de pays
+EnumEditor\ (language)\ \:=Editeur de langue
+Fancy\ Button=Bouton 'Fancy'
+First\ Name\:=Pr\u00e9nom
+FirstName\:=Pr\u00e9nom \:
+Font\ size=Taille de la police
+Font\ size\:\ =
+Fool\ me\ once=
+Fool\ me\ twice=
+Green=Vert
+Green\:=Vert \:
+Greet=
+Help=
+Inc\ (+)=Incr\u00e9menter (+)
+Italic=Italique
+JAXX\ Demo=
+JMenu\ demo=
+Label\ 1=
+Label\ 2=
+Last\ Name\:=Nom \:
+LastName\:=Nom
+Locale\ editor\:=Editeur de locale
+Message\ Box=
+Mineral=
+Normal\ text\:=
+OK=
+Orange=
+Password\:=Mot de passe
+Purple=Pourpre
+Ratio\:=
+Red=Rouge
+Red\:=rouge \:
+Reset=Reinitialiser
+Show\ Background=Voir le fond
+Show\ password\ dialog=Voir l'\u00e9diteur de mot de passe
+Sign\ on=Signer
+Simple\ Button=Bouton simple
+Size\:=Taille \:
+Sources=Sources
+Spacing\:=Espacement \:
+Start=D\u00e9marrer
+Stop=Arr\u00eater
+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
+Username\:=Utilisateur \:
+Vegetable=L\u00e9gumes
+View=Vue
+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
+adjust\ the\ spacing=
+between\ these\ lines=
+button\ A=Bouton A
+button\ B=Bouton B
+button\ C\ (full\ block)=Bouton C (blocage compl\u00eat)
+button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00eat)
+cancel=Annuler
+close=Fermer
+close2=Fermer 2
+close3=Fermer 3
+demo.action.reload.application=Redemarrer l'application
+demo.action.reload.ui=Recharger l'interface graphique
+edit=Editer
+edit2=Editer 2
+edit3=Editer 3
+f0=
+f1=
+file...=
+form.ratio=Form \: ratio
+form.text=Form \: text
+form.text2=Form \: text2
+form2.ratio=Form2 \: ratio
+form2.text=Form2 \: text
+form2.text2=Form2 \: text2
+getModel0().isF0()=
+getModel0().isF0()\ &&\ getModel0().isF1()=
+getModel0().isF0()\ ||\ getModel0().isF1()=
+getModel0().isF1()=
+getModel1().isF0()=
+getModel1().isF0()\ &&\ getModel1().isF1()=
+getModel1().isF0()\ ||\ getModel1().isF1()=
+getModel1().isF1()=
+getT0().isSelected()=
+getT0().isSelected()\ &&\ getT1().isSelected()=
+getT0().isSelected()\ ||\ getT1().isSelected()=
+getT1().isSelected()=
+i18neditor.popup.title=
+isF0()=
+isF0()\ &&\ isF1()=
+isF0()\ ||\ isF1()=
+isF1()=
+jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>.
+jaxxdemo.action.about=A propos
+jaxxdemo.action.about.tip=A propos de JAXX Demo...
+jaxxdemo.action.add=
+jaxxdemo.action.configuration=Configuration
+jaxxdemo.action.configuration.tip=Modifier la configuration
+jaxxdemo.action.exit=Quitter
+jaxxdemo.action.exit.tip=Quitter JAXX Demo
+jaxxdemo.action.fullscreen=Plein \u00e9cran
+jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00e9cran
+jaxxdemo.action.help=Aide
+jaxxdemo.action.help.tip=Affichier l'aide
+jaxxdemo.action.locale.fr=Fran\u00e7ais
+jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00e7ais
+jaxxdemo.action.locale.uk=Anglais
+jaxxdemo.action.locale.uk.tip=Changer la langue en anglais
+jaxxdemo.action.normalscreen=Ecran normal
+jaxxdemo.action.normalscreen.tip=Revenir en mode normal
+jaxxdemo.action.remove=
+jaxxdemo.action.show=
+jaxxdemo.action.site=Site internet
+jaxxdemo.action.site.tip=Acc\u00e9der au site de l'application sur internet
+jaxxdemo.config.category.directories=R\u00e9pertoires
+jaxxdemo.config.category.directories.description=R\u00e9pertoires de l'application
+jaxxdemo.config.category.other=Autre
+jaxxdemo.config.category.other.description=Autres options
+jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
+jaxxdemo.config.ui.demo.path=Chemin de la d\u00e9mo par d\u00e9faut
+jaxxdemo.config.ui.fontSize=La taille de la police \u00e0 utiliser pour visualiser dans les sources
+jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00e9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00e9e par l'application
+jaxxdemo.i18neditor.configuration=Configuration
+jaxxdemo.i18neditor.popupBorderText=Titre de la popup
+jaxxdemo.i18neditor.selected.locale=Langue s\u00e9lectionn\u00e9e
+jaxxdemo.i18neditor.showIcon=Afficher les icones
+jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup
+jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup
+jaxxdemo.i18neditor.showText=Afficher le text
+jaxxdemo.init.closed=JAXX Demo a \u00e9t\u00e9 ferm\u00e9 \u00e0 %1$s
+jaxxdemo.init.context.done=Initialisation du contexte termin\u00e9e en %1$s.
+jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00e9e.
+jaxxdemo.menu.file=Fichier
+jaxxdemo.menu.file.locale=Langues
+jaxxdemo.menu.help=Aide
+jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00e9e.
+jaxxdemo.message.goto.site=Acc\u00e9der au site de JAXX Demo (%1$s)
+jaxxdemo.navigation.actor.title=
+jaxxdemo.navigation.actors.title=
+jaxxdemo.navigation.movie.title=
+jaxxdemo.navigation.movies.title=
+jaxxdemo.numbereditor.autoPopup=Affichage automatique popup
+jaxxdemo.numbereditor.configuration=Configuration
+jaxxdemo.numbereditor.model=R\u00e9sultat
+jaxxdemo.numbereditor.model.float=Valeur d\u00e9cimale \: %1$s
+jaxxdemo.numbereditor.model.int=Valeur enti\u00e8re \: %1$s
+jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup
+jaxxdemo.numbereditor.showReset=Afficher le boutton de reset
+jaxxdemo.numbereditor.useFloat=Utiliser les d\u00e9cimales
+jaxxdemo.numbereditor.useSign=Utiliser le signe
+jaxxdemo.title.about=A propos de JAXX Demo...
+jaxxdemo.tree.component.jaxx=Composants JAXX
+jaxxdemo.tree.component.jaxx.editor=Editeurs
+jaxxdemo.tree.component.jaxx.tree.navigation=Arbre de navigation
+jaxxdemo.tree.component.swing=Composants Swing
+jaxxdemo.tree.component.swing.buttons=Boutons
+jaxxdemo.tree.component.swing.form=Elements de formulaire
+jaxxdemo.tree.component.swing.form.text=Texte
+jaxxdemo.tree.component.swing.layout=Layouts
+jaxxdemo.tree.component.swing.menu=Menus
+jaxxdemo.tree.component.swing.window=Fen\u00eatres
+jaxxdemo.tree.feature=Fonctionnalit\u00e9s
+jaxxdemo.tree.features.databinding=Data binding
+jaxxdemo.tree.features.validation=Validation
+jaxxdemo.tree.fun=Fun
+jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00e9t\u00e9 trouv\u00e9, il faut au moins la version 1.6u10 de java.
+jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00e9tect\u00e9
+model0.f0=
+model0.f1=
+model0.file...=
+model0.isF0()=
+model0.isF0()\ &&\ model0.isF1()=
+model0.isF0()\ ||\ model0.isF1()=
+model0.isF1()=
+model1.f0=
+model1.f1=
+model1.file...=
+model1.isF0()=
+model1.isF0()\ &&\ model1.isF1()=
+model1.isF0()\ ||\ model1.isF1()=
+model1.isF1()=
+movies=Films
+t0.isSelected()=
+t0.isSelected()\ &&\ t1.isSelected()=
+t0.isSelected()\ ||\ t1.isSelected()=
+t1.isSelected()=
+valid=valide
+x=x
1
0
r1730 - in trunk: jaxx-demo/src/main/resources/i18n jaxx-widgets/src/main/resources/i18n
by tchemit@users.nuiton.org 01 Feb '10
by tchemit@users.nuiton.org 01 Feb '10
01 Feb '10
Author: tchemit
Date: 2010-02-01 02:18:46 +0100 (Mon, 01 Feb 2010)
New Revision: 1730
Modified:
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Log:
clean i18n
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -1,234 +0,0 @@
--=
-.=
-0=
-1=
-10=
-12=
-14=
-18=
-2=
-24=
-3=
-4=
-5=
-6=
-7=
-8=
-9=
-Age\:=
-Animal=
-Blue=
-Blue\:=
-Bold=
-Button\ label\:=
-C=
-CE=
-Cancel=
-Comments\:=
-Config\ file\ \:=
-Config\ file\:=
-Cyan=
-Dec\ (-)=
-Demo=
-Directory\ file\:=
-Editable=
-Email\ Address\:=
-Email\:=
-Enabled=
-EnumEditor\ (country)\ \:=
-EnumEditor\ (language)\ \:=
-Fancy\ Button=
-First\ Name\:=
-FirstName\:=
-Font\ size=
-Font\ size\:\ =
-Fool\ me\ once=
-Fool\ me\ twice=
-Green=
-Green\:=
-Greet=
-Help=
-Inc\ (+)=
-Italic=
-JAXX\ Demo=
-JMenu\ demo=
-Label\ 1=
-Label\ 2=
-Last\ Name\:=
-LastName\:=
-Locale\ editor\:=
-Message\ Box=
-Mineral=
-Normal\ text\:=
-OK=
-Orange=
-Password\:=
-Purple=
-Ratio\:=
-Red=
-Red\:=
-Reset=
-Show\ Background=
-Show\ password\ dialog=
-Sign\ on=
-Simple\ Button=
-Size\:=
-Sources=
-Spacing\:=
-Start=
-Stop=
-Supported\ Swing\ components\:=
-Text2\:=
-Text\:=
-Total\:\ =
-Underline=
-Upper\ case\ text\:=
-Use\ the\ spinner\ to=
-Username\:=
-Vegetable=
-View=
-Welcome\ to\ the\ JAXX\ framework\!=
-Working\ directory\:=
-Yellow=
-You\ entered\:\ =
-Your\ name\:=
-\\u00f7=
-actors=
-adjust\ the\ spacing=
-between\ these\ lines=
-button\ A=
-button\ B=
-button\ C\ (full\ block)=
-button\ D\ (full\ block\ 2)=
-cancel=
-close=Disable
-close2=Disable 2
-close3=Disable 3
-demo.action.reload.application=Reload application
-demo.action.reload.ui=Reload UI
-edit=Edit
-edit2=Edit 2
-edit3=Edit 3
-f0=
-f1=
-file...=
-form.ratio=Ratio
-form.text=Text
-form.text2=Text 2
-form2.ratio=Form 2 Ratio
-form2.text=Form 2 Text
-form2.text2=Form 2 Text 2
-getModel0().isF0()=
-getModel0().isF0()\ &&\ getModel0().isF1()=
-getModel0().isF0()\ ||\ getModel0().isF1()=
-getModel0().isF1()=
-getModel1().isF0()=
-getModel1().isF0()\ &&\ getModel1().isF1()=
-getModel1().isF0()\ ||\ getModel1().isF1()=
-getModel1().isF1()=
-getT0().isSelected()=
-getT0().isSelected()\ &&\ getT1().isSelected()=
-getT0().isSelected()\ ||\ getT1().isSelected()=
-getT1().isSelected()=
-i18neditor.popup.title=
-isF0()=
-isF0()\ &&\ isF1()=
-isF0()\ ||\ isF1()=
-isF1()=
-jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>.
-jaxxdemo.action.about=About...
-jaxxdemo.action.about.tip=About JAXXDemo...
-jaxxdemo.action.add=
-jaxxdemo.action.configuration=Preferences
-jaxxdemo.action.configuration.tip=Change the preferences of the application
-jaxxdemo.action.exit=Quit
-jaxxdemo.action.exit.tip=Quit JAXXDemo
-jaxxdemo.action.fullscreen=Full screen
-jaxxdemo.action.fullscreen.tip=Change to full screen mode
-jaxxdemo.action.help=
-jaxxdemo.action.help.tip=Display help
-jaxxdemo.action.locale.fr=French
-jaxxdemo.action.locale.fr.tip=Change to french language
-jaxxdemo.action.locale.uk=English
-jaxxdemo.action.locale.uk.tip=Change to english language
-jaxxdemo.action.normalscreen=Normal screen
-jaxxdemo.action.normalscreen.tip=Change to normal screen mode
-jaxxdemo.action.remove=Remove
-jaxxdemo.action.show=show
-jaxxdemo.action.site=Web site
-jaxxdemo.action.site.tip=Go to the web site
-jaxxdemo.config.category.directories=Files
-jaxxdemo.config.category.directories.description=Files used by application
-jaxxdemo.config.category.other=Others
-jaxxdemo.config.category.other.description=Others preferences
-jaxxdemo.config.configFileName.description=Configuration file name
-jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
-jaxxdemo.config.ui.fontSize=default font size to use in sources
-jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
-jaxxdemo.config.ui.locale=Language used in application
-jaxxdemo.i18neditor.configuration=Configuration
-jaxxdemo.i18neditor.popupBorderText=Popup title
-jaxxdemo.i18neditor.selected.locale=Selected Language
-jaxxdemo.i18neditor.showIcon=Show icons
-jaxxdemo.i18neditor.showPopupIcon=Show icons in popup
-jaxxdemo.i18neditor.showPopupText=Show texts in popup
-jaxxdemo.i18neditor.showText=Show text
-jaxxdemo.init.closed=JAXXDemo was closed at %1$s
-jaxxdemo.init.context.done=Context initialized in %1$s
-jaxxdemo.init.ui.done=UI initialized.
-jaxxdemo.menu.file=File
-jaxxdemo.menu.file.locale=Languages
-jaxxdemo.menu.help=
-jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
-jaxxdemo.message.goto.site=Go to JAXXDemo Web site
-jaxxdemo.navigation.actor.title=
-jaxxdemo.navigation.actors.title=
-jaxxdemo.navigation.movie.title=
-jaxxdemo.navigation.movies.title=
-jaxxdemo.numbereditor.autoPopup=
-jaxxdemo.numbereditor.configuration=
-jaxxdemo.numbereditor.model=
-jaxxdemo.numbereditor.model.float=
-jaxxdemo.numbereditor.model.int=
-jaxxdemo.numbereditor.showPopupButton=
-jaxxdemo.numbereditor.showReset=
-jaxxdemo.numbereditor.useFloat=
-jaxxdemo.numbereditor.useSign=
-jaxxdemo.title.about=About JAXXDemo...
-jaxxdemo.tree.component.jaxx=JAXX Components
-jaxxdemo.tree.component.jaxx.editor=Editors
-jaxxdemo.tree.component.jaxx.tree.navigation=Navigation trees
-jaxxdemo.tree.component.swing=Swing Components
-jaxxdemo.tree.component.swing.buttons=Buttons
-jaxxdemo.tree.component.swing.form=Form elements
-jaxxdemo.tree.component.swing.form.text=Text
-jaxxdemo.tree.component.swing.layout=Layouts
-jaxxdemo.tree.component.swing.menu=Menus
-jaxxdemo.tree.component.swing.window=windows
-jaxxdemo.tree.feature=Features
-jaxxdemo.tree.features.databinding=Data Binding
-jaxxdemo.tree.features.validation=Validation
-jaxxdemo.tree.fun=Fun
-jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java.
-jaxxdemo.warning.no.ui=No ui environnement detected
-model0.f0=
-model0.f1=
-model0.file...=
-model0.isF0()=
-model0.isF0()\ &&\ model0.isF1()=
-model0.isF0()\ ||\ model0.isF1()=
-model0.isF1()=
-model1.f0=
-model1.f1=
-model1.file...=
-model1.isF0()=
-model1.isF0()\ &&\ model1.isF1()=
-model1.isF0()\ ||\ model1.isF1()=
-model1.isF1()=
-movies=Movies
-t0.isSelected()=
-t0.isSelected()\ &&\ t1.isSelected()=
-t0.isSelected()\ ||\ t1.isSelected()=
-t1.isSelected()=
-valid=
-x=
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -1,234 +0,0 @@
--=-
-.=.
-0=0
-1=1
-10=10
-12=12
-14=14
-18=18
-2=2
-24=24
-3=3
-4=4
-5=5
-6=6
-7=7
-8=8
-9=9
-Age\:=Age \:
-Animal=Animal
-Blue=Bleu
-Blue\:=bleu \:
-Bold=En gras
-Button\ label\:=Libell\u00E9 de l'action
-C=C
-CE=CE
-Cancel=Annuler
-Comments\:=Commentaire
-Config\ file\ \:=Fichier de configuration
-Config\ file\:=Fichier de configuration \:
-Cyan=Bleu cyan
-Dec\ (-)=
-Demo=Demonstration
-Directory\ file\:=
-Editable=Editable
-Email\ Address\:=Courriel
-Email\:=Courriel
-Enabled=Activ\u00E9
-EnumEditor\ (country)\ \:=Editeur de pays
-EnumEditor\ (language)\ \:=Editeur de langue
-Fancy\ Button=Bouton 'Fancy'
-First\ Name\:=Pr\u00E9nom
-FirstName\:=Pr\u00E9nom \:
-Font\ size=Taille de la police
-Font\ size\:\ =
-Fool\ me\ once=
-Fool\ me\ twice=
-Green=Vert
-Green\:=Vert \:
-Greet=
-Help=
-Inc\ (+)=Incr\u00E9menter (+)
-Italic=Italique
-JAXX\ Demo=
-JMenu\ demo=
-Label\ 1=
-Label\ 2=
-Last\ Name\:=Nom \:
-LastName\:=Nom
-Locale\ editor\:=Editeur de locale
-Message\ Box=
-Mineral=
-Normal\ text\:=
-OK=
-Orange=
-Password\:=Mot de passe
-Purple=Pourpre
-Ratio\:=
-Red=Rouge
-Red\:=rouge \:
-Reset=Reinitialiser
-Show\ Background=Voir le fond
-Show\ password\ dialog=Voir l'\u00E9diteur de mot de passe
-Sign\ on=Signer
-Simple\ Button=Bouton simple
-Size\:=Taille \:
-Sources=Sources
-Spacing\:=Espacement \:
-Start=D\u00E9marrer
-Stop=Arr\u00EAter
-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
-Username\:=Utilisateur \:
-Vegetable=L\u00E9gumes
-View=Vue
-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
-adjust\ the\ spacing=
-between\ these\ lines=
-button\ A=Bouton A
-button\ B=Bouton B
-button\ C\ (full\ block)=Bouton C (blocage compl\u00EAt)
-button\ D\ (full\ block\ 2)=Bouton D (blocage compl\u00EAt)
-cancel=Annuler
-close=Fermer
-close2=Fermer 2
-close3=Fermer 3
-demo.action.reload.application=Redemarrer l'application
-demo.action.reload.ui=Recharger l'interface graphique
-edit=Editer
-edit2=Editer 2
-edit3=Editer 3
-f0=
-f1=
-file...=
-form.ratio=Form \: ratio
-form.text=Form \: text
-form.text2=Form \: text2
-form2.ratio=Form2 \: ratio
-form2.text=Form2 \: text
-form2.text2=Form2 \: text2
-getModel0().isF0()=
-getModel0().isF0()\ &&\ getModel0().isF1()=
-getModel0().isF0()\ ||\ getModel0().isF1()=
-getModel0().isF1()=
-getModel1().isF0()=
-getModel1().isF0()\ &&\ getModel1().isF1()=
-getModel1().isF0()\ ||\ getModel1().isF1()=
-getModel1().isF1()=
-getT0().isSelected()=
-getT0().isSelected()\ &&\ getT1().isSelected()=
-getT0().isSelected()\ ||\ getT1().isSelected()=
-getT1().isSelected()=
-i18neditor.popup.title=
-isF0()=
-isF0()\ &&\ isF1()=
-isF0()\ ||\ isF1()=
-isF1()=
-jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>.
-jaxxdemo.action.about=A propos
-jaxxdemo.action.about.tip=A propos de JAXX Demo...
-jaxxdemo.action.add=
-jaxxdemo.action.configuration=Configuration
-jaxxdemo.action.configuration.tip=Modifier la configuration
-jaxxdemo.action.exit=Quitter
-jaxxdemo.action.exit.tip=Quitter JAXX Demo
-jaxxdemo.action.fullscreen=Plein \u00E9cran
-jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00E9cran
-jaxxdemo.action.help=Aide
-jaxxdemo.action.help.tip=Affichier l'aide
-jaxxdemo.action.locale.fr=Fran\u00E7ais
-jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00E7ais
-jaxxdemo.action.locale.uk=Anglais
-jaxxdemo.action.locale.uk.tip=Changer la langue en anglais
-jaxxdemo.action.normalscreen=Ecran normal
-jaxxdemo.action.normalscreen.tip=Revenir en mode normal
-jaxxdemo.action.remove=
-jaxxdemo.action.show=
-jaxxdemo.action.site=Site internet
-jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet
-jaxxdemo.config.category.directories=R\u00E9pertoires
-jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'application
-jaxxdemo.config.category.other=Autre
-jaxxdemo.config.category.other.description=Autres options
-jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
-jaxxdemo.config.ui.demo.path=Chemin de la d\u00E9mo par d\u00E9faut
-jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
-jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
-jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
-jaxxdemo.i18neditor.configuration=Configuration
-jaxxdemo.i18neditor.popupBorderText=Titre de la popup
-jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
-jaxxdemo.i18neditor.showIcon=Afficher les icones
-jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup
-jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup
-jaxxdemo.i18neditor.showText=Afficher le text
-jaxxdemo.init.closed=JAXX Demo a \u00E9t\u00E9 ferm\u00E9 \u00E0 %1$s
-jaxxdemo.init.context.done=Initialisation du contexte termin\u00E9e en %1$s.
-jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00E9e.
-jaxxdemo.menu.file=Fichier
-jaxxdemo.menu.file.locale=Langues
-jaxxdemo.menu.help=Aide
-jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e.
-jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s)
-jaxxdemo.navigation.actor.title=
-jaxxdemo.navigation.actors.title=
-jaxxdemo.navigation.movie.title=
-jaxxdemo.navigation.movies.title=
-jaxxdemo.numbereditor.autoPopup=Affichage automatique popup
-jaxxdemo.numbereditor.configuration=Configuration
-jaxxdemo.numbereditor.model=R\u00E9sultat
-jaxxdemo.numbereditor.model.float=Valeur d\u00E9cimale \: %1$s
-jaxxdemo.numbereditor.model.int=Valeur enti\u00E8re \: %1$s
-jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup
-jaxxdemo.numbereditor.showReset=Afficher le boutton de reset
-jaxxdemo.numbereditor.useFloat=Utiliser les d\u00E9cimales
-jaxxdemo.numbereditor.useSign=Utiliser le signe
-jaxxdemo.title.about=A propos de JAXX Demo...
-jaxxdemo.tree.component.jaxx=Composants JAXX
-jaxxdemo.tree.component.jaxx.editor=Editeurs
-jaxxdemo.tree.component.jaxx.tree.navigation=Arbre de navigation
-jaxxdemo.tree.component.swing=Composants Swing
-jaxxdemo.tree.component.swing.buttons=Boutons
-jaxxdemo.tree.component.swing.form=Elements de formulaire
-jaxxdemo.tree.component.swing.form.text=Texte
-jaxxdemo.tree.component.swing.layout=Layouts
-jaxxdemo.tree.component.swing.menu=Menus
-jaxxdemo.tree.component.swing.window=Fen\u00EAtres
-jaxxdemo.tree.feature=Fonctionnalit\u00E9s
-jaxxdemo.tree.features.databinding=Data binding
-jaxxdemo.tree.features.validation=Validation
-jaxxdemo.tree.fun=Fun
-jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java.
-jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9
-model0.f0=
-model0.f1=
-model0.file...=
-model0.isF0()=
-model0.isF0()\ &&\ model0.isF1()=
-model0.isF0()\ ||\ model0.isF1()=
-model0.isF1()=
-model1.f0=
-model1.f1=
-model1.file...=
-model1.isF0()=
-model1.isF0()\ &&\ model1.isF1()=
-model1.isF0()\ ||\ model1.isF1()=
-model1.isF1()=
-movies=Films
-t0.isSelected()=
-t0.isSelected()\ &&\ t1.isSelected()=
-t0.isSelected()\ ||\ t1.isSelected()=
-t1.isSelected()=
-valid=valide
-x=x
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -23,7 +23,6 @@
config.detected.callBack=Detected actions
config.error.category.already.exists=category with name '%1$s' does already exist\!
config.error.category.not.found=category with name '%1$s' does not exist\!
-config.final.callBack=Action to perform
config.key=Key
config.key.tip=Key of the option
config.launch.callBack=Perform
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 01:18:46 UTC (rev 1730)
@@ -23,7 +23,6 @@
config.detected.callBack=Actions d\u00E9tect\u00E9es pour les options modifi\u00E9es
config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
-config.final.callBack=Action \u00E0 executer
config.key=Clef
config.key.tip=Clef de l'option
config.launch.callBack=Lancer
1
0
r1729 - in trunk: jaxx-demo/src/main/java/jaxx/demo jaxx-demo/src/main/resources/i18n jaxx-demo/src/main/resources/icons jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model jaxx-widgets/src/main/resources/i18n
by tchemit@users.nuiton.org 01 Feb '10
by tchemit@users.nuiton.org 01 Feb '10
01 Feb '10
Author: tchemit
Date: 2010-02-01 01:12:27 +0100 (Mon, 01 Feb 2010)
New Revision: 1729
Added:
trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Log:
Evolution #297: Improve ConfigUI with a CallBackManager
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -63,26 +63,27 @@
public static final String PROPERTY_ADJUSTING = "adjusting";
/**
- * un drapeau pour bloquer la sauvegarde lors de la modification en masse des options
- * via les setter.
+ * un drapeau pour bloquer la sauvegarde lors de la modification en
+ * masse des options via les setter.
*/
protected boolean adjusting;
- protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
+ protected final PropertyChangeListener saveAction =
+ new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (adjusting) {
- if (log.isDebugEnabled()) {
- log.debug("skip save while adjusting");
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (adjusting) {
+ if (log.isDebugEnabled()) {
+ log.debug("skip save while adjusting");
+ }
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration at " + new Date());
+ }
+ saveForUser();
}
- return;
- }
- if (log.isDebugEnabled()) {
- log.debug("Saving configuration at " + new Date());
- }
- saveForUser();
- }
- };
+ };
public DemoConfig() {
@@ -90,7 +91,8 @@
// chargement de la configuration interne
- InputStream stream = getClass().getResourceAsStream(APPLICATION_PROPERTIES);
+ InputStream stream = getClass().getResourceAsStream(
+ APPLICATION_PROPERTIES);
Properties p = new Properties();
try {
@@ -112,7 +114,8 @@
}
// on supprime le stamp de snapshot s'il existe
- String sVersion = VersionUtil.removeSnapshot(getOption("application.version"));
+ String sVersion = VersionUtil.removeSnapshot(
+ getOption("application.version"));
Version version = VersionUtil.valueOf(sVersion);
setDefaultOption("version", version.getVersion());
@@ -210,11 +213,17 @@
}
public static final String[] DEFAULT_JAXX_PCS = {
- PROPERTY_FULLSCREEN, PROPERTY_LOCALE, PROPERTY_FONT_SIZE, PROPERTY_ADJUSTING
+ PROPERTY_FULLSCREEN,
+ PROPERTY_LOCALE,
+ PROPERTY_FONT_SIZE,
+ PROPERTY_ADJUSTING
};
public void removeJaxxPropertyChangeListener() {
- PropertyChangeListener[] toRemove = JAXXUtil.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners());
+ PropertyChangeListener[] toRemove;
+ toRemove = JAXXUtil.findJaxxPropertyChangeListener(
+ DEFAULT_JAXX_PCS,
+ getPropertyChangeListeners());
if (toRemove == null || toRemove.length == 0) {
return;
}
@@ -235,11 +244,41 @@
//////////////////////////////////////////////////
public static enum Option implements OptionDef {
- CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
- FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
- LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
- FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false),
- DEMO_PATH("ui.demo.path", _("jaxxdemo.config.ui.demo.path"), "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(), String.class, false, false);
+ CONFIG_FILE(
+ CONFIG_FILE_NAME,
+ _("jaxxdemo.config.configFileName.description"),
+ "jaxxdemo",
+ String.class,
+ true,
+ true),
+ FULL_SCREEN(
+ "ui.fullscreen",
+ _("jaxxdemo.config.ui.fullscreen"),
+ "false",
+ Boolean.class,
+ false,
+ false),
+ LOCALE(
+ "ui." + PROPERTY_LOCALE,
+ _("jaxxdemo.config.ui.locale"),
+ Locale.FRANCE.toString(),
+ Locale.class,
+ false,
+ false),
+ FONT_SIZE(
+ "ui." + PROPERTY_FONT_SIZE,
+ _("jaxxdemo.config.ui.fontSize"),
+ "10f",
+ Float.class,
+ false,
+ false),
+ DEMO_PATH(
+ "ui.demo.path",
+ _("jaxxdemo.config.ui.demo.path"),
+ "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(),
+ String.class,
+ false,
+ true);
public final String key;
public final String description;
public final String defaultValue;
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -22,6 +22,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
import jaxx.runtime.context.DefaultApplicationContext;
import jaxx.runtime.context.JAXXContextEntryDef;
import jaxx.runtime.context.JAXXInitialContext;
@@ -249,6 +250,31 @@
}
}
+ final Runnable reloadUICallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload ui");
+ }
+ DefaultApplicationContext context = RunDemo.get();
+ DemoUI ui = getUI(context);
+ DemoConfig config = ui.getConfig();
+ reloadUI(context, config);
+ }
+ };
+
+ final Runnable reloadApplicationCallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload appplication");
+ }
+ close(RunDemo.get());
+ }
+ };
+
public void showConfig(JAXXContext context) {
DemoUI ui = getUI(context);
final DemoConfig config = ui.getConfig();
@@ -257,19 +283,16 @@
builder.createModel(config);
- builder.setReloadUICallback(new Runnable() {
- @Override
- public void run() {
- if (log.isInfoEnabled()) {
- log.info("will reload ui");
- }
- DefaultApplicationContext context = RunDemo.get();
- DemoUI ui = getUI(context);
- DemoConfig config = ui.getConfig();
- reloadUI(context, config);
- }
- });
+ builder.registerCallBack("ui",
+ n_("demo.action.reload.ui"),
+ SwingUtil.createActionIcon("reload-ui"),
+ reloadUICallback);
+
+ builder.registerCallBack("application",
+ n_("demo.action.reload.application"),
+ SwingUtil.createActionIcon("reload-application"),
+ reloadApplicationCallback);
// categorie repertoires
@@ -284,17 +307,21 @@
builder.addOption(DemoConfig.Option.FULL_SCREEN);
builder.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN);
- builder.setOptionNeedReloadUI(true);
+ builder.setOptionCallBack("ui");
builder.addOption(DemoConfig.Option.FONT_SIZE);
builder.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE);
+ builder.setOptionCallBack("application");
builder.addOption(DemoConfig.Option.LOCALE);
builder.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE);
- builder.setOptionNeedReloadUI(true);
+ builder.setOptionCallBack("ui");
ConfigUIModel model = builder.flushModel();
- ConfigUI configUI = ConfigUIBuilder.newConfigUI(context, model, "jaxxdemo.config.category.directories");
+ ConfigUI configUI = ConfigUIBuilder.newConfigUI(
+ context,
+ model,
+ "jaxxdemo.config.category.other");
ConfigUIBuilder.showConfigUI(configUI, ui, false);
}
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -104,6 +104,8 @@
close=Disable
close2=Disable 2
close3=Disable 3
+demo.action.reload.application=Reload application
+demo.action.reload.ui=Reload UI
edit=Edit
edit2=Edit 2
edit3=Edit 3
@@ -160,9 +162,10 @@
jaxxdemo.config.category.other=Others
jaxxdemo.config.category.other.description=Others preferences
jaxxdemo.config.configFileName.description=Configuration file name
-jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=Path of demo to select when starting application
+jaxxdemo.config.ui.fontSize=default font size to use in sources
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
+jaxxdemo.config.ui.locale=Language used in application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Popup title
jaxxdemo.i18neditor.selected.locale=Selected Language
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -104,6 +104,8 @@
close=Fermer
close2=Fermer 2
close3=Fermer 3
+demo.action.reload.application=Redemarrer l'application
+demo.action.reload.ui=Recharger l'interface graphique
edit=Editer
edit2=Editer 2
edit3=Editer 3
@@ -160,9 +162,10 @@
jaxxdemo.config.category.other=Autre
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
-jaxxdemo.config.ui.=
-jaxxdemo.config.ui.demo.path=
+jaxxdemo.config.ui.demo.path=Chemin de la d\u00E9mo par d\u00E9faut
+jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Titre de la popup
jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
Added: trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-demo/src/main/resources/icons/action-reload-application.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-demo/src/main/resources/icons/action-reload-ui.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,47 @@
+<JPanel layout='{new BorderLayout()}'>
+ <script><![CDATA[
+ import jaxx.runtime.swing.editor.config.model.*;
+
+ /**
+ * Init the ui.
+ */
+ public void init() {
+ getHandler().init(this);
+ }
+ ]]>
+ </script>
+
+ <ConfigCallBackUIHandler
+ id='handler'
+ initializer='getContextValue(ConfigCallBackUIHandler.class)'/>
+
+ <JScrollPane constraints='BorderLayout.CENTER'
+ columnHeaderView='{treeHeader}'>
+
+ <JTree id='detectedCallBack'
+ editable='false'
+ rootVisible='false'
+ rowHeight='24'/>
+
+ </JScrollPane>
+
+ <!--JPanel constraints='BorderLayout.SOUTH' layout='{new BorderLayout()}'>
+
+ <JPanel constraints='BorderLayout.CENTER'
+ border='{new TitledBorder(_("config.callBack.description"))}'>
+ <JLabel id='callBackDescription'/>
+ </JPanel-->
+
+ <JButton constraints='BorderLayout.SOUTH'
+ id='go'
+ text='config.launch.callBack'
+ toolTipText='config.launch.callBack.tip'
+ actionIcon='config-quit'
+ onActionPerformed='getHandler().doAction(this)'/>
+ <!--/JPanel-->
+
+ <JPanel id='treeHeader' constraints='BorderLayout.EAST'>
+ <JLabel text='config.detected.callBack'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,167 @@
+package jaxx.runtime.swing.editor.config;
+
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.config.model.CallBackEntry;
+import jaxx.runtime.swing.editor.config.model.OptionModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n._;
+
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import java.awt.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * callBackUI handler
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class ConfigCallBackUIHandler {
+
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(ConfigCallBackUIHandler.class);
+
+ public void init(ConfigCallBackUI ui) {
+
+ // build tree model
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+
+ Map<CallBackEntry, List<OptionModel>> forSaved;
+
+ forSaved = ui.getContextValue(Map.class,
+ ConfigUIBuilder.CALLBACKS_WITH_OPTIONS);
+
+ for (Map.Entry<CallBackEntry, List<OptionModel>> e :
+ forSaved.entrySet()) {
+
+ CallBackEntry callBackEntry = e.getKey();
+ List<OptionModel> options = e.getValue();
+
+ DefaultMutableTreeNode callBackNode;
+ callBackNode = new DefaultMutableTreeNode(callBackEntry, true);
+
+ root.add(callBackNode);
+ for (OptionModel o : options) {
+
+ DefaultMutableTreeNode optionkNode;
+ optionkNode = new DefaultMutableTreeNode(o, false);
+
+ callBackNode.add(optionkNode);
+ }
+ }
+
+ JTree tree = ui.getDetectedCallBack();
+
+ tree.setModel(new DefaultTreeModel(root));
+
+ SwingUtil.expandTree(tree);
+
+ tree.setCellRenderer(new DefaultTreeCellRenderer() {
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus) {
+ if (log.isDebugEnabled()) {
+ log.debug("value = " + value.getClass());
+ }
+ if (value == null) {
+ return super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+ }
+
+ if (!(value instanceof DefaultMutableTreeNode)) {
+ return super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+ }
+
+ DefaultMutableTreeNode n = (DefaultMutableTreeNode) value;
+ value = n.getUserObject();
+
+ if (value instanceof CallBackEntry) {
+ CallBackEntry v = (CallBackEntry) value;
+ if (log.isDebugEnabled()) {
+ log.debug("callBackEntry detected " + v.getName());
+ }
+ value = _(v.getDescription());
+ } else if (value instanceof OptionModel) {
+
+ OptionModel v = (OptionModel) value;
+ if (log.isDebugEnabled()) {
+ log.debug("option detected " + v.getKey());
+ }
+ value = v.getKey() + " (" + _(v.getDescription()) + ")";
+ }
+
+ JLabel rendererComponent;
+ rendererComponent = (JLabel)
+ super.getTreeCellRendererComponent(
+ tree,
+ value,
+ sel,
+ expanded,
+ leaf,
+ row,
+ hasFocus);
+
+ value = n.getUserObject();
+
+ if (value instanceof CallBackEntry) {
+
+ CallBackEntry v = (CallBackEntry) value;
+ rendererComponent.setIcon(v.getIcon());
+ }
+ return rendererComponent;
+ }
+ });
+ }
+
+ public void doAction(final ConfigCallBackUI ui) {
+ log.info("Launch callBacks...");
+ Window parent = ui.getContextValue(Window.class, "parent");
+ if (parent != null) {
+ log.info("dispose parent window...");
+ parent.dispose();
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ List<CallBackEntry> callBacks;
+ callBacks = ui.getContextValue(
+ List.class,
+ ConfigUIBuilder.CALLBACKS);
+ for (CallBackEntry e : callBacks) {
+ if (log.isInfoEnabled()) {
+ log.info("launch callBack " + _(e.getDescription()));
+ }
+ e.getAction().run();
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCallBackUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -1,26 +1,3 @@
-<!--
-
-/**
- * *##% jaxx-runtime-swing-widget
- * 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>. ##%*
- */
-
--->
-
<JPanel layout='{new BorderLayout()}'>
<style source='ConfigCategoryUI.css'/>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx 2010-02-01 00:12:27 UTC (rev 1729)
@@ -1,26 +1,3 @@
-<!--
-
-/**
- * *##% jaxx-runtime-swing-widget
- * 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>. ##%*
- */
-
--->
-
<JPanel layout='{new BorderLayout()}'>
<style source='ConfigUI.css'/>
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -23,6 +23,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.context.JAXXInitialContext;
+import jaxx.runtime.swing.editor.config.model.CallBackEntry;
import jaxx.runtime.swing.editor.config.model.CategoryModel;
import jaxx.runtime.swing.editor.config.model.ConfigUIModel;
import jaxx.runtime.swing.editor.config.model.OptionModel;
@@ -36,8 +37,8 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
/**
* La classe pour construire l'ui
@@ -47,6 +48,8 @@
public class ConfigUIBuilder {
public static final Log log = LogFactory.getLog(ConfigUIBuilder.class);
+ public static final String CALLBACKS_WITH_OPTIONS = "callbacksWithOptions";
+ public static final String CALLBACKS = "callbacks";
/**
* Construire l'ui de configuration (sous forme de panel)
@@ -56,14 +59,17 @@
* @param defaultCategory la categorie a selectionner
* @return l'ui instanciate
*/
- public static ConfigUI newConfigUI(JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) {
+ public static ConfigUI newConfigUI(JAXXContext parentContext,
+ final ConfigUIModel model,
+ String defaultCategory) {
JAXXContext tx = new JAXXInitialContext().add(parentContext).add(model);
final ConfigUI ui = new ConfigUI(tx);
JButton quitButton = ui.getQuit();
// prepare quit action
- Action quitAction = new AbstractAction(quitButton.getText(), quitButton.getIcon()) {
+ Action quitAction = new AbstractAction(quitButton.getText(),
+ quitButton.getIcon()) {
private static final long serialVersionUID = 1L;
@@ -73,119 +79,57 @@
return;
}
- boolean needReloadUI = false;
- boolean needReloadApplication = false;
+ final Window parentWindow = ui.getParentContainer(Window.class);
- StringBuilder reloadUIBuffer = new StringBuilder();
+ if (!model.isSaved() || model.isStandalone()) {
- StringBuilder reloadApplicationBuffer = new StringBuilder();
+ // just quit, no callBack can be apply here
- if (model.isSaved() && !model.isStandalone()) {
+ // close the configu ui
+ parentWindow.dispose();
+ return;
+ }
+ Map<CallBackEntry, List<OptionModel>> forSaved;
+ forSaved = model.getCallBacksForSaved();
- StringBuilder buffer = new StringBuilder();
+ if (forSaved.isEmpty()) {
+ // just quit, no callBack to call
- // on doit verifier si des options sauvees necessite
- // un redemarrage de l'application
- for (CategoryModel cat : model) {
- List<OptionModel> savedOptions = cat.getSavedOptions();
- List<OptionModel> needReloadUIOptions = new ArrayList<OptionModel>();
- List<OptionModel> needReloadApplicationOptions = new ArrayList<OptionModel>();
- if (!savedOptions.isEmpty()) {
- Iterator<OptionModel> itr = savedOptions.iterator();
- buffer.append("\n").append(_("config.category.saved", _(cat.getCategory()))).append("\n");
- while (itr.hasNext()) {
- OptionModel option = itr.next();
- buffer.append("\n- ").append(option.getKey());
- if (option.isNeedReloadApplication()) {
- needReloadApplication = true;
- needReloadApplicationOptions.add(option);
- continue;
- }
- if (option.isNeedReloadUI()) {
- needReloadUI = true;
- needReloadUIOptions.add(option);
- continue;
- }
- itr.remove();
-
- }
- if (!savedOptions.isEmpty()) {
-
- if (!needReloadApplicationOptions.isEmpty()) {
- reloadApplicationBuffer.append("\n");
- reloadApplicationBuffer.append(_("config.category.needReloadApplication", _(cat.getCategory())));
- reloadApplicationBuffer.append("\n");
- // second pass to obtain needReloadUI
- for (OptionModel option : needReloadApplicationOptions) {
- reloadApplicationBuffer.append("\n- ").append(option.getKey());
- }
- }
-
- if (!needReloadUIOptions.isEmpty()) {
- reloadUIBuffer.append("\n");
- reloadUIBuffer.append(_("config.category.needReloadUI", _(cat.getCategory())));
- reloadUIBuffer.append("\n");
- // second pass to obtain needReloadUI
- for (OptionModel option : needReloadUIOptions) {
- reloadUIBuffer.append("\n- ").append(option.getKey());
- }
- }
- }
-
- }
- }
-
- if (log.isInfoEnabled()) {
- log.info("save options :\n" + buffer.toString());
- }
-
- if (needReloadApplication) {
-
- // reloading application implies reloading ui
- needReloadUI = false;
-
- askUser(ui,
- _("config.title.will.reload.application"),
- _("config.model.needReloadApplication") +
- reloadApplicationBuffer.toString(),
- JOptionPane.INFORMATION_MESSAGE,
- new Object[]{_("config.choice.ok")},
- 0);
- }
-
- if (needReloadUI) {
- askUser(ui,
- _("config.title.will.reload.ui"),
- _("config.model.needReloadUI") +
- reloadUIBuffer.toString(),
- JOptionPane.INFORMATION_MESSAGE,
- new Object[]{_("config.choice.ok")},
- 0);
- }
+ // close the configu ui
+ parentWindow.dispose();
+ return;
}
- // close the configu ui
- ui.getParentContainer(Window.class).dispose();
+ forSaved = model.getCallBacksForSaved();
- if (needReloadApplication) {
+ // init callBackUI
- Runnable callback = model.getReloadApplicationCallback();
- if (callback == null) {
- throw new IllegalStateException("No reloadApplicationCallback found in model");
- }
+ ConfigCallBackUI lastUI = new ConfigCallBackUI(
+ new JAXXInitialContext().
+ add("parent", parentWindow).
+ add(ui).
+ add(CALLBACKS_WITH_OPTIONS, forSaved).
+ add(CALLBACKS, new ArrayList<CallBackEntry>(forSaved.keySet())).
+ add(new ConfigCallBackUIHandler())
+ );
- SwingUtilities.invokeLater(callback);
- } else if (needReloadUI) {
+ lastUI.init();
+ ui.setVisible(false);
+ parentWindow.remove(ui);
+ parentWindow.add(lastUI);
+
+ SwingUtilities.invokeLater(new Runnable() {
- Runnable callback = model.getReloadUICallback();
- if (callback == null) {
- throw new IllegalStateException("No reloadUICallback found in model");
+ @Override
+ public void run() {
+ parentWindow.validate();
}
- SwingUtilities.invokeLater(callback);
- }
+ });
+// dialog.pack();
+// SwingUtil.center(parentWindow, lastUI);
-
+// lastUI.setVisible(true);
}
};
String tip = quitButton.getToolTipText();
@@ -196,7 +140,8 @@
for (CategoryModel categoryModel : model) {
String category = categoryModel.getCategory();
String categoryLabel = _(categoryModel.getCategoryLabel());
- ConfigCategoryUI p = new ConfigCategoryUI(new JAXXInitialContext().add(ui).add(categoryModel));
+ ConfigCategoryUI p = new ConfigCategoryUI(new
+ JAXXInitialContext().add(ui).add(categoryModel));
p.getCategoryLabel().setText(categoryLabel);
p.setName(category);
ui.getCategories().addTab(_(category), null, p, categoryLabel);
@@ -205,7 +150,8 @@
model.setCategory(defaultCategory);
int categoryIndex = model.getCategoryIndex(defaultCategory);
if (log.isDebugEnabled()) {
- log.debug("index of default category (" + defaultCategory + ") : " + categoryIndex);
+ log.debug("index of default category (" + defaultCategory + ") : "
+ + categoryIndex);
}
ui.getCategories().setSelectedIndex(categoryIndex);
return ui;
@@ -215,10 +161,14 @@
* Affiche l'ui de configuration dans un boite de dialogue.
*
* @param configUI l'ui de configuration
- * @param ui l'ui parent de la boite de dialogue a afficher (peut etre nulle)
- * @param undecorated un drapeau pour savoir si on affiche les decorations de fenetre
+ * @param ui l'ui parent de la boite de dialogue a afficher
+ * (peut etre nulle)
+ * @param undecorated un drapeau pour savoir si on affiche les decorations
+ * de fenetre
*/
- public static void showConfigUI(final ConfigUI configUI, Frame ui, boolean undecorated) {
+ public static void showConfigUI(final ConfigUI configUI,
+ Frame ui,
+ boolean undecorated) {
JDialog f = new JDialog(ui, true);
f.setTitle(_("config.title"));
f.add(configUI);
@@ -240,7 +190,8 @@
f.setUndecorated(undecorated);
JRootPane rootPane = f.getRootPane();
rootPane.setDefaultButton(configUI.getQuit());
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ KeyStroke.getKeyStroke("ESCAPE"), "quit");
rootPane.getActionMap().put("quit", configUI.getQuit().getAction());
f.pack();
SwingUtil.center(ui, f);
@@ -258,7 +209,9 @@
// get all the invalid options
StringBuilder buffer = new StringBuilder();
- buffer.append(_("config.message.quit.invalid.category", categoryName)).append('\n');
+ buffer.append(_("config.message.quit.invalid.category",
+ categoryName));
+ buffer.append('\n');
for (OptionModel m : categoryModel.getInvalidOptions()) {
buffer.append("\n- ").append(m.getKey());
}
@@ -289,7 +242,8 @@
// category was modified, ask user if wants to save
StringBuilder buffer = new StringBuilder();
- buffer.append(_("config.message.quit.valid.and.modified.category", categoryName)).append('\n');
+ buffer.append(_("config.message.quit.valid.and.modified.category",
+ categoryName)).append('\n');
for (OptionModel m : categoryModel.getModifiedOptions()) {
buffer.append("\n- ").append(m.getKey());
}
@@ -323,7 +277,12 @@
return canContinue;
}
- public static int askUser(ConfigUI parent, String title, String message, int typeMessage, Object[] options, int defaultOption) {
+ public static int askUser(ConfigUI parent,
+ String title,
+ String message,
+ int typeMessage,
+ Object[] options,
+ int defaultOption) {
int response = JOptionPane.showOptionDialog(
parent,
@@ -338,4 +297,159 @@
return response;
}
+
+ /**
+ * // prepare quit action
+ Action quitAction = new AbstractAction(quitButton.getText(),
+ quitButton.getIcon()) {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override public void actionPerformed(ActionEvent e) {
+ if (!canQuitCategory(ui)) {
+ return;
+ }
+
+ boolean needReloadUI = false;
+ boolean needReloadApplication = false;
+
+ StringBuilder reloadUIBuffer = new StringBuilder();
+
+ StringBuilder reloadApplicationBuffer = new StringBuilder();
+
+ if (model.isSaved() && !model.isStandalone()) {
+
+
+ StringBuilder buffer = new StringBuilder();
+
+ // on doit verifier si des options sauvees necessite
+ // un redemarrage de l'application
+ for (CategoryModel cat : model) {
+ List<OptionModel> savedOptions = cat.getSavedOptions();
+ List<OptionModel> needReloadUIOptions = new ArrayList<OptionModel>();
+ List<OptionModel> needReloadApplicationOptions = new ArrayList<OptionModel>();
+ if (!savedOptions.isEmpty()) {
+ Iterator<OptionModel> itr = savedOptions.iterator();
+ buffer.append("\n").append(_("config.category.saved", _(cat.getCategory()))).append("\n");
+ while (itr.hasNext()) {
+ OptionModel option = itr.next();
+ buffer.append("\n- ").append(option.getKey());
+ if (option.isNeedReloadApplication()) {
+ needReloadApplication = true;
+ needReloadApplicationOptions.add(option);
+ continue;
+ }
+ if (option.isNeedReloadUI()) {
+ needReloadUI = true;
+ needReloadUIOptions.add(option);
+ continue;
+ }
+ itr.remove();
+
+ }
+ if (!savedOptions.isEmpty()) {
+
+ if (!needReloadApplicationOptions.isEmpty()) {
+ reloadApplicationBuffer.append("\n");
+ reloadApplicationBuffer.append(_("config.category.needReloadApplication", _(cat.getCategory())));
+ reloadApplicationBuffer.append("\n");
+ // second pass to obtain needReloadUI
+ for (OptionModel option : needReloadApplicationOptions) {
+ reloadApplicationBuffer.append("\n- ").append(option.getKey());
+ }
+ }
+
+ if (!needReloadUIOptions.isEmpty()) {
+ reloadUIBuffer.append("\n");
+ reloadUIBuffer.append(_("config.category.needReloadUI", _(cat.getCategory())));
+ reloadUIBuffer.append("\n");
+ // second pass to obtain needReloadUI
+ for (OptionModel option : needReloadUIOptions) {
+ reloadUIBuffer.append("\n- ").append(option.getKey());
+ }
+ }
+ }
+
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("save options :\n" + buffer.toString());
+ }
+
+ if (needReloadApplication) {
+
+ // reloading application implies reloading ui
+ needReloadUI = false;
+
+ askUser(ui,
+ _("config.title.will.reload.application"),
+ _("config.model.needReloadApplication") +
+ reloadApplicationBuffer.toString(),
+ JOptionPane.INFORMATION_MESSAGE,
+ new Object[]{_("config.choice.ok")},
+ 0);
+ }
+
+ if (needReloadUI) {
+ askUser(ui,
+ _("config.title.will.reload.ui"),
+ _("config.model.needReloadUI") +
+ reloadUIBuffer.toString(),
+ JOptionPane.INFORMATION_MESSAGE,
+ new Object[]{_("config.choice.ok")},
+ 0);
+ }
+ }
+
+ // close the configu ui
+ ui.getParentContainer(Window.class).dispose();
+
+ if (needReloadApplication) {
+
+ Runnable callback = model.getReloadApplicationCallback();
+ if (callback == null) {
+ throw new IllegalStateException(
+ "No reloadApplicationCallback found in model");
+ }
+
+ SwingUtilities.invokeLater(callback);
+ } else if (needReloadUI) {
+
+ Runnable callback = model.getReloadUICallback();
+ if (callback == null) {
+ throw new IllegalStateException(
+ "No reloadUICallback found in model");
+ }
+ SwingUtilities.invokeLater(callback);
+ }
+
+
+ }
+ };
+ String tip = quitButton.getToolTipText();
+ quitButton.setAction(quitAction);
+ quitButton.setToolTipText(tip);
+
+ // build categories tabs
+ for (CategoryModel categoryModel : model) {
+ String category = categoryModel.getCategory();
+ String categoryLabel = _(categoryModel.getCategoryLabel());
+ ConfigCategoryUI p = new ConfigCategoryUI(new
+ JAXXInitialContext().add(ui).add(categoryModel));
+ p.getCategoryLabel().setText(categoryLabel);
+ p.setName(category);
+ ui.getCategories().addTab(_(category), null, p, categoryLabel);
+ }
+
+ model.setCategory(defaultCategory);
+ int categoryIndex = model.getCategoryIndex(defaultCategory);
+ if (log.isDebugEnabled()) {
+ log.debug("index of default category (" + defaultCategory + ") : "
+ + categoryIndex);
+ }
+ ui.getCategories().setSelectedIndex(categoryIndex);
+ return ui;
+ }
+ */
}
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,57 @@
+package jaxx.runtime.swing.editor.config.model;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A call back with his attached options.
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class CallBackEntry {
+
+ protected final String name;
+ protected final String description;
+ protected final Icon icon;
+ protected final Runnable action;
+ protected List<OptionModel> options;
+
+ public CallBackEntry(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ this.description = description;
+ this.icon = icon;
+ options = new ArrayList<OptionModel>();
+ this.name = name;
+ this.action = action;
+ }
+
+ public Runnable getAction() {
+ return action;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Icon getIcon() {
+ return icon;
+ }
+
+ public List<OptionModel> getOptions() {
+ // always send a copy
+ return new ArrayList<OptionModel>(options);
+ }
+
+ protected void addOption(OptionModel option) {
+ options.add(option);
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBackEntry.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -0,0 +1,171 @@
+package jaxx.runtime.swing.editor.config.model;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CallBack manager.
+ *
+ * @author tchemit < chemit(a)codelutin.com >
+ * @since 2.0
+ */
+public class CallBacksManager {
+
+ /**
+ * lists of registred callback.
+ */
+ protected List<CallBackEntry> callbacks;
+
+ public CallBacksManager() {
+ callbacks = new ArrayList<CallBackEntry>();
+ }
+
+ /**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon icon of callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ if (name == null) {
+ throw new NullPointerException("parameter 'name' can not be null");
+ }
+ if (action == null) {
+ throw new NullPointerException("parameter 'action' can not be null");
+ }
+ if (description == null) {
+ throw new NullPointerException("parameter 'description' can " +
+ "not be null");
+ }
+ if (icon == null) {
+ throw new NullPointerException("parameter 'icon' can not be null");
+ }
+ if (getCallBack(name) != null) {
+ throw new IllegalArgumentException("there is already a callback " +
+ "with name '" + name + "'");
+ }
+ callbacks.add(new CallBackEntry(name, description, icon, action));
+ }
+
+ /**
+ * Registers a option into a known callback.
+ *
+ * @param name the name of the callback
+ * @param option the option to register for the given callback
+ */
+ public void registerOption(String name, OptionModel option) {
+ if (name == null) {
+ throw new NullPointerException("parameter 'name' can not be null");
+ }
+ if (option == null) {
+ throw new NullPointerException("parameter 'option' can not be null");
+ }
+ CallBackEntry callback = getCallBack(name);
+ if (callback == null) {
+ throw new IllegalArgumentException("could not find a callback " +
+ "with name '" + name + "'");
+ }
+ callback.addOption(option);
+ }
+
+ /**
+ * Scan a model and grab per callBack the options saved.
+ *
+ * @param model the model to scan
+ * @return the dictionnary of options for each callback to launch
+ */
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ ConfigUIModel model) {
+
+ Map<CallBackEntry, List<OptionModel>> result;
+ result = new LinkedHashMap<CallBackEntry, List<OptionModel>>();
+
+ for (CategoryModel categoryModel : model) {
+ Map<CallBackEntry, List<OptionModel>> callBacks =
+ getCallBacksForSaved(categoryModel);
+ for (Map.Entry<CallBackEntry, List<OptionModel>> entry :
+ callBacks.entrySet()) {
+ CallBackEntry key = entry.getKey();
+ List<OptionModel> value = entry.getValue();
+ if (result.containsKey(key)) {
+ result.get(key).addAll(value);
+ } else {
+ result.put(key, value);
+ }
+ }
+ callBacks.clear();
+ }
+ return result;
+ }
+
+ /**
+ * Scan a category and grab per callBack the options saved.
+ *
+ * @param category the category to scan
+ * @return the dictionnary of options for each callBack to launch
+ */
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ CategoryModel category) {
+
+ Map<CallBackEntry, List<OptionModel>> result;
+ result = new LinkedHashMap<CallBackEntry, List<OptionModel>>();
+
+ for (OptionModel optionModel : category) {
+ if (optionModel.isSaved()) {
+ CallBackEntry callBackEntry = getCallBack(optionModel);
+ if (callBackEntry != null) {
+ List<OptionModel> models = result.get(callBackEntry);
+ if (models == null) {
+ models = new ArrayList<OptionModel>();
+ result.put(callBackEntry, models);
+ }
+ models.add(optionModel);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the first callBack for a given option.
+ *
+ * @param option the option
+ * @return the first callBack (so the most important) on which the given
+ * option is attacjed. (can be null)
+ */
+ protected CallBackEntry getCallBack(OptionModel option) {
+ for (CallBackEntry callback : callbacks) {
+ if (callback.getOptions().contains(option)) {
+ return callback;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Obtain a registred callBack from his name.
+ *
+ * @param name the name of the searched callBack
+ * @return the callBack for the given name (or {@code null} if not found).
+ */
+ protected CallBackEntry getCallBack(String name) {
+ for (CallBackEntry callback : callbacks) {
+ if (callback.getName().equals(name)) {
+ return callback;
+ }
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CallBacksManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -25,6 +25,7 @@
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ApplicationConfig.OptionDef;
+import javax.swing.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.*;
@@ -68,14 +69,20 @@
*/
protected boolean standalone;
/**
+ * Callbacks manager
+ */
+ protected CallBacksManager callBacksManager;
+ /**
* call back when reload ui is necessary
*/
+ @Deprecated
protected Runnable reloadUICallback;
/**
* call back when reload application is necessary
*/
+ @Deprecated
protected Runnable reloadApplicationCallback;
-
+
/**
* suport of modification
*/
@@ -84,20 +91,27 @@
public ConfigUIModel(ApplicationConfig config) {
this.config = config;
this.categories = new LinkedHashMap<String, CategoryModel>();
+ this.callBacksManager = new CallBacksManager();
}
/**
* Ajoute une categorie dans le modele.
*
- * @param category l'id de la categorie (la clef de traduction du nom de la categorie)
- * @param categoryLabel la clef de traduction de la description de la categorie
+ * @param category l'id de la categorie (la clef de traduction du nom
+ * de la categorie)
+ * @param categoryLabel la clef de traduction de la description de
+ * la categorie
* @param keys les options de la categorie
- * @deprecated since 2.0.0 prefer use the {@link #addCategory(CategoryModel)}
+ * @deprecated since 2.0.0 prefer use the
+ * {@link #addCategory(CategoryModel)}
*/
@Deprecated
- public void addCategory(String category, String categoryLabel, OptionDef... keys) {
+ public void addCategory(String category,
+ String categoryLabel,
+ OptionDef... keys) {
if (categories.containsKey(category)) {
- throw new IllegalArgumentException(_("config.error.category.already.exists", category));
+ throw new IllegalArgumentException(
+ _("config.error.category.already.exists", category));
}
OptionModel[] entries = new OptionModel[keys.length];
int index = 0;
@@ -117,7 +131,9 @@
*/
public void addCategory(CategoryModel category) {
if (categories.containsKey(category.getCategory())) {
- throw new IllegalArgumentException(_("config.error.category.already.exists", category.getCategory()));
+ throw new IllegalArgumentException(
+ _("config.error.category.already.exists",
+ category.getCategory()));
}
categories.put(category.getCategory(), category);
}
@@ -129,14 +145,52 @@
*/
public void setCategory(String category) {
if (!categories.containsKey(category)) {
- throw new IllegalArgumentException(_("config.error.category.not.found", category));
+ throw new IllegalArgumentException(
+ _("config.error.category.not.found", category));
}
CategoryModel newCategoryModel = categories.get(category);
setCategoryModel(newCategoryModel);
- newCategoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, false, getCategoryModel().isModified());
- newCategoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, getCategoryModel().isValid());
+ newCategoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME, false,
+ getCategoryModel().isModified());
+ newCategoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME, false,
+ getCategoryModel().isValid());
}
+ /**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon the icon of the callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ callBacksManager.registerCallBack(name, description, icon, action);
+ }
+
+ /**
+ * Registers a option into a known callback.
+ *
+ * @param name the name of the callback
+ * @param option the option to register for the given callback
+ */
+ public void registerOptionCallBack(String name, OptionModel option) {
+ callBacksManager.registerOption(name, option);
+ }
+
+ public Map<CallBackEntry, List<OptionModel>> getCallBacksForSaved(
+ ) {
+ return callBacksManager.getCallBacksForSaved(this);
+ }
+
@Override
public Iterator<CategoryModel> iterator() {
return categories.values().iterator();
@@ -168,10 +222,12 @@
this.standalone = standalone;
}
+ @Deprecated
public Runnable getReloadApplicationCallback() {
return reloadApplicationCallback;
}
+ @Deprecated
public Runnable getReloadUICallback() {
return reloadUICallback;
}
@@ -180,7 +236,8 @@
// compute transients keys (to never be saved)
List<String> transients = new ArrayList<String>();
- //TODO TC-20091222 : will be in ApplicationConfig, for the moment catch in your config it...
+ //TODO TC-20091222 : will be in ApplicationConfig, for the moment
+ // catch in your config it...
// config.setAdjusting(true);
config.setOption("adjusting", "true");
@@ -192,13 +249,19 @@
if (option.getPropertyName() != null) {
// this is a javaBean option
try {
- PropertyUtils.setProperty(config, option.getPropertyName(), value);
+ PropertyUtils.setProperty(config,
+ option.getPropertyName(), value);
} catch (Exception e) {
- throw new RuntimeException("could not set property [" + option.getPropertyName() + "] with value = " + value, e);
+ throw new RuntimeException(
+ "could not set property [" +
+ option.getPropertyName() +
+ "] with value = " + value, e);
}
} else {
- // mutator could have extra code to be done when modify an option
- config.setOption(option.getKey(), value == null ? null : value.toString());
+ // mutator could have extra code to be done when
+ // modify an option
+ config.setOption(option.getKey(), value == null ?
+ null : value.toString());
}
// l'option a été sauvegardée, on la marque
option.setSaved(true);
@@ -210,7 +273,8 @@
}
}
} finally {
- //TODO TC-20091222 : will be in ApplicationConfig, for the moment catch in your config it...
+ //TODO TC-20091222 : will be in ApplicationConfig,
+ // for the moment catch in your config it...
// config.setAdjusting(false);
config.setOption("adjusting", "false");
}
@@ -219,9 +283,14 @@
// save config
config.saveForUser(transients.toArray(new String[transients.size()]));
// notify data has changed
- categoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, categoryModel.isModified(), true);
- categoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, categoryModel.isValid());
- categoryModel.firePropertyChange(CategoryModel.RELOAD_PROPERTY_NAME, false, true);
+ categoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME,
+ categoryModel.isModified(), true);
+ categoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME,
+ false, categoryModel.isValid());
+ categoryModel.firePropertyChange(
+ CategoryModel.RELOAD_PROPERTY_NAME, false, true);
}
public void reset() {
@@ -232,9 +301,14 @@
}
}
// notify data has changed
- categoryModel.firePropertyChange(CategoryModel.MODIFIED_PROPERTY_NAME, categoryModel.isModified(), true);
- categoryModel.firePropertyChange(CategoryModel.VALID_PROPERTY_NAME, false, categoryModel.isValid());
- categoryModel.firePropertyChange(CategoryModel.RELOAD_PROPERTY_NAME, false, true);
+ categoryModel.firePropertyChange(
+ CategoryModel.MODIFIED_PROPERTY_NAME,
+ categoryModel.isModified(), true);
+ categoryModel.firePropertyChange(
+ CategoryModel.VALID_PROPERTY_NAME,
+ false, categoryModel.isValid());
+ categoryModel.firePropertyChange(
+ CategoryModel.RELOAD_PROPERTY_NAME, false, true);
}
public int getCategoryIndex(String category) {
@@ -249,7 +323,9 @@
return -1;
}
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ public void firePropertyChange(String propertyName,
+ Object oldValue,
+ Object newValue) {
pcs.firePropertyChange(propertyName, oldValue, newValue);
}
@@ -257,7 +333,8 @@
pcs.addPropertyChangeListener(listener);
}
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ public void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
pcs.addPropertyChangeListener(propertyName, listener);
}
@@ -265,7 +342,8 @@
pcs.removePropertyChangeListener(listener);
}
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ public void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
pcs.removePropertyChangeListener(propertyName, listener);
}
@@ -273,7 +351,8 @@
return pcs.hasListeners(propertyName);
}
- public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners(
+ String propertyName) {
return pcs.getPropertyChangeListeners(propertyName);
}
@@ -281,10 +360,13 @@
return pcs.getPropertyChangeListeners();
}
- protected void setReloadApplicationCallback(Runnable reloadApplicationCallback) {
+ @Deprecated
+ protected void setReloadApplicationCallback(
+ Runnable reloadApplicationCallback) {
this.reloadApplicationCallback = reloadApplicationCallback;
}
+ @Deprecated
protected void setReloadUICallback(Runnable reloadUICallback) {
this.reloadUICallback = reloadUICallback;
}
@@ -292,4 +374,8 @@
protected ApplicationConfig getConfig() {
return config;
}
+
+ protected CallBacksManager getCallBacksManager() {
+ return callBacksManager;
+ }
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilder.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -4,6 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
/**
@@ -43,7 +44,8 @@
* @throws IllegalStateException if there is already a current model
* @throws NullPointerException if config is {@code null}
*/
- public void createModel(ApplicationConfig config) throws IllegalStateException, NullPointerException {
+ public void createModel(ApplicationConfig config)
+ throws IllegalStateException, NullPointerException {
checkNoCurrent(model, "model");
checkNotNull(config, "createModel", "config");
model = new ConfigUIModel(config);
@@ -58,9 +60,11 @@
* @param callback the call back to set
* @throws IllegalStateException if there is not a current model
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.ConfigUIModel#setReloadApplicationCallback(Runnable)
+ * @see ConfigUIModel#setReloadApplicationCallback(Runnable)
*/
- public void setReloadApplicationCallback(Runnable callback) throws IllegalStateException, NullPointerException {
+ @Deprecated
+ public void setReloadApplicationCallback(Runnable callback)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkNotNull(callback, "setReloadApplicationCallback", "callback");
model.setReloadApplicationCallback(callback);
@@ -72,8 +76,9 @@
* @param callback the call back to set
* @throws IllegalStateException if there is not a current model
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.ConfigUIModel#setReloadUICallback(Runnable)
+ * @see ConfigUIModel#setReloadUICallback(Runnable)
*/
+ @Deprecated
public void setReloadUICallback(Runnable callback) {
checkCurrent(model, "model");
checkNotNull(callback, "setReloadUICallback", "callback");
@@ -83,14 +88,19 @@
/**
* Add a new category, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous category, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous category, then store it to
+ * the model.
*
- * @param categoryName the name of the new category (can not to be {@code null})
- * @param categoryLabel the label of the new category (can not to be {@code null})
- * @throws IllegalStateException if there is not a current model, nor category
+ * @param categoryName the name of the new category
+ * (can not to be {@code null})
+ * @param categoryLabel the label of the new category
+ * (can not to be {@code null})
+ * @throws IllegalStateException if there is not a current model,
+ * nor category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addCategory(String categoryName, String categoryLabel) throws IllegalStateException, NullPointerException {
+ public void addCategory(String categoryName, String categoryLabel)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkNotNull(categoryName, "addCategory", "categoryName");
checkNotNull(categoryLabel, "addCategory", "categoryLabel");
@@ -104,13 +114,16 @@
/**
* Add a new option, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous option, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous option, then store it to
+ * the model.
*
* @param def the def ot the new option
- * @throws IllegalStateException if there is not a current model, nor category
+ * @throws IllegalStateException if there is not a current model,
+ * nor category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addOption(ApplicationConfig.OptionDef def) throws IllegalStateException, NullPointerException {
+ public void addOption(ApplicationConfig.OptionDef def)
+ throws IllegalStateException, NullPointerException {
checkCurrent(model, "model");
checkCurrent(category, "category");
checkNotNull(def, "addOption", "def");
@@ -125,7 +138,8 @@
/**
* Add a new option with a propertyName, and set it as current.
* <p/>
- * <b>Note:</b> As side effets, if a previous option, then store it to the model.
+ * <b>Note:</b> As side effets, if a previous option, then store it to
+ * the model.
* <p/>
* <b>Note:</b> This method is a short-cut for
* {@link #addOption(org.nuiton.util.ApplicationConfig.OptionDef)} then
@@ -133,10 +147,12 @@
*
* @param def the def ot the new option
* @param propertyName the propertyName to set on the option
- * @throws IllegalStateException if there is not a current model, nor category
+ * @throws IllegalStateException if there is not a current model, nor
+ * category
* @throws NullPointerException if any of parameter is {@code null}
*/
- public void addOption(ApplicationConfig.OptionDef def, String propertyName) throws IllegalStateException, NullPointerException {
+ public void addOption(ApplicationConfig.OptionDef def, String propertyName)
+ throws IllegalStateException, NullPointerException {
addOption(def);
checkNotNull(propertyName, "setOptionPropertyName", "propertyName");
option.setPropertyName(propertyName);
@@ -148,9 +164,10 @@
* @param propertyName the propertyName to set in the current option.
* @throws IllegalStateException if there is not a current option set.
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setPropertyName(String)
+ * @see OptionModel#setPropertyName(String)
*/
- public void setOptionPropertyName(String propertyName) throws IllegalStateException, NullPointerException {
+ public void setOptionPropertyName(String propertyName)
+ throws IllegalStateException, NullPointerException {
checkCurrent(option, "option");
checkNotNull(propertyName, "setOptionPropertyName", "propertyName");
option.setPropertyName(propertyName);
@@ -162,22 +179,58 @@
* @param editor the editor to set in the current option.
* @throws IllegalStateException if there is not a current option set.
* @throws NullPointerException if any of parameter is {@code null}
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setEditor(javax.swing.table.TableCellEditor)
+ * @see OptionModel#setEditor(javax.swing.table.TableCellEditor)
*/
- public void setOptionEditor(TableCellEditor editor) throws IllegalStateException, NullPointerException {
+ public void setOptionEditor(TableCellEditor editor)
+ throws IllegalStateException, NullPointerException {
checkCurrent(option, "option");
checkNotNull(editor, "setOptionEditor", "editor");
option.setEditor(editor);
}
/**
+ * Registers a new callback.
+ * <p/>
+ * <b>Note:</b> the order of registred callback is used to determine
+ * the higher priority of callback to launch if required.
+ *
+ * @param name the unique name of a callback
+ * @param description the i18n key to describe the action
+ * @param icon the icon of the callBack (used in ui)
+ * @param action the action of the callback
+ */
+ public void registerCallBack(String name,
+ String description,
+ Icon icon,
+ Runnable action) {
+ checkCurrent(model, "model");
+ checkNotNull(name, "registerCallBack", "name");
+ checkNotNull(description, "registerCallBack", "description");
+ checkNotNull(action, "registerCallBack", "action");
+ model.registerCallBack(name, description, icon, action);
+ }
+
+ /**
+ * Registers the current option into a known callback.
+ *
+ * @param name the name of the callback
+ */
+ public void setOptionCallBack(String name) {
+ checkCurrent(option, "option");
+ checkNotNull(name, "setOptionCallBack", "name");
+ model.registerOptionCallBack(name, option);
+ }
+
+ /**
* Set the needReloadUI flag on the current option.
*
* @param needReload new value to set
* @throws IllegalStateException if there is not a current option set.
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setNeedReloadUI(boolean)
+ * @see OptionModel#setNeedReloadUI(boolean)
*/
- public void setOptionNeedReloadUI(boolean needReload) throws IllegalStateException {
+ @Deprecated
+ public void setOptionNeedReloadUI(boolean needReload)
+ throws IllegalStateException {
checkCurrent(option, "option");
option.setNeedReloadUI(needReload);
}
@@ -187,9 +240,10 @@
*
* @param needReload new value to set
* @throws IllegalStateException if there is not a current option set.
- * @see jaxx.runtime.swing.editor.config.model.OptionModel#setNeedReloadUI(boolean)
+ * @see OptionModel#setNeedReloadUI(boolean)
*/
- public void setOptionNeedReloadApplication(boolean needReload) throws IllegalStateException {
+ public void setOptionNeedReloadApplication(boolean needReload)
+ throws IllegalStateException {
checkCurrent(option, "option");
option.setNeedReloadApplication(needReload);
}
@@ -197,7 +251,8 @@
/**
* Flush the model and return it.
* <p/>
- * <b>Note:</b> As a side effect, nothing is available in the builder after this operation.
+ * <b>Note:</b> As a side effect, nothing is available in the builder
+ * after this operation.
* To reuse the builder on a model, use the dedicated setter.
*
* @return the final model
@@ -235,9 +290,11 @@
* <b>Note:</b> As side effets, il will clean current option.
*
* @param categoryModel the category to use
- * @throws IllegalStateException if there is not a current model or a current category
+ * @throws IllegalStateException if there is not a current model or a
+ * current category
*/
- public void setCategory(CategoryModel categoryModel) throws IllegalStateException {
+ public void setCategory(CategoryModel categoryModel)
+ throws IllegalStateException {
checkCurrent(model, "model");
checkNoCurrent(category, "category");
category = categoryModel;
@@ -251,9 +308,11 @@
* Sets the given option as current option.
*
* @param optionModel the option to use
- * @throws IllegalStateException if there is not a current model, nor category, or a current option
+ * @throws IllegalStateException if there is not a current model, nor
+ * category, or a current option
*/
- public void setOption(OptionModel optionModel) throws IllegalStateException {
+ public void setOption(OptionModel optionModel)
+ throws IllegalStateException {
checkCurrent(model, "model");
checkCurrent(category, "category");
checkNoCurrent(option, "option");
@@ -292,13 +351,15 @@
protected void checkNoCurrent(Object o, String type) {
if (o != null) {
- throw new IllegalStateException("there is already a current " + type + "!");
+ throw new IllegalStateException("there is already a current " +
+ type + "!");
}
}
protected void checkNotNull(Object o, String method, String parameter) {
if (o == null) {
- throw new NullPointerException("method " + method + " does not support null parameter " + parameter + "!");
+ throw new NullPointerException("method " + method +
+ " does not support null parameter " + parameter + "!");
}
}
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java 2010-02-01 00:12:27 UTC (rev 1729)
@@ -46,10 +46,12 @@
/**
* un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'ui.
*/
+ @Deprecated
protected boolean needReloadUI = false;
/**
* un drapeau pour savoir si le changement de l'option nécessite un redémarrage de l'application.
*/
+ @Deprecated
protected boolean needReloadApplication = false;
/**
* la valeur non modifié de l'option
@@ -103,10 +105,12 @@
return def.isFinal();
}
+ @Deprecated
public boolean isNeedReloadUI() {
return needReloadUI;
}
+ @Deprecated
public boolean isNeedReloadApplication() {
return needReloadApplication;
}
@@ -160,10 +164,12 @@
this.editor = editor;
}
+ @Deprecated
protected void setNeedReloadUI(boolean needReloadUI) {
this.needReloadUI = needReloadUI;
}
+ @Deprecated
protected void setNeedReloadApplication(boolean needReloadApplication) {
this.needReloadApplication = needReloadApplication;
}
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -20,10 +20,14 @@
config.defaultValue=Default value
config.defaultValue.tip=Default value of the option
config.descrition=Description
+config.detected.callBack=Detected actions
config.error.category.already.exists=category with name '%1$s' does already exist\!
config.error.category.not.found=category with name '%1$s' does not exist\!
+config.final.callBack=Action to perform
config.key=Key
config.key.tip=Key of the option
+config.launch.callBack=Perform
+config.launch.callBack.tip=Perform necessary actions
config.message.quit.invalid.category=The category '%1$s' is not valid\!
config.message.quit.valid.and.modified.category=The category '%1$s' has some modified options \:
config.model.needReloadApplication=
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-01-30 11:46:50 UTC (rev 1728)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2010-02-01 00:12:27 UTC (rev 1729)
@@ -20,10 +20,14 @@
config.defaultValue=Valeur par d\u00E9faut
config.defaultValue.tip=Valeur par d\u00E9faut de l'option
config.descrition=Description
+config.detected.callBack=Actions d\u00E9tect\u00E9es pour les options modifi\u00E9es
config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
+config.final.callBack=Action \u00E0 executer
config.key=Clef
config.key.tip=Clef de l'option
+config.launch.callBack=Lancer
+config.launch.callBack.tip=Lancer les actions n\u00E9cessaires
config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\!
config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \:
config.model.needReloadApplication=Des options ont \u00E9t\u00E9 modifi\u00E9es qui n\u00E9cessitent le red\u00E9marrage de l'application.\n
1
0