Nuiton-utils-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 3157 discussions
[Lutinutil-commits] r1669 - trunk/src/main/java/org/nuiton/util
by echatellier@users.labs.libre-entreprise.org 24 Jul '09
by echatellier@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
Author: echatellier
Date: 2009-07-24 16:50:39 +0200 (Fri, 24 Jul 2009)
New Revision: 1669
Modified:
trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java
Log:
Remove ununed ungeneric code, add comment.
Modified: trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2009-07-24 14:50:12 UTC (rev 1668)
+++ trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2009-07-24 14:50:39 UTC (rev 1669)
@@ -106,7 +106,7 @@
* @deprecated unused same as {@code CategorisedListenerSet(boolean)}
*/
@Deprecated
- public CategorisedListenerSet(Class listenerClass, boolean isClassCategory) {
+ public CategorisedListenerSet(Class<?> listenerClass, boolean isClassCategory) {
this(isClassCategory);
}
1
0
[Lutinutil-commits] r1668 - trunk/src/main/java/org/nuiton/util
by echatellier@users.labs.libre-entreprise.org 24 Jul '09
by echatellier@users.labs.libre-entreprise.org 24 Jul '09
24 Jul '09
Author: echatellier
Date: 2009-07-24 16:50:12 +0200 (Fri, 24 Jul 2009)
New Revision: 1668
Modified:
trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java
trunk/src/main/java/org/nuiton/util/ListenerSet.java
Log:
Remove ununed ungeneric code, add comment.
Modified: trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2009-07-11 12:07:21 UTC (rev 1667)
+++ trunk/src/main/java/org/nuiton/util/CategorisedListenerSet.java 2009-07-24 14:50:12 UTC (rev 1668)
@@ -51,14 +51,16 @@
* leur derniers referencements
* <p/>
* <p> Si les categories sont representees par des Class, alors vous pouvez
- * utiliser la hierachie de classe pour creer de facon automatique les pere
+ * utiliser la hierachie de classe pour creer de facon automatique les peres.
+ *
+ * @param <L> listener type
*
* @see org.nuiton.util.ListenerSet
*/
-public class CategorisedListenerSet<Listener> { // CategorisedListenerSet
+public class CategorisedListenerSet<L> { // CategorisedListenerSet
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(CategorisedListenerSet.class);
+ private static Log log = LogFactory.getLog(CategorisedListenerSet.class);
/**
* permet de remplacer toutes les categories.
@@ -71,26 +73,28 @@
* HashMap de ListenerSet, en cle l'objet qui caracterise la categorie
* en valeur un ListenerSet
*/
- protected WeakHashMap<Object, ListenerSet<Listener>> listeners = new WeakHashMap<Object, ListenerSet<Listener>>();
+ protected WeakHashMap<Object, ListenerSet<L>> listeners = new WeakHashMap<Object, ListenerSet<L>>();
protected WeakHashMap<Object, Object> categoryParent = new WeakHashMap<Object, Object>();
protected boolean isClassCategory = true;
-// protected Class listenerClass = null;
/**
- * Construit un CategorisedListenerSet qui accepte n'importe quel type
- * de listener et dont le isClassCategory est activé
+ * Empty constructor.
*/
public CategorisedListenerSet() {
+
}
+
+ /**
+ * @param isClassCategory si vrai et que les categorie passé en arguement
+ * lors de l'ajout sont de type Class alors lors du fire on recherche aussi
+ * les peres dans la hierarchie d'heritage de la classe (Super class et
+ * interfaces)
+ */
+ public CategorisedListenerSet(boolean isClassCategory) {
+ this();
+ this.isClassCategory = isClassCategory;
+ }
-// /**
-// * Construit un CategorisedListenerSet qui accepte les listeners
-// * dont le type est passé en parametre et dont le isClassCategory est activé
-// */
-// public CategorisedListenerSet(Class listenerClass){
-// this.listenerClass = listenerClass;
-// }
-
/**
* @param listenerClass la classe dont doit heriter les listeners pour
* etre accepté lors de l'ajout
@@ -98,16 +102,18 @@
* lors de l'ajout sont de type Class alors lors du fire on recherche aussi
* les peres dans la hierarchie d'heritage de la classe (Super class et
* interfaces)
+ *
+ * @deprecated unused same as {@code CategorisedListenerSet(boolean)}
*/
+ @Deprecated
public CategorisedListenerSet(Class listenerClass, boolean isClassCategory) {
-// this(listenerClass);
- this.isClassCategory = isClassCategory;
+ this(isClassCategory);
}
-
protected void checkCategory(Object category) {
if (category == ALL) {
- throw new IllegalArgumentException("ALL category can't be use to add listener or add Category");
+ throw new IllegalArgumentException(
+ "ALL category can't be use to add listener or add Category");
}
}
@@ -132,9 +138,9 @@
* @param category la categorie dans lequel il faut ajouter le listener
* @param l le listener a ajouter
*/
- public void add(Object category, Listener l) {
+ public void add(Object category, L l) {
checkCategory(category);
- ListenerSet<Listener> listeners = getListeners(category);
+ ListenerSet<L> listeners = getListeners(category);
listeners.add(l);
}
@@ -145,8 +151,8 @@
* @param category la categorie dans lequel il faut supprimer le listener
* @param l le listener a supprimer
*/
- public void remove(Object category, Listener l) {
- ListenerSet<Listener> listeners = getListeners(category);
+ public void remove(Object category, L l) {
+ ListenerSet<L> listeners = getListeners(category);
listeners.remove(l);
}
@@ -158,21 +164,15 @@
* @param methodName le nom de la méthode de la classe listener
* @param event l'objet event a passer en paramètre de la methode du
* listener
+ * @throws Exception if event can't be fired
*/
public void fire(Object category, String methodName, Object event)
throws Exception {
- if (log != null && log.isTraceEnabled()) {
+ if (log.isTraceEnabled()) {
log.trace("fire category: " + category + " method: " + methodName);
}
- ListenerSet<Listener> ls = getAllListeners(category);
+ ListenerSet<L> ls = getAllListeners(category);
ls.fire(methodName, event);
-/* for(Iterator i=iterator(category); i.hasNext();){
- Object o = i.next();
- Log.logDevFinest("org.nuiton.util.CategorisedListenerSet.fire", "fire on: " + o);
- Statement stm = new Statement(o, methodName, new Object[]{event});
- stm.execute();
- }
-*/
}
/**
@@ -182,9 +182,11 @@
*
* @param category la categorie a partir duquel il faut lancer l'evenement
* @param methodName le nom de la méthode de la classe listener
+ *
+ * @throws Exception if event can't be fired
*/
public void fire(Object category, String methodName) throws Exception {
- for (Listener l : getAllListeners(category)) {
+ for (L l : getAllListeners(category)) {
Statement stm = new Statement(l, methodName, null);
stm.execute();
}
@@ -194,8 +196,11 @@
* Retourne un Iterator sur tous les listeners qu'il faut prevenir si on
* souhaite prevenir une certaine categorie. Ceci inclue les ancetre de la
* categorie
+ *
+ * @param category category to get iterator on
+ * @return iterator
*/
- public Iterator<Listener> iterator(Object category) {
+ public Iterator<L> iterator(Object category) {
return getAllListeners(category).iterator();
}
@@ -203,10 +208,10 @@
* Retourne un ListenerSet contenant tous les listeners c'est à dire les
* listener de la categorie demandé mais aussi les listeners des ancetres
*/
- protected ListenerSet<Listener> getAllListeners(Object category) {
- ListenerSet<Listener> result = new ListenerSet<Listener>();
+ protected ListenerSet<L> getAllListeners(Object category) {
+ ListenerSet<L> result = new ListenerSet<L>();
if (category == ALL) {
- for (ListenerSet<Listener> ls : listeners.values()) {
+ for (ListenerSet<L> ls : listeners.values()) {
result.addAll(ls);
}
} else {
@@ -214,24 +219,25 @@
while (parentCategory != null) {
result.addAll(getListeners(parentCategory));
if (isClassCategory && parentCategory instanceof Class) {
- result.addAll(getListenersClass((Class) parentCategory));
+ result.addAll(getListenersClass((Class<?>) parentCategory));
}
parentCategory = categoryParent.get(parentCategory);
}
}
- if (log != null && log.isTraceEnabled()) {
- log.trace("getAllListeners category: " + category + " result: " + result);
+ if (log.isTraceEnabled()) {
+ log.trace("getAllListeners category: " + category + " result: "
+ + result);
}
return result;
}
- protected ListenerSet<Listener> getListenersClass(Class category) {
- ListenerSet<Listener> result = new ListenerSet<Listener>();
- Class superClass = category.getSuperclass();
+ protected ListenerSet<L> getListenersClass(Class<?> category) {
+ ListenerSet<L> result = new ListenerSet<L>();
+ Class<?> superClass = category.getSuperclass();
if (superClass != null) {
result.addAll(getAllListeners(superClass));
}
- for (Class c : category.getInterfaces()) {
+ for (Class<?> c : category.getInterfaces()) {
result.addAll(getAllListeners(c));
}
return result;
@@ -241,19 +247,21 @@
* Retourne un ListenerSet contenant seulement les listener de la categorie
* demandé. Si la categorie n'existe pas alors elle est créé.
*/
- protected ListenerSet<Listener> getListeners(Object category) {
- ListenerSet<Listener> result = listeners.get(category);
+ protected ListenerSet<L> getListeners(Object category) {
+ ListenerSet<L> result = listeners.get(category);
if (result == null) {
- listeners.put(category, result = new ListenerSet<Listener>());
+ listeners.put(category, result = new ListenerSet<L>());
}
if (log != null && log.isTraceEnabled()) {
- log.trace("getListeners category: " + category + " result: " + result);
+ log.trace("getListeners category: " + category + " result: "
+ + result);
}
return result;
}
public String toString() {
- return "Listeners Category: " + categoryParent + "\nListener: " + listeners;
+ return "Listeners Category: " + categoryParent + "\nListener: "
+ + listeners;
}
} // CategorisedListenerSet
Modified: trunk/src/main/java/org/nuiton/util/ListenerSet.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/ListenerSet.java 2009-07-11 12:07:21 UTC (rev 1667)
+++ trunk/src/main/java/org/nuiton/util/ListenerSet.java 2009-07-24 14:50:12 UTC (rev 1668)
@@ -62,30 +62,16 @@
* Cette deuxième façon de faire est plus sûr car elle n'utilise pas
* l'introspection et donc une vérification est faite sur le nom de la méthode
* à appeler à la compilation, mais elle est plus verbeuse à écrire.
+ *
+ * @param <L> listeners type
*
* @see org.nuiton.util.CategorisedListenerSet
*/
-public class ListenerSet<Listener> implements Iterable<Listener> { // ListenerSet
+public class ListenerSet<L> implements Iterable<L> { // ListenerSet
- /** DOCUMENTME Description of the Field DOCUMENTME Description of the Field DOCUMENTME Description of the Field */
-// protected Class<T> listenerClass = null;
- /** DOCUMENTME Description of the Field */
- protected HashSet<Reference<Listener>> listeners = new HashSet<Reference<Listener>>();
+ /** Listeners reference set. */
+ protected HashSet<Reference<L>> listeners = new HashSet<Reference<L>>();
- /** DOCUMENTME Constructor for the ListenerSet object */
- public ListenerSet() {
- }
-
-// /**
-// * Constructeur permettant de passer une classe que devra s'attisfaire les
-// * listener que l'on souhaite ajouter
-// *
-// * @param listenerClass DOCUMENTME Description of the Parameter
-// */
-// public ListenerSet(Class<T> listenerClass) {
-// this.listenerClass = listenerClass;
-// }
-
public int size() {
return listeners.size();
}
@@ -97,18 +83,13 @@
* si l'objet n'est pas du type passé en argument du constructeur
* une IllegalArgumentException est levée.
*/
- public void add(Listener l) {
+ public void add(L l) {
if (l == null) {
return;
}
-// if (listenerClass == null || listenerClass.isInstance(l)) {
- TransparenteWeakReference<Listener> ref = new TransparenteWeakReference<Listener>(l);
+
+ TransparenteWeakReference<L> ref = new TransparenteWeakReference<L>(l);
listeners.add(ref);
-// } else {
-// throw new IllegalArgumentException("Listener object ("
-// + l.getClass().getName() + ") is not compatible with class: "
-// + listenerClass.getName());
-// }
}
/**
@@ -116,15 +97,8 @@
*
* @param ls The feature to be added to the All attribute
*/
- public void addAll(ListenerSet<Listener> ls) {
-// if (listenerClass == null || (ls.listenerClass != null &&
-// listenerClass.isAssignableFrom(ls.listenDOCUMENTME Description of the ExceptionerClass))) {
+ public void addAll(ListenerSet<L> ls) {
listeners.addAll(ls.listeners);
-// } else {
-// throw new IllegalArgumentException("Listener object ("
-// + ls.listenerClass + ") is not compatible with : "
-// + listenerClass);
-// }
}
/**
@@ -137,55 +111,52 @@
* @throws Exception si un des listeners leve une exception lors de l'appel
*/
public void fire(String methodName, Object event) throws Exception {
- for (Iterator i = iterator(); i.hasNext();) {
- Object o = i.next();
- Statement stm = new Statement(o, methodName, new Object[]{event});
+ for (Iterator<L> i = iterator(); i.hasNext();) {
+ L o = i.next();
+ Statement stm = new Statement(o, methodName, new Object[] { event });
stm.execute();
}
}
/**
- * Appel la méthode du listener sans argument
+ * Appele la méthode du listener sans argument.
+ *
* Cette méthode echoue si la methode ou l'objet contenant la methode a
- * appeler n'est pas public
+ * appeler n'est pas public.
*
* @param methodName le nom de la methode a appeler
* @throws Exception si un des listeners leve une exception lors de l'appel
*/
public void fire(String methodName) throws Exception {
- for (Iterator i = iterator(); i.hasNext();) {
- Object o = i.next();
+ for (Iterator<L> i = iterator(); i.hasNext();) {
+ L o = i.next();
Statement stm = new Statement(o, methodName, null);
stm.execute();
}
}
/**
- * DOCUMENTME Method
+ * Get iterator on listener list.
*
- * @return DOCUMENTME Description of the Return Value
+ * @return iterator on listener list.
*/
- public Iterator<Listener> iterator() {
- return new ReferenceIterator<Listener>(listeners.iterator());
+ public Iterator<L> iterator() {
+ return new ReferenceIterator<L>(listeners.iterator());
}
/**
- * DOCUMENTME Method
+ * Remove listener.
*
- * @param l DOCUMENTME Description of the Parameter
+ * @param l listener to remove
*/
- public void remove(Listener l) {
- TransparenteWeakReference<Listener> ref = new TransparenteWeakReference<Listener>(l);
+ public void remove(L l) {
+ TransparenteWeakReference<L> ref = new TransparenteWeakReference<L>(l);
listeners.remove(ref);
}
- /**
- * DOCUMENTME Method
- *
- * @return DOCUMENTME Description of the Return Value
- */
+ @Override
public String toString() {
- return "" + listeners;
+ return listeners.toString();
}
/** Iterator qui supprime les references vides lors du parcours */
@@ -246,4 +217,3 @@
}
} // ListenerSet
-
1
0
[Lutinutil-commits] r1646 - in trunk/nuiton-i18n-editor/src/main: java/org/nuiton/i18n/editor/project java/org/nuiton/i18n/editor/project/impl java/org/nuiton/i18n/editor/ui java/org/nuiton/i18n/editor/ui/project java/org/nuiton/i18n/editor/ui/project/tabs resources/i18n
by tchemit@users.labs.libre-entreprise.org 23 Jul '09
by tchemit@users.labs.libre-entreprise.org 23 Jul '09
23 Jul '09
Author: tchemit
Date: 2009-07-23 22:14:25 +0200 (Thu, 23 Jul 2009)
New Revision: 1646
Added:
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectConfigurePanelUI.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectConfigurePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectConfigurePanelUI.jaxx
Removed:
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx
Modified:
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties
trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties
Log:
improve package and css
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectConfigurePanelUI.java (from rev 1645, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectConfigurePanelUI.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectConfigurePanelUI.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -0,0 +1,36 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project;
+
+import org.nuiton.i18n.editor.ui.project.*;
+import jaxx.runtime.JAXXObject;
+
+/**
+ * Le contrat a respecter pour configurer un type de projet.
+ *
+ * @author chemit
+ */
+public interface I18nProjectConfigurePanelUI extends JAXXObject {
+
+ /**
+ *
+ * @return l'instance partagee du modele de creation de projet
+ */
+ ProjectUIModel getModel();
+}
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectConfigurePanelUI.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Properties;
import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
-import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
/**
* Le contrat d'un provider du projet.
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectConfigurePanelUI.jaxx (from rev 1645, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectConfigurePanelUI.jaxx (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectConfigurePanelUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -0,0 +1,81 @@
+<!--
+
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
+<Table fill='both' constraints='DirectoryI18nProject.class.getName()'
+ implements='org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI'>
+
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+
+import org.nuiton.i18n.editor.*;
+import org.nuiton.i18n.editor.project.impl.*;
+import org.nuiton.i18n.editor.ui.project.*;
+
+import java.io.File;
+
+protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
+
+@Override
+public ProjectUIModel getModel() {
+ return model;
+}
+
+public void chooseDirectorySource() {
+ File f = model.chooseDirectory(
+ this,
+ _("i18neditor.title.choose.directory.source"),
+ _("i18neditor.action.choose.directory.source.description"),
+ model.getJarSource());
+ model.setDirectorySource(f);
+}
+]]>
+ </script>
+
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.name.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
+ onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.directory.source.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1' fill="both">
+ <JTextField id="directorySourceFile"
+ text='{SwingUtil.getStringValue(model.getDirectorySource()+"")}'
+ onKeyReleased='model.setDirectorySource(new File(((JTextField)event.getSource()).getText()))'/>
+ </cell>
+ <cell anchor="east">
+ <JButton actionIcon="fileChooser"
+ onActionPerformed="chooseDirectorySource()"/>
+ </cell>
+ </row>
+</Table>
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectConfigurePanelUI.jaxx
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -27,9 +27,8 @@
import java.util.Properties;
import java.util.TreeMap;
import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
+import org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI;
import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
-import org.nuiton.i18n.editor.ui.project.tabs.DirectoryI18nProjectConfigurePanelUI;
import org.nuiton.util.ConverterUtil;
/**
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectConfigurePanelUI.jaxx (from rev 1645, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectConfigurePanelUI.jaxx (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectConfigurePanelUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -0,0 +1,93 @@
+<!--
+
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
+<Table fill='both' constraints='JarI18nProject.class.getName()'
+ implements='org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI'>
+
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+
+import org.nuiton.i18n.editor.*;
+import org.nuiton.i18n.editor.project.impl.*;
+import org.nuiton.i18n.editor.ui.project.*;
+
+import java.io.File;
+
+protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
+
+@Override
+public ProjectUIModel getModel() {
+ return model;
+}
+
+public void chooseJarSource() {
+ File f = model.chooseFile (
+ this,
+ _("i18neditor.title.choose.jar.source"),
+ _("i18neditor.action.choose.jar.source"),
+ model.getJarSource(),
+ "^.+\\.jar$",
+ _("i18neditor.action.choose.jar.source.description"));
+ model.setJarSource(f);
+}
+]]>
+ </script>
+
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.name.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
+ onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.jar.source.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1' fill="both">
+ <JTextField id="jarSourceFile"
+ text='{SwingUtil.getStringValue(model.getJarSource()+"")}'
+ onKeyReleased='model.setJarSource(new File(((JTextField)event.getSource()).getText()))'/>
+ </cell>
+ <cell anchor="east">
+ <JButton actionIcon="fileChooser"
+ onActionPerformed="chooseJarSource()"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JCheckBox id='uniqueJarDefinition'
+ text='i18neditor.createproject.uniqueJarDefinition'
+ toolTipText='i18neditor.createproject.uniqueJarDefinition.tip'
+ selected='{model.isUniqueJarDefinition()}'
+ onItemStateChanged='model.setUniqueJarDefinition(event.getStateChange() == ItemEvent.SELECTED)'/>
+ </cell>
+ </row>
+</Table>
+
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectConfigurePanelUI.jaxx
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -31,9 +31,8 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.bundle.I18nBundleFactory;
-import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
+import org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI;
import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
-import org.nuiton.i18n.editor.ui.project.tabs.JarI18nProjectConfigurePanelUI;
import org.nuiton.util.ConverterUtil;
import org.nuiton.util.Resource;
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css 2009-07-23 20:14:25 UTC (rev 1646)
@@ -175,6 +175,13 @@
visible:true;
}
+#showProjectInfo {
+ actionIcon:"information";
+ toolTipText:"i18neditor.project.info.tip";
+ borderPainted:false;
+ rolloverEnabled:false;
+}
+
#closeTab{
actionIcon:"closeTab";
borderPainted:false;
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -227,7 +227,7 @@
<JMenuItem id="menuFileOpenProjectOther"
onActionPerformed="handler.openOtherProject(context)"
_doNotRemove='Boolean.TRUE'/>
- <JMenuItem id="menuFileDeleteProject"
+ <JMenuItem id="menuFileDeleteProject"
onActionPerformed="handler.deleteProject(context)"
_doNotRemove='Boolean.TRUE'/>
<JSeparator/>
@@ -259,6 +259,9 @@
<JButton id='showHelp'/>
<javax.swing.Box.Filler constructorParams='SwingUtil.newMinDimension(), SwingUtil.newMinDimension(), SwingUtil.newMaxXDimension()'/>
+ <JSeparator orientation='vertical'/>
+ <JButton id='showProjectInfo' onActionPerformed='handler.showStorageInfo(context)'/>
+
<jaxx.runtime.swing.editor.I18nEditor id='changeI18n'
opaque='false'
showText='false'
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -553,6 +553,23 @@
about.showInDialog(ui, true);
}
+ public void showStorageInfo(I18nEditorContext context) {
+
+ I18nEditorUI ui = getUI(context);
+
+ String text = null;
+ if (context.getProject() == null) {
+ text = _("i18neditor.message.no.project.loaded");
+ } else {
+ text = context.getProject().toString();
+ }
+ JOptionPane.showMessageDialog(
+ ui,
+ text,
+ _("i18neditor.title.project.info"),
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+
/**
* Méthode pour lancer l'assistant de creation de projet.
*
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java 2009-07-23 20:14:25 UTC (rev 1646)
@@ -1,35 +0,0 @@
-/**
- * *##% Nuiton I18n Editor
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
- */
-package org.nuiton.i18n.editor.ui.project;
-
-import jaxx.runtime.JAXXObject;
-
-/**
- * Le contrat a respecter pour configurer un type de projet.
- *
- * @author chemit
- */
-public interface I18nProjectConfigurePanelUI extends JAXXObject {
-
- /**
- *
- * @return l'instance partagee du modele de creation de projet
- */
- ProjectUIModel getModel();
-}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css 2009-07-23 20:14:25 UTC (rev 1646)
@@ -17,8 +17,8 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
-#storageMain {
- title:"i18neditor.title.change.storage";
+#mainUI {
+ title:"i18neditor.title.create.project";
modal:true;
resizable:false;
defaultCloseOperation:"dispose_on_close";
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -21,7 +21,7 @@
-->
-<JDialog id="storageMain"
+<JDialog id="mainUI"
implements='jaxx.runtime.swing.wizard.WizardUI<ProjectStep, ProjectUIModel>'
width='550' height='560' defaultCloseOperation='dispose_on_close'>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -30,6 +30,7 @@
import org.nuiton.i18n.editor.*;
import org.nuiton.i18n.editor.project.I18nProjectProvider;
import org.nuiton.i18n.editor.project.I18nProjectFactory;
+import org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI;
import org.nuiton.i18n.editor.ui.project.*;
protected String updateContentLayout(I18nProjectProvider<?> projectType) {
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -1,81 +0,0 @@
-<!--
-
-/**
- * *##% Nuiton I18n Editor
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
- */
-
--->
-
-<Table fill='both' constraints='DirectoryI18nProject.class.getName()'
- implements='org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI'>
-
- <script><![CDATA[
-import jaxx.runtime.SwingUtil;
-
-import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.project.impl.*;
-import org.nuiton.i18n.editor.ui.project.*;
-
-import java.io.File;
-
-protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
-
-@Override
-public ProjectUIModel getModel() {
- return model;
-}
-
-public void chooseDirectorySource() {
- File f = model.chooseDirectory(
- this,
- _("i18neditor.title.choose.directory.source"),
- _("i18neditor.action.choose.directory.source.description"),
- model.getJarSource());
- model.setDirectorySource(f);
-}
-]]>
- </script>
-
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.name.label'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
- onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.directory.source.label'/>
- </cell>
- </row>
- <row>
- <cell weightx='1' fill="both">
- <JTextField id="directorySourceFile"
- text='{SwingUtil.getStringValue(model.getDirectorySource()+"")}'
- onKeyReleased='model.setDirectorySource(new File(((JTextField)event.getSource()).getText()))'/>
- </cell>
- <cell anchor="east">
- <JButton actionIcon="fileChooser"
- onActionPerformed="chooseDirectorySource()"/>
- </cell>
- </row>
-</Table>
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx 2009-07-23 20:14:25 UTC (rev 1646)
@@ -1,93 +0,0 @@
-<!--
-
-/**
- * *##% Nuiton I18n Editor
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
- */
-
--->
-
-<Table fill='both' constraints='JarI18nProject.class.getName()'
- implements='org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI'>
-
- <script><![CDATA[
-import jaxx.runtime.SwingUtil;
-
-import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.project.impl.*;
-import org.nuiton.i18n.editor.ui.project.*;
-
-import java.io.File;
-
-protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
-
-@Override
-public ProjectUIModel getModel() {
- return model;
-}
-
-public void chooseJarSource() {
- File f = model.chooseFile (
- this,
- _("i18neditor.title.choose.jar.source"),
- _("i18neditor.action.choose.jar.source"),
- model.getJarSource(),
- "^.+\\.jar$",
- _("i18neditor.action.choose.jar.source.description"));
- model.setJarSource(f);
-}
-]]>
- </script>
-
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.name.label'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
- onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.jar.source.label'/>
- </cell>
- </row>
- <row>
- <cell weightx='1' fill="both">
- <JTextField id="jarSourceFile"
- text='{SwingUtil.getStringValue(model.getJarSource()+"")}'
- onKeyReleased='model.setJarSource(new File(((JTextField)event.getSource()).getText()))'/>
- </cell>
- <cell anchor="east">
- <JButton actionIcon="fileChooser"
- onActionPerformed="chooseJarSource()"/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JCheckBox id='uniqueJarDefinition'
- text='i18neditor.createproject.uniqueJarDefinition'
- toolTipText='i18neditor.createproject.uniqueJarDefinition.tip'
- selected='{model.isUniqueJarDefinition()}'
- onItemStateChanged='model.setUniqueJarDefinition(event.getStateChange() == ItemEvent.SELECTED)'/>
- </cell>
- </row>
-</Table>
-
Modified: trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties 2009-07-23 20:14:25 UTC (rev 1646)
@@ -4,7 +4,7 @@
i18neditor.action.apply=Apply
i18neditor.action.apply.tip=
i18neditor.action.cancel=Cancel
-i18neditor.action.cancel.tip=
+i18neditor.action.cancel.tip=Cancel
i18neditor.action.choose.directory.source.description=
i18neditor.action.choose.jar.source=
i18neditor.action.choose.jar.source.description=
@@ -19,7 +19,7 @@
i18neditor.action.create=Create
i18neditor.action.createProject=Create project
i18neditor.action.delete.key.tip=
-i18neditor.action.deleteProject=
+i18neditor.action.deleteProject=Delete project
i18neditor.action.exit=Exit
i18neditor.action.exit.tip=Quit
i18neditor.action.fullscreen=Full screen
@@ -82,14 +82,12 @@
i18neditor.menu.storeall=Save all
i18neditor.message.config.loaded=Config of nuiton-i18n-editor v %1$s was loaded.
i18neditor.message.help.usage=Help of nuiton-i18n-editor v %1$s
+i18neditor.message.no.project.loaded=< No project loaded >
i18neditor.no.keys=< No defined key >
i18neditor.package.name=Package \: %1$s
+i18neditor.project.info.tip=Click here to display project's informations
i18neditor.project.step.chooseProjectType=
i18neditor.project.step.chooseProjectType.description=
-i18neditor.project.step.configureDirectoryProject=
-i18neditor.project.step.configureDirectoryProject.description=
-i18neditor.project.step.configureJarProject=
-i18neditor.project.step.configureJarProject.description=
i18neditor.project.step.configureProject=
i18neditor.project.step.configureProject.description=
i18neditor.project.step.label=
@@ -104,13 +102,14 @@
i18neditor.project.type.jar=
i18neditor.project.type.jar.description=
i18neditor.resource.name=Resource \: %1$s
-i18neditor.title=
+i18neditor.title=Nuiton i18n editor < Project %1$s >
i18neditor.title.about=About Nuiton i18n editor
-i18neditor.title.change.storage=
i18neditor.title.choose.directory.source=
i18neditor.title.choose.jar.source=
i18neditor.title.choose.project=
i18neditor.title.choose.projectDir=
-i18neditor.title.noproject=
+i18neditor.title.create.project=Create a new project
+i18neditor.title.noproject=Nuiton i18n editor < no project loaded >
+i18neditor.title.project.info=Project's informations
i18neditor.warning.nimbus.landf=Could not find nymbus look and feel, please use at least a 1.6u10 version of sun jre
i18neditor.warning.no.ui=No ui environment detected\!
Modified: trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties 2009-07-22 17:50:16 UTC (rev 1645)
+++ trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties 2009-07-23 20:14:25 UTC (rev 1646)
@@ -41,6 +41,7 @@
i18neditor.action.showHelp.tip=Voir l'aide contextuelle
i18neditor.action.site=Site
i18neditor.action.site.tip=Acc\u00E9der au site du projet
+i18neditor.title.create.project=Cr\u00E9er un nouveau projet
i18neditor.bundle.name=Localisation \: %1$s
i18neditor.choose.project.to.delete=Choisir le projet \u00E0 supprimer
i18neditor.common.descrition=Description
@@ -82,14 +83,12 @@
i18neditor.menu.storeall=Sauvegarder
i18neditor.message.config.loaded=Configuration de nuiton-i18n-editor v. %1$s charg\u00E9e.
i18neditor.message.help.usage=Aide de nuiton-i18n-editor v %1$s
+i18neditor.message.no.project.loaded=< Aucun projet charg\u00E9 >
i18neditor.no.keys=< Aucune clef definie >
i18neditor.package.name=Paquetage \: %1$s
+i18neditor.project.info.tip=Cliquer ici pour obtenir des informations sur le projet charg\u00E9
i18neditor.project.step.chooseProjectType=Type de projet
i18neditor.project.step.chooseProjectType.description=Choisir le type de projet \u00E0 ouvrir
-i18neditor.project.step.configureDirectoryProject=Configuration
-i18neditor.project.step.configureDirectoryProject.description=Configurer le projet de type 'r\u00E9pertoire'
-i18neditor.project.step.configureJarProject=
-i18neditor.project.step.configureJarProject.description=
i18neditor.project.step.configureProject=Configuration
i18neditor.project.step.configureProject.description=Configurer le projet
i18neditor.project.step.label=Etape %1$d/%2$d \: %3$s
@@ -106,11 +105,12 @@
i18neditor.resource.name=Resource \: %1$s
i18neditor.title=Nuiton i18n editor < Projet %1$s >
i18neditor.title.about=A propos de nuiton-i18n-editor...
-i18neditor.title.change.storage=Ouvrir un projet
i18neditor.title.choose.directory.source=Choisir le r\u00E9pertoire
i18neditor.title.choose.jar.source=Choisir un fichier de type 'jar'
i18neditor.title.choose.project=Choisir le fichier de d\u00E9finition d'un projet
i18neditor.title.choose.projectDir=Choisir une d\u00E9finition de projet
+i18neditor.title.create.project=
i18neditor.title.noproject=Nuiton i18n editor < aucun projet charg\u00E9 >
+i18neditor.title.project.info=Informations sur le projet
i18neditor.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.
i18neditor.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9
1
0
[Lutinutil-commits] r1645 - in trunk/nuiton-i18n-editor: . src/main/java/org/nuiton/i18n/editor src/main/java/org/nuiton/i18n/editor/project src/main/java/org/nuiton/i18n/editor/project/impl src/main/java/org/nuiton/i18n/editor/ui src/main/java/org/nuiton/i18n/editor/ui/project src/main/java/org/nuiton/i18n/editor/ui/project/tabs src/main/resources src/main/resources/META-INF src/main/resources/META-INF/services src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 22 Jul '09
by tchemit@users.labs.libre-entreprise.org 22 Jul '09
22 Jul '09
Author: tchemit
Date: 2009-07-22 19:50:16 +0200 (Wed, 22 Jul 2009)
New Revision: 1645
Added:
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProject.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProject.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectFactory.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProject.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProject.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertieNode.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertiesTreeModel.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/TreeModelMode.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/resources/META-INF/
trunk/nuiton-i18n-editor/src/main/resources/META-INF/services/
trunk/nuiton-i18n-editor/src/main/resources/META-INF/services/org.nuiton.i18n.editor.project.I18nProjectProvider
Removed:
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/model/
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectType.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureDirectoryProjectPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureJarProjectPanelUI.jaxx
Modified:
trunk/nuiton-i18n-editor/pom.xml
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditor.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorConfig.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorContext.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectStep.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUIModel.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/SelectBundlesTableModel.java
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.css
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties
trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties
trunk/nuiton-i18n-editor/src/main/resources/log4j.properties
Log:
ca avance
Modified: trunk/nuiton-i18n-editor/pom.xml
===================================================================
--- trunk/nuiton-i18n-editor/pom.xml 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/pom.xml 2009-07-22 17:50:16 UTC (rev 1645)
@@ -73,8 +73,8 @@
<!-- main class in jar -->
<maven.jar.main.class>org.nuiton.i18n.editor.I18nEditor</maven.jar.main.class>
- <jaxx.version>1.7.0-SNAPSHOT</jaxx.version>
- <lutinutil.version>1.1.0-rc-8-SNAPSHOT</lutinutil.version>
+ <jaxx.version>1.7.0</jaxx.version>
+ <lutinutil.version>1.1.0-rc-8</lutinutil.version>
<!-- default license to use -->
<license.licenseName>gpl_v3</license.licenseName>
@@ -175,6 +175,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <silent>true</silent>
+ </configuration>
<executions>
<execution>
<id>copy-dependencies</id>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditor.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditor.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditor.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,9 +1,9 @@
/**
- * *##% Lutin I18n Editor
- * Copyright (C) 2008 CodeLutin
+ * *##% Nuiton I18n Editor
+ * 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
+ * it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
@@ -12,9 +12,9 @@
* 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
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
package org.nuiton.i18n.editor;
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorConfig.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorConfig.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorConfig.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorContext.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorContext.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/I18nEditorContext.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -24,8 +24,8 @@
import jaxx.runtime.JAXXContextEntryDef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.i18n.editor.model.I18nProject;
-import org.nuiton.i18n.editor.model.TreeModelMode;
+import org.nuiton.i18n.editor.project.I18nProject;
+import org.nuiton.i18n.editor.ui.TreeModelMode;
import org.nuiton.i18n.editor.ui.I18nEditorUI;
/**
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProject.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProject.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProject.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,402 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.bundle.I18nBundle;
+import org.nuiton.i18n.bundle.I18nBundleEntry;
+import org.nuiton.i18n.bundle.I18nBundleFactory;
+
+/**
+ *
+ * @author chemit
+ */
+public class AbstractI18nProject implements I18nProject {
+
+ public static final Log log = LogFactory.getLog(AbstractI18nProject.class);
+ public static final Locale[] EMPTY_LOCALE_ARRAY = new Locale[0];
+ public static final String EMPTY_STRING = "";
+ public static final String[] EMPTY_STRING_ARRAY = new String[0];
+ /**
+ * le nom du projet
+ */
+ protected final String name;
+ /**
+ * les urls des fichiers de traduction a charger
+ */
+ protected URL[] urls;
+ /**
+ * les definitions de bundles du projet
+ */
+ protected I18nBundle[] i18nBundles;
+ /**
+ * le fichier où conserver le projet (si null, on ne persiste pas le projet)
+ */
+ protected File storeFile;
+ /**
+ * un drapeau pour savoir si le modele a ete charge
+ */
+ boolean loaded;
+ /**
+ * Les locales selectionnees dans ce projet
+ */
+ protected final List<Locale> selectedBundles;
+ /**
+ * les paquetages selectionnes dans ce projet
+ */
+ protected final List<String> selectedPackages;
+ /**
+ * le dictionnaire des fichiers de traductions charges
+ */
+ protected final Map<String, Properties> resources;
+
+ protected AbstractI18nProject(String name, URL... urls) {
+ this.name = name;
+ this.urls = urls;
+ this.resources = new LinkedHashMap<String, Properties>();
+ this.selectedBundles = new ArrayList<Locale>();
+ this.selectedPackages = new ArrayList<String>();
+ }
+
+ /**
+ * @return le nom du projet
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return les paquetages du projet
+ */
+ @Override
+ public String[] getPackages() {
+ return I18nBundleFactory.getBundleNames(i18nBundles);
+ }
+
+ /**
+ * @return les locales du projet
+ */
+ @Override
+ public Locale[] getBundles() {
+ return I18nBundleFactory.getLocales(i18nBundles);
+ }
+
+ /**
+ * @return les paquetages selectionnes
+ */
+ @Override
+ public List<String> getSelectedPackages() {
+ return selectedPackages;
+ }
+
+ /**
+ * @return les locales selectionnees
+ */
+ @Override
+ public List<Locale> getSelectedBundles() {
+ return selectedBundles;
+ }
+
+ /**
+ * @return les urls du projet
+ */
+ @Override
+ public URL[] getURLs() {
+ return urls;
+ }
+
+ @Override
+ public File getStoreFile() {
+ return storeFile;
+ }
+
+ @Override
+ public void setStoreFile(File storeFile) {
+ this.storeFile = storeFile;
+ }
+
+ /**
+ * @return les clefs de traductions pour les packages selectionnee et les locales selectionnes
+ */
+ @Override
+ public String[] getKeys() {
+ if (!loaded) {
+ return EMPTY_STRING_ARRAY;
+ }
+
+ List<String> paquetages = getSelectedPackages();
+ List<Locale> locales = getSelectedBundles();
+ Set<String> keys = new HashSet<String>();
+
+ for (I18nBundle bundle : i18nBundles) {
+ if (paquetages.contains(bundle.getBundlePrefix())) {
+ for (I18nBundleEntry entry : bundle) {
+ if (!locales.contains(entry.getLocale())) {
+ continue;
+ }
+ Set<Object> keySet = resources.get(entry.getPath().toString()).keySet();
+ for (Object object : keySet) {
+ keys.add(object.toString());
+ }
+ }
+ }
+ }
+ List<String> r = new ArrayList<String>(keys);
+ return r.toArray(new String[r.size()]);
+ }
+
+ /**
+ * Supprime une traduction pour une clef donnee dans une langue et un paquetage donne.
+ *
+ * @param packageName le paquetage ou supprimer la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ */
+ @Override
+ public void deleteKey(String packageName, Locale locale, String key) {
+ checkLoaded();
+ Properties resource = getResource(packageName, locale);
+ if (resource != null) {
+ resource.remove(key);
+ }
+ }
+
+ /**
+ * @param packageName
+ * @param key la clef de traductions
+ * @return les traductions pour les packages, locales et clef selectionnees
+ */
+ @Override
+ public Map<Locale, String> getValues(String packageName, String key) {
+ if (!loaded) {
+ return null;
+ }
+
+ List<String> paquetages = getSelectedPackages();
+
+ if (!paquetages.contains(packageName)) {
+ return null;
+ }
+
+ Map<Locale, String> r = new LinkedHashMap<Locale, String>();
+
+ List<Locale> locales = getSelectedBundles();
+
+ I18nBundle bundle = getI18nBundle(packageName);
+
+ for (I18nBundleEntry entry : bundle) {
+ Locale locale = entry.getLocale();
+ if (!locales.contains(locale)) {
+ continue;
+ }
+ Properties resource = resources.get(entry.getPath().toString());
+ if (resource.containsKey(key)) {
+ r.put(locale, resource.getProperty(key).toString());
+ }
+ }
+ return r;
+ }
+
+ /**
+ * @param key la clef de traductions
+ * @param locale la locale
+ * @param packageName le nom du package
+ * @return les traductions
+ */
+ @Override
+ public String getValue(String packageName, Locale locale, String key) {
+ if (!loaded) {
+ return EMPTY_STRING;
+ }
+ Properties resource = getResource(packageName, locale);
+ if (resource != null) {
+ Object object = resource.get(key);
+ return object.toString();
+ }
+ return null;
+
+ }
+
+ /**
+ * Ajouter une traduction dans le projet.
+ *
+ * @param packageName le paquetage ou ajouter la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ * @param value la traduction
+ */
+ @Override
+ public void addValue(String packageName, Locale locale, String key, String value) {
+ checkLoaded();
+ Properties resource = getResource(packageName, locale);
+ if (resource != null) {
+ resource.put(key, value);
+ }
+ }
+
+ /**
+ * Mettre a jour une traduction dans le projet.
+ *
+ * @param packageName le paquetage ou ajouter la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ * @param value la traduction
+ */
+ @Override
+ public void updateValue(String packageName, Locale locale, String key, String value) {
+ checkLoaded();
+ Properties resource = getResource(packageName, locale);
+ if (resource != null) {
+ resource.put(key, value);
+ }
+ }
+
+ /**
+ * Chargement des traductions du projet.
+ *
+ * @throws IOException
+ */
+ @Override
+ public void load() throws IOException {
+ try {
+ synchronized (this.resources) {
+ resources.clear();
+ selectedBundles.clear();
+ selectedPackages.clear();
+
+ // detections des bundles i18n a partir des urls donnees
+ List<I18nBundle> tmp = I18nBundleFactory.detectBundles(urls);
+ i18nBundles = tmp.toArray(new I18nBundle[tmp.size()]);
+
+ selectedBundles.addAll(Arrays.asList(getBundles()));
+ selectedPackages.addAll(Arrays.asList(getPackages()));
+
+ for (I18nBundle bundle : i18nBundles) {
+ for (I18nBundleEntry entry : bundle) {
+ URL path = entry.getPath();
+ Properties properties = new Properties();
+ entry.load(properties);
+ resources.put(path.toString(), properties);
+ }
+ }
+ }
+ } finally {
+ loaded = true;
+ }
+ }
+
+ /**
+ * Enregistrement des traductions du projet.
+ *
+ * @throws IOException
+ */
+ @Override
+ public void store() throws IOException {
+ checkLoaded();
+ }
+
+ @Override
+ public void storeDefinition() throws IOException {
+ Properties p = new Properties();
+ p.setProperty("name", name);
+ p.setProperty("class", getClass().getName());
+ StringBuilder buffer = new StringBuilder();
+ for (URL u : urls) {
+ buffer.append(',').append(u.toString());
+ }
+ p.setProperty("urls", buffer.substring(1));
+ FileOutputStream stream = null;
+ try {
+ stream = new FileOutputStream(getStoreFile());
+ p.store(stream, "generated by " + getClass().getName());
+ } finally {
+ if (stream != null) {
+ stream.close();
+ }
+ }
+
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ i18nBundles = null;
+ resources.clear();
+ selectedBundles.clear();
+ selectedPackages.clear();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<name: " + name + ">";
+ }
+
+ protected I18nBundle getI18nBundle(String packageName) {
+ if (i18nBundles != null) {
+ for (I18nBundle b : i18nBundles) {
+ if (b.getBundlePrefix().equals(packageName)) {
+ return b;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected I18nBundleEntry getI18nBundleEntry(String packageName, Locale locale) {
+ I18nBundle bundle = getI18nBundle(packageName);
+ if (bundle != null) {
+ for (I18nBundleEntry entry : bundle) {
+ if (locale.equals(entry.getLocale())) {
+ return entry;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Properties getResource(String packageName, Locale locale) {
+ I18nBundleEntry entry = getI18nBundleEntry(packageName, locale);
+ if (entry != null) {
+ Properties resource = resources.get(entry.getPath().toString());
+ return resource;
+ }
+ return null;
+ }
+
+ protected void checkLoaded() throws IllegalStateException {
+ if (!loaded) {
+ throw new IllegalStateException("project was not loaded");
+ }
+ }
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProjectProvider.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/AbstractI18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,97 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.i18n.editor.project;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.nuiton.i18n.I18n;
+
+/**
+ *
+ * @param <P> le type de projet supporte.
+ *
+ * @author chemit
+ */
+public abstract class AbstractI18nProjectProvider<P extends I18nProject> implements I18nProjectProvider<P> {
+
+ public static final String CLASS_PARAMETER = "class";
+ public static final String NAME_PARAMETER = "name";
+ public static final String URLS_PARAMETER = "urls";
+ protected final Class<P> type;
+ protected final String label;
+ protected final String description;
+ protected Map<String, Class<?>> authorizedParameters;
+
+ protected abstract Map<String, Class<?>> initAuthorizedParameters();
+
+ public AbstractI18nProjectProvider(Class<P> type, String label, String description) {
+ this.type = type;
+ this.label = label;
+ this.description = description;
+ }
+
+ @Override
+ public Class<P> getType() {
+ return type;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public String getDescription() {
+ return I18n._(description);
+ }
+
+
+ @Override
+ public Map<String, Class<?>> getAuthorizedParameters() {
+ if (authorizedParameters == null) {
+ this.authorizedParameters = Collections.unmodifiableMap(initAuthorizedParameters());
+ }
+ return authorizedParameters;
+ }
+
+ public <T extends Object> T getParameter(Class<T> returnType, String propertyName, Map<String, Object> parameters) {
+ Map<String, Class<?>> map = getAuthorizedParameters();
+ // check name
+ if (!map.containsKey(propertyName)) {
+ throw new IllegalArgumentException("the property " + propertyName + " is unknown for this project.\nKnown parameters :" + map.keySet());
+ }
+ // check type
+ Class<?> requiredType = map.get(propertyName);
+ if (returnType != requiredType && !returnType.isAssignableFrom(requiredType)) {
+ throw new IllegalArgumentException("the property " + propertyName + " must be of the type " + requiredType + ", but was : " + requiredType);
+ }
+
+ for (Entry<String, Object> e : parameters.entrySet()) {
+ if (propertyName.equals(e.getKey())) {
+ return (T) e.getValue();
+ }
+ }
+ throw new IllegalArgumentException("could not find property " + propertyName + ".\nKnown properties in :\n" + parameters.keySet());
+ }
+}
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProject.java (from rev 1644, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/model/I18nProject.java)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProject.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProject.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,132 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ *
+ * @author chemit
+ */
+public interface I18nProject {
+
+ /**
+ * @return le nom du projet
+ */
+ public String getName();
+
+ /**
+ * @return les paquetages du projet
+ */
+ public String[] getPackages();
+
+ /**
+ * @return les locales du projet
+ */
+ public Locale[] getBundles();
+
+ /**
+ * @return les paquetages selectionnes
+ */
+ public List<String> getSelectedPackages();
+
+ /**
+ * @return les locales selectionnees
+ */
+ public List<Locale> getSelectedBundles();
+
+ /**
+ * @return les urls du projet
+ */
+ public URL[] getURLs();
+
+ public File getStoreFile();
+
+ public void setStoreFile(File storeFile);
+
+ /**
+ * @return les clefs de traductions pour les packages selectionnee et les locales selectionnes
+ */
+ public String[] getKeys();
+
+ /**
+ * Supprime une traduction pour une clef donnee dans une langue et un paquetage donne.
+ *
+ * @param packageName le paquetage ou supprimer la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ */
+ public void deleteKey(String packageName, Locale locale, String key);
+
+ /**
+ * @param packageName
+ * @param key la clef de traductions
+ * @return les traductions pour les packages, locales et clef selectionnees
+ */
+ public Map<Locale, String> getValues(String packageName, String key);
+
+ /**
+ * @param key la clef de traductions
+ * @param locale la locale
+ * @param packageName le nom du package
+ * @return les traductions
+ */
+ public String getValue(String packageName, Locale locale, String key);
+
+ /**
+ * Ajouter une traduction dans le projet.
+ *
+ * @param packageName le paquetage ou ajouter la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ * @param value la traduction
+ */
+ public void addValue(String packageName, Locale locale, String key, String value);
+
+ /**
+ * Mettre a jour une traduction dans le projet.
+ *
+ * @param packageName le paquetage ou ajouter la clef
+ * @param locale la locale de la traduction
+ * @param key la clef de traduction
+ * @param value la traduction
+ */
+ public void updateValue(String packageName, Locale locale, String key, String value);
+
+ /**
+ * Chargement des traductions du projet.
+ *
+ * @throws IOException
+ */
+ public void load() throws IOException;
+
+ /**
+ * Enregistrement des traductions du projet.
+ *
+ * @throws IOException
+ */
+ public void store() throws IOException;
+
+ public void storeDefinition() throws IOException;
+}
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProject.java
___________________________________________________________________
Added: svn:mergeinfo
+
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectFactory.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectFactory.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectFactory.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,177 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
+
+/**
+ * L'usine de projets.
+ *
+ * @author chemit
+ * @see I18nProject
+ * @see I18nProjectProvider
+ */
+public class I18nProjectFactory {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static final Log log = LogFactory.getLog(I18nProjectFactory.class);
+ /** le cache des provideurs de projet. */
+ protected static Set<I18nProjectProvider<?>> providers;
+
+ /**
+ * Creer un projet a partir d'un dictionnaire de parametres.
+ *
+ * @param <P> le type de projet
+ * @param projectClass le type de la classe
+ * @param params le dictionnaire des paramètres pour créer le projet
+ * @return le projet instancie mais non ouvert.
+ */
+ public static <P extends I18nProject> P newProject(Class<P> projectClass, Map<String, Object> params) {
+ I18nProjectProvider<P> provider = getProvider(projectClass);
+ if (provider == null) {
+ throw new IllegalArgumentException("could not provider for " + projectClass);
+ }
+ P result = provider.newProject(params);
+ return result;
+ }
+
+ /**
+ * Creer un projet a partir de l'ui de creation de projet.
+ *
+ * @param <P> le type du projet
+ * @param projectClass le type du projet
+ * @param model le model de l'ui de creation de projet
+ * @return le projet instantie mais non ouvert
+ */
+ public static <P extends I18nProject> P newProject(Class<P> projectClass, ProjectUIModel model) {
+
+ I18nProjectProvider<P> provider = getProvider(projectClass);
+ if (provider == null) {
+ throw new IllegalArgumentException("could not provider for " + projectClass);
+ }
+ P result = provider.newProject(model);
+ return result;
+ }
+
+ /**
+ * Creer un projet a partir d'un fichier de definition de projet.
+ *
+ * @param <P> le type du projet
+ * @param projectFile le fichier contenant la definition du projet
+ * @return le projet instantie mais non ouvert.
+ */
+ public static <P extends I18nProject> P newProject(File projectFile) {
+
+ FileInputStream stream = null;
+ try {
+ Properties p = new Properties();
+ stream = new FileInputStream(projectFile);
+ p.load(stream);
+
+ String tmp = p.getProperty(AbstractI18nProjectProvider.CLASS_PARAMETER);
+ Class<? extends I18nProject> projectClass = (Class<? extends I18nProject>) Class.forName(tmp);
+
+ I18nProjectProvider<P> provider = (I18nProjectProvider<P>) getProvider(projectClass);
+ if (provider == null) {
+ throw new IllegalArgumentException("could not provider for " + projectClass);
+ }
+ // validate definition
+ provider.validateDefinition(p);
+ // instanciate safe project
+ P result = provider.newProject(p);
+ result.setStoreFile(projectFile);
+ return result;
+
+ } catch (Exception ex) {
+ throw new RuntimeException("could not load project for reason " + ex.getMessage(), ex);
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException ex) {
+ throw new RuntimeException("could not close project for reason " + ex.getMessage(), ex);
+ }
+ }
+ }
+
+
+ }
+
+ /**
+ * Recupere l'ensemble des provideurs de projet connus par le systeme.
+ *
+ * Note: pour ajouter de nouveaux types de projet, on utilise la mecanique
+ * de chargement de service de la jdk {@link ServiceLoader}.
+ *
+ * @return l'ensemble des provideurs de projet connus par le systeme.
+ *
+ */
+ public static Set<I18nProjectProvider<?>> getProviders() {
+ if (providers == null) {
+ synchronized (I18nProjectProvider.class) {
+ discoverProviders();
+ }
+ }
+ return providers;
+ }
+
+ /**
+ * Recupere le provideur d'un type de projet donne.
+ *
+ * @param <P> le type de projet
+ * @param projectClass le type de projet
+ * @return le provideur pour le le type de projet donne, ou <code>null</code>
+ * si aucun provideur ne prend en charge ce type de projet.
+ */
+ protected static <P extends I18nProject> I18nProjectProvider<P> getProvider(Class<P> projectClass) {
+
+ for (I18nProjectProvider<?> p : getProviders()) {
+ if (p.getType() == projectClass) {
+ return (I18nProjectProvider<P>) p;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Decouvrer les provideurs de projet via la mecanique {@link ServiceLoader}
+ * de la jdk
+ */
+ protected static void discoverProviders() {
+ if (providers == null) {
+ providers = new HashSet<I18nProjectProvider<?>>();
+ } else {
+ providers.clear();
+ }
+ for (I18nProjectProvider<?> p : ServiceLoader.load(I18nProjectProvider.class)) {
+ log.info("loaded " + p);
+ providers.add(p);
+ }
+ }
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/I18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,120 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
+import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
+
+/**
+ * Le contrat d'un provider du projet.
+ *
+ * @param <P> le type de projet connu par le provider.
+ * @author chemit
+ */
+public interface I18nProjectProvider<P extends I18nProject> {
+
+ /**
+ *
+ * @return le type du projet
+ */
+ Class<P> getType();
+
+ /**
+ *
+ * @return le label du type de projet
+ */
+ String getLabel();
+
+ /**
+ *
+ * @return la description de ce type de projet
+ */
+ String getDescription();
+
+ /**
+ *
+ * @return le dictionnaire des paramètres autorisés pour ce type de projet
+ */
+ Map<String, Class<?>> getAuthorizedParameters();
+
+ /**
+ *
+ * @param params les paramètres pour instancier le projet
+ * @return le projet instancié (mais non chargé?)
+ */
+ P newProject(Map<String, Object> params);
+
+ /**
+ *
+ * @param model le model d'ui
+ * @return le projet instancié (mais non chargé?)
+ */
+ P newProject(ProjectUIModel model);
+
+ /**
+ *
+ * @param properties le model d'ui
+ * @return le projet instancié (mais non chargé?)
+ */
+ P newProject(Properties properties);
+
+ /**
+ * Decouvre et retourne tous les fichiers de traductions disponibles a
+ * partir du modele de cration de projet.
+ *
+ * @param model le modele a utiliser
+ * @return la liste des urls des fichiers de traductions trouves a partir
+ * du modele.
+ * @throws IOException pour toute erreur
+ */
+ List<URL> detectBundles(ProjectUIModel model) throws IOException;
+
+ /**
+ *
+ * @return le type de l'ui pour configurer ce type de projet
+ */
+ Class<? extends I18nProjectConfigurePanelUI> getUIClass();
+
+ /**
+ * Valide dans l'ui de creation de projet la partie specifique a
+ * ce type de projet.
+ *
+ * @param model le model a valider
+ * @return <code>true</code> si la partie specifique a ce type de projet
+ * est valide, <code>false</code> autrement.
+ */
+ boolean validateUIModel(ProjectUIModel model);
+
+ /**
+ * Valide un projet a partir de sa definition contenue dans un fichier de
+ * proprietes.
+ *
+ * Cette methode est appellee avant tout chargement de projet en memoire,
+ * afin de verifier la coherence du projet.
+ *
+ * @param properties les proprietes de la definition du projet
+ * @return <code>true</code> si le projet est valide.
+ */
+ boolean validateDefinition(Properties properties);
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProject.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProject.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProject.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,33 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project.impl;
+
+import org.nuiton.i18n.editor.project.AbstractI18nProject;
+import java.net.URL;
+
+/**
+ *
+ * @author chemit
+ */
+public class DirectoryI18nProject extends AbstractI18nProject {
+
+ public DirectoryI18nProject(String name, URL[] urls) {
+ super(name, urls);
+ }
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/DirectoryI18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,106 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project.impl;
+
+import java.io.IOException;
+import org.nuiton.i18n.editor.project.AbstractI18nProjectProvider;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
+import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
+import org.nuiton.i18n.editor.ui.project.tabs.DirectoryI18nProjectConfigurePanelUI;
+import org.nuiton.util.ConverterUtil;
+
+/**
+ *
+ * @author chemit
+ */
+public class DirectoryI18nProjectProvider extends AbstractI18nProjectProvider<DirectoryI18nProject> {
+
+ public DirectoryI18nProjectProvider() {
+ super(DirectoryI18nProject.class, I18n.n_("i18neditor.project.type.directory"), I18n.n_("i18neditor.project.type.directory.description"));
+ }
+
+ @Override
+ protected Map<String, Class<?>> initAuthorizedParameters() {
+ Map<String, Class<?>> result = new TreeMap<String, Class<?>>();
+ result.put(NAME_PARAMETER, String.class);
+ result.put(URLS_PARAMETER, URL[].class);
+ return result;
+ }
+
+ @Override
+ public DirectoryI18nProject newProject(Map<String, Object> params) {
+ String name = getParameter(String.class, NAME_PARAMETER, params);
+ URL[] urls = getParameter(URL[].class, URLS_PARAMETER, params);
+ return new DirectoryI18nProject(name, urls);
+ }
+
+ @Override
+ public DirectoryI18nProject newProject(ProjectUIModel model) {
+ DirectoryI18nProject p = new DirectoryI18nProject(model.getProjectName(), model.getSelectedBundles().toArray(new URL[model.getSelectedBundles().size()]));
+ if (model.isStoreProject()) {
+ p.setStoreFile(model.getStoreFile());
+ }
+ return p;
+ }
+
+ @Override
+ public DirectoryI18nProject newProject(Properties properties) {
+ Map<String, Object> params = new TreeMap<String, Object>();
+ params.put(NAME_PARAMETER, properties.getProperty(NAME_PARAMETER));
+ String tmp = properties.getProperty(URLS_PARAMETER);
+ String[] urlsStr = tmp.split(",");
+ List<URL> urls = new ArrayList<URL>();
+ for (String u : urlsStr) {
+ URL url = ConverterUtil.convert(URL.class, u);
+ urls.add(url);
+ }
+
+ params.put(URLS_PARAMETER, urls.toArray(new URL[urls.size()]));
+
+ DirectoryI18nProject p = newProject(params);
+ return p;
+ }
+
+ @Override
+ public List<URL> detectBundles(ProjectUIModel model) throws IOException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean validateUIModel(ProjectUIModel model) {
+ return model.getDirectorySource() != null && model.getDirectorySource().exists() && model.getProjectName() != null && !model.getProjectName().isEmpty();
+ }
+
+ @Override
+ public boolean validateDefinition(Properties properties) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Class<? extends I18nProjectConfigurePanelUI> getUIClass() {
+ return DirectoryI18nProjectConfigurePanelUI.class;
+ }
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProject.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProject.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProject.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,35 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project.impl;
+
+import org.nuiton.i18n.editor.project.AbstractI18nProject;
+import java.net.URL;
+
+/**
+ *
+ * @author chemit
+ */
+public class JarI18nProject extends AbstractI18nProject{
+
+ public JarI18nProject(String name, URL[] urls) {
+ super(name, urls);
+ }
+
+
+}
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/project/impl/JarI18nProjectProvider.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,162 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.project.impl;
+
+import java.io.IOException;
+import org.nuiton.i18n.editor.project.AbstractI18nProjectProvider;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.bundle.I18nBundleFactory;
+import org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI;
+import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
+import org.nuiton.i18n.editor.ui.project.tabs.JarI18nProjectConfigurePanelUI;
+import org.nuiton.util.ConverterUtil;
+import org.nuiton.util.Resource;
+
+/**
+ *
+ * @author chemit
+ */
+public class JarI18nProjectProvider extends AbstractI18nProjectProvider<JarI18nProject> {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(JarI18nProjectProvider.class);
+
+ public JarI18nProjectProvider() {
+ super(JarI18nProject.class,
+ I18n.n_("i18neditor.project.type.jar"),
+ I18n.n_("i18neditor.project.type.jar.description"));
+ }
+
+ @Override
+ protected Map<String, Class<?>> initAuthorizedParameters() {
+ Map<String, Class<?>> result = new TreeMap<String, Class<?>>();
+ result.put(NAME_PARAMETER, String.class);
+ result.put(URLS_PARAMETER, URL[].class);
+ return result;
+ }
+
+ @Override
+ public JarI18nProject newProject(Map<String, Object> params) {
+ String name = getParameter(String.class, NAME_PARAMETER, params);
+ URL[] urls = getParameter(URL[].class, URLS_PARAMETER, params);
+ JarI18nProject p = new JarI18nProject(name, urls);
+ return p;
+ }
+
+ @Override
+ public JarI18nProject newProject(ProjectUIModel model) {
+ JarI18nProject p = new JarI18nProject(model.getProjectName(),
+ model.getSelectedBundles().toArray(new URL[model.getSelectedBundles().size()]));
+ if (model.isStoreProject()) {
+ p.setStoreFile(model.getStoreFile());
+ }
+ return p;
+ }
+
+ @Override
+ public JarI18nProject newProject(Properties properties) {
+ Map<String, Object> params = new TreeMap<String, Object>();
+ params.put(NAME_PARAMETER, properties.getProperty(NAME_PARAMETER));
+ String tmp = properties.getProperty(URLS_PARAMETER);
+ String[] urlsStr = tmp.split(",");
+ List<URL> urls = new ArrayList<URL>();
+ for (String u : urlsStr) {
+ URL url = ConverterUtil.convert(URL.class, u);
+ urls.add(url);
+ }
+
+ params.put(URLS_PARAMETER, urls.toArray(new URL[urls.size()]));
+
+ JarI18nProject p = newProject(params);
+ return p;
+ }
+
+ @Override
+ public List<URL> detectBundles(ProjectUIModel model) throws IOException {
+ List<URL> urls = new ArrayList<URL>();
+ URL source = model.getJarSource().toURI().toURL();
+ URLClassLoader loader = new URLClassLoader(new URL[]{source});
+ log.info("jar source : " + source);
+ if (model.isUniqueJarDefinition()) {
+ // on recherche l'unique bundle dans META-INF/
+ List<URL> defs = Resource.getURLs("META-INF/.*-i18n-definition\\.properties", loader);
+ log.info("detected unique bundle definition " + defs);
+ if (!defs.isEmpty()) {
+ // on ne traite que le premier ???
+ URL u = defs.get(0);
+ String path = u.toString();
+ int index = path.lastIndexOf("/");
+ path = path.substring(index + 1);
+ String bundleName = path.substring(0, path.length() - "-i18n-definition.properties".length());
+ log.info("bundleName : " + bundleName);
+ urls = Resource.getURLs("META-INF/" + bundleName + "-.*\\.properties", loader);
+ urls.remove(u);
+ }
+ } else {
+ urls = Resource.getURLs(I18nBundleFactory.SEARCH_BUNDLE_PATTERN, loader);
+ log.info("detected bundles : " + urls);
+ }
+ return urls;
+ }
+
+ @Override
+ public boolean validateUIModel(ProjectUIModel model) {
+ return model.getJarSource() != null && model.getJarSource().exists() && model.getProjectName() != null && !model.getProjectName().isEmpty();
+ }
+
+ @Override
+ public boolean validateDefinition(Properties properties) {
+
+ // verifie que les proprietes sont presentes :
+ if (!properties.containsKey(CLASS_PARAMETER)) {
+ throw new IllegalStateException("could not find property " + CLASS_PARAMETER);
+ }
+ if (!properties.containsKey(NAME_PARAMETER)) {
+ throw new IllegalStateException("could not find property " + NAME_PARAMETER);
+ }
+ if (!properties.containsKey(URLS_PARAMETER)) {
+ throw new IllegalStateException("could not find property " + URLS_PARAMETER);
+ }
+ // verifie que les urls existent
+ String tmp = properties.getProperty(URLS_PARAMETER);
+ String[] urlsStr = tmp.split(",");
+ for (String u : urlsStr) {
+ int lastIndex = u.lastIndexOf("/");
+ u = u.substring(0, lastIndex);
+ URL url = ConverterUtil.convert(URL.class, u);
+ // check if url is an existing file
+ log.info(url + " to check");
+ }
+ return false;
+ }
+
+ @Override
+ public Class<? extends I18nProjectConfigurePanelUI> getUIClass() {
+ return JarI18nProjectConfigurePanelUI.class;
+ }
+}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JCheckBoxMenuItem id='content' text='{getBundle().getDisplayName()}' toolTipText='{_("i18neditor.bundle.name", getBundle().getDisplayName())}' onItemStateChanged='updateState(event)'>
<!-- le nom du bundle -->
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,3 +1,21 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
JToolBar {
borderPainted:false;
floatable:false;
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JPanel layout='{new BorderLayout()}'>
<style source='BundleValueUI.css'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<org.jdesktop.swingx.JXTitledPanel id='content'
title='{updateTitle(getPackageName())}'>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,21 @@
-
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
#countryLabel {
text:"i18neditor.createbundle.newlocale";
labelFor:{country};
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JDialog id='main'>
<style source='CreateBundleUI.css'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,3 +1,21 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
#packageLabel {
text:"i18neditor.createpackage.newpackage";
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JDialog id='main'>
<style source='CreatePackageUI.css'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,3 +1,22 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+*/
+
JToolBar {
borderPainted:false;
floatable:false;
@@ -179,3 +198,51 @@
/*resizeWeight:1.0;*/
}
+#toolbar{
+ _help:{"ui.main.toolbar"};
+}
+
+#treeToolBar{
+ enabled:{context.getProject() != null};
+}
+
+#toTreeMode {
+
+ buttonGroup:"treeModelMode";
+ text:{TreeModelMode.TREE.toString()};
+enabled:{context.getProject() != null};
+selected:{context.getTreeModelMode() == TreeModelMode.TREE};
+value:{TreeModelMode.TREE};
+}
+
+#toFlatMode {
+ buttonGroup:"treeModelMode";
+ text:{TreeModelMode.FLAT.toString()};
+enabled:{context.getProject() != null};
+selected:{context.getTreeModelMode() == TreeModelMode.FLAT};
+value:{TreeModelMode.FLAT};
+}
+
+#collapseAll {
+ actionIcon:"collapseAll";
+ enabled:{context.getProject() != null && context.getSelectedKey() != null};
+}
+
+#expandAll{
+ actionIcon:"expandAll";
+ enabled:{context.getProject() != null && context.getSelectedKey() != null};
+}
+
+#keysView {
+ columnHeaderView:{treeToolBar};
+}
+
+#tree{
+ showsRootHandles:false;
+ rootVisible:false;
+ selectionModel:{treeSelectionModel};
+}
+
+#valuesView {
+ horizontalScrollBarPolicy:horizontal_scrollbar_never;
+}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JFrame id='mainFrame' implements='PropertyChangeListener'
width='800'
height='800'
@@ -12,7 +34,7 @@
import javax.swing.tree.*;
import java.util.Locale;
import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
+import org.nuiton.i18n.editor.project.I18nProject;
protected I18nEditorUIHandler handler = getContextValue(I18nEditorUIHandler.class);
protected I18nEditorConfig config = getContextValue(I18nEditorConfig.class);
@@ -202,9 +224,12 @@
<JMenuItem id='menuFileConfiguration' onActionPerformed="handler.showConfig()"/>
<JMenuItem id="menuFileCreateProject" onActionPerformed="handler.createProject(context)"/>
<JMenu id="menuFileOpenProject">
- <JMenuItem id="menuFileOpenProjectOther" onActionPerformed="handler.openOtherProject(context)"
+ <JMenuItem id="menuFileOpenProjectOther"
+ onActionPerformed="handler.openOtherProject(context)"
_doNotRemove='Boolean.TRUE'/>
- <JMenuItem id="menuFileDeleteProject" onActionPerformed="handler.deleteProject(context)" _doNotRemove='Boolean.TRUE'/>
+ <JMenuItem id="menuFileDeleteProject"
+ onActionPerformed="handler.deleteProject(context)"
+ _doNotRemove='Boolean.TRUE'/>
<JSeparator/>
</JMenu>
@@ -245,16 +270,16 @@
<ButtonGroup id='treeModelMode'
onStateChanged='handler.changeTreeModelMode(context, (TreeModelMode) treeModelMode.getSelectedValue())'/>
- <JToolBar id='treeToolBar' enabled='{context.getProject() != null}'>
- <JToggleButton id='toTreeMode' buttonGroup="treeModelMode" text='{TreeModelMode.TREE.toString()}' selected='{context.getTreeModelMode() == TreeModelMode.TREE}' value='{TreeModelMode.TREE}'/>
- <JToggleButton id='toFlatMode' buttonGroup="treeModelMode" text='{TreeModelMode.FLAT.toString()}' selected='{context.getTreeModelMode() == TreeModelMode.FLAT}' value='{TreeModelMode.FLAT}'/>
-
+ <JToolBar id='treeToolBar'>
+ <JToggleButton id='toTreeMode'/>
+ <JToggleButton id='toFlatMode'/>
+ <JSeparator orientation='vertical'/>
<javax.swing.Box.Filler constructorParams='SwingUtil.newMinDimension(), SwingUtil.newMinDimension(), SwingUtil.newMaxXDimension()'/>
- <JButton id='collapseAll' actionIcon='collapseAll' enabled='{context.getSelectedKey() != null}' onActionPerformed='collapseAll((PropertieNode)tree.getSelectionValue())'/>
- <JButton id='expandAll' actionIcon='expandAll' enabled='{context.getSelectedKey() != null}' onActionPerformed='expandAll((PropertieNode)tree.getSelectionValue())'/>
+ <JButton id='collapseAll' onActionPerformed='collapseAll((PropertieNode)tree.getSelectionValue())'/>
+ <JButton id='expandAll' onActionPerformed='expandAll((PropertieNode)tree.getSelectionValue())'/>
</JToolBar>
- <org.nuiton.i18n.editor.model.PropertiesTreeModel id='treeModel' mode='{context.getTreeModelMode()}'/>
+ <PropertiesTreeModel id='treeModel' mode='{context.getTreeModelMode()}'/>
<javax.swing.tree.DefaultTreeSelectionModel id='treeSelectionModel'/>
<!--onValueChanged='updateSelectedKey((PropertieNode) tree.getSelectionValue())'/-->
@@ -263,11 +288,10 @@
<!-- left : bundles keys -->
- <JScrollPane id='keysView' columnHeaderView='{treeToolBar}'>
+ <!--JScrollPane id='keysView' columnHeaderView='{treeToolBar}'-->
+ <JScrollPane id='keysView'>
<JTree id="tree" constructorParams='treeModel'
- showsRootHandles='false'
- rootVisible='false'
- selectionModel='{treeSelectionModel}'
+ onKeyReleased='updateSelectedKey((PropertieNode) tree.getSelectionValue())'
onMouseClicked='updateSelectedKey((PropertieNode) tree.getSelectionValue())'
cellRenderer='{
new DefaultTreeCellRenderer() {
@@ -300,7 +324,8 @@
<!-- right : bundles values (for the selected key) -->
- <JScrollPane id='valuesView' horizontalScrollBarPolicy="horizontal_scrollbar_never">
+ <!--JScrollPane id='valuesView' horizontalScrollBarPolicy="horizontal_scrollbar_never"-->
+ <JScrollPane id='valuesView'>
<JPanel id="values" layout='{new GridLayout(0,1)}'/>
</JScrollPane>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUIHandler.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,3 +1,21 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
package org.nuiton.i18n.editor.ui;
import java.awt.Component;
@@ -5,6 +23,7 @@
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.Map;
+import java.util.Set;
import javax.swing.JMenu;
import org.nuiton.i18n.editor.*;
import java.awt.Desktop;
@@ -15,7 +34,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Locale;
-import java.util.Properties;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JCheckBoxMenuItem;
@@ -32,14 +50,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.editor.model.I18nProject;
-import org.nuiton.i18n.editor.model.PropertiesTreeModel;
-import org.nuiton.i18n.editor.model.TreeModelMode;
+import org.nuiton.i18n.editor.project.I18nProject;
+import org.nuiton.i18n.editor.project.I18nProjectFactory;
+import org.nuiton.i18n.editor.project.I18nProjectProvider;
import org.nuiton.i18n.editor.ui.project.ProjectStep;
-import org.nuiton.i18n.editor.ui.project.ProjectType;
import org.nuiton.i18n.editor.ui.project.ProjectUI;
import org.nuiton.i18n.editor.ui.project.ProjectUIModel;
-import org.nuiton.util.ConverterUtil;
import static org.nuiton.i18n.I18n._;
/**
@@ -357,6 +373,7 @@
item.setText(name);
menu.add(item);
}
+ ui.getMenuFileDeleteProject().setEnabled(!projects.isEmpty());
}
@@ -554,7 +571,10 @@
@Override
protected void init(ProjectUI ui) {
ProjectUIModel model = ui.getModel();
- model.setProjectType(ProjectType.JAR);
+ Set<I18nProjectProvider<?>> providers = I18nProjectFactory.getProviders();
+ if (!providers.isEmpty()) {
+ model.setType(providers.iterator().next());
+ }
// ui.setTitle(("observe.title.import.localDB"));
}
@@ -562,7 +582,10 @@
protected void doAction(ProjectUI ui) {
log.info(ui.getName());
ProjectUIModel model = ui.getModel();
- I18nProject project = model.toProject();
+
+ I18nProject project = null;
+ I18nProjectProvider<? extends I18nProject> type = model.getType();
+ project = I18nProjectFactory.newProject(type.getType(), model);
rootContext.getContextValue(I18nEditorConfig.class).getProjects().add(model.getProjectName());
try {
if (model.isStoreProject()) {
@@ -613,19 +636,8 @@
public void loadProject(I18nEditorContext context, File projectFile) {
FileInputStream stream = null;
try {
- Properties p = new Properties();
- stream = new FileInputStream(projectFile);
- p.load(stream);
+ I18nProject project = I18nProjectFactory.newProject(projectFile);
- String name = p.getProperty("name");
- String tmp = p.getProperty("urls");
- String[] urlsStr = tmp.split(",");
- List<URL> urls = new ArrayList<URL>();
- for (String u : urlsStr) {
- URL url = ConverterUtil.convert(URL.class, u);
- urls.add(url);
- }
- I18nProject project = new I18nProject(name, urls.toArray(new URL[urls.size()]));
project.setStoreFile(projectFile);
project.load();
I18nEditorContext.PROJECT_DEF.setContextValue(context, project);
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,31 @@
+<!--
-<JCheckBoxMenuItem id='content' text='{updateText(getUrl())}' toolTipText='{_("i18neditor.resource.name", getUrl())}' onItemStateChanged='updateState(event)'>
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+-->
+
+<JCheckBoxMenuItem id='content'
+ text='{updateText(getUrl())}'
+ toolTipText='{_("i18neditor.resource.name", getUrl())}'
+ onItemStateChanged='updateState(event)'>
+
<!-- le nom du bundle -->
<String id='url' javaBean='""'/>
@@ -29,8 +54,7 @@
// pas encore de context (ui en construction)
return;
}
- boolean selected = e.getStateChange() == ItemEvent.SELECTED;
- if (selected) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
context.addSelectedPackage(url);
} else {
context.removeSelectedPackage(url);
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertieNode.java (from rev 1642, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/model/PropertieNode.java)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertieNode.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertieNode.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,122 @@
+/*
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%* */
+package org.nuiton.i18n.editor.ui;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import java.io.Serializable;
+import javax.swing.tree.MutableTreeNode;
+
+/**
+ * Représente un noeud de l'ardre des propriétés affichées. Le noeud contient
+ * le chemin de la propriétés, par exemple tutu.toto.tata va être représenté avec
+ * 3 noeuds avec comme chemin tutu, tutu.toto, tutu.toto.tata
+ *
+ * @author julien
+ */
+public class PropertieNode extends DefaultMutableTreeNode implements Comparable<PropertieNode> {
+
+ /** @see Serializable */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructeur avec l'objet contenu dans le noeud
+ *
+ * @param userObject chemin de la propriété
+ */
+ public PropertieNode(Object userObject) {
+ super(userObject);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof PropertieNode) {
+ // Comparaison du chemin
+ PropertieNode node = (PropertieNode) obj;
+ return getUserObject().equals(node.getUserObject());
+ }
+ return false;
+ }
+
+ public PropertieNode getChildAt(String path) {
+ if (!isLeaf()) {
+ for (Object o : children) {
+ PropertieNode n = (PropertieNode) o;
+ if (path.equals(n.getUserObject())) {
+ return n;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Ajoute le noeud fils a la bonne position (on conserve l'ordre alphabetique des path)
+ *
+ * Note : si le path existe deja, alors on ne fait rien.
+ *
+ * @param newChild le fils a ajouter
+ */
+ @Override
+ public void add(MutableTreeNode newChild) {
+ int index = 0;
+ if (!isLeaf()) {
+ // on recherche la position ou ajouter la clef
+ for (Object o : children) {
+ PropertieNode n = (PropertieNode) o;
+ int compareTo = n.compareTo((PropertieNode) newChild);
+ if (compareTo == 0) {
+ // le noeud existe deja
+ return;
+ }
+ if (compareTo > 0) {
+ // le noeud courant doit etre apres le noeud a ajouter
+ break;
+ }
+ index++;
+ }
+ }
+ insert(newChild, index);
+ }
+
+// @Override
+// public String toString() {
+// String result = getUserObject().toString();
+// if (isRoot()) {
+// // Si c'est la racine
+// return result;
+// } else {
+// // Si c'est un chemin
+// int lastSeparator = result.lastIndexOf(".");
+// return result.substring(lastSeparator + 1);
+// }
+// }
+
+ @Override
+ public int hashCode() {
+ return getUserObject().hashCode();
+ }
+
+ @Override
+ public int compareTo(PropertieNode node) {
+ // Compare les chemins
+ return getUserObject().toString().compareTo(node.getUserObject().toString());
+ }
+}
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertieNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertiesTreeModel.java (from rev 1644, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/model/PropertiesTreeModel.java)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertiesTreeModel.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertiesTreeModel.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,199 @@
+/*
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%* */
+package org.nuiton.i18n.editor.ui;
+
+import javax.swing.tree.DefaultTreeModel;
+import java.io.Serializable;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.editor.I18nEditorContext;
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Modèle de l'arbre des propriétés. Le modèle permet de sructurer les propriétés
+ * (ex: tutu.toto.tata) en un des noeuds de l'arbre.
+ *
+ * @author julien
+ */
+public class PropertiesTreeModel extends DefaultTreeModel {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(PropertiesTreeModel.class);
+ /** @see Serializable */
+ private static final long serialVersionUID = 1L;
+ protected TreeModelMode mode;
+ protected String[] keys;
+
+ /**
+ * Constructeur avec un liste de proprétés
+ *
+ * @param list liste de propriétés
+ */
+ public PropertiesTreeModel(String... list) {
+ this(TreeModelMode.TREE, list);
+ }
+
+ /**
+ * Constructeur avec un liste de proprétés
+ *
+ * @param mode le mode de modele a construire
+ * @param list liste de propriétés
+ */
+ public PropertiesTreeModel(TreeModelMode mode, String... list) {
+ super(null);
+ this.keys = list;
+
+ // Création de la racine (qui n'est jamais affichee)
+ PropertieNode r = new PropertieNode("");
+// PropertieNode r = new PropertieNode(list.length == 0 ? _("i18neditor.no.keys") : I18nEditorContext.ROOT_NAME);
+ setRoot(r);
+ setMode(mode);
+ }
+
+ @Override
+ public PropertieNode getRoot() {
+ return (PropertieNode) super.getRoot();
+ }
+
+ public String[] getKeys() {
+ return keys;
+ }
+
+ public void setKeys(String[] keys) {
+ this.keys = keys;
+ // on reconstruit le model
+ TreeModelMode theMode = mode;
+ mode = null;
+ setMode(theMode);
+ }
+
+ public boolean containsKey(String selectedKey) {
+ if (keys != null) {
+ switch (mode) {
+ case TREE:
+ for (String k : keys) {
+ if (k.equals(selectedKey) || k.startsWith(selectedKey + ".")) {
+ return true;
+ }
+ }
+ break;
+ case FLAT:
+
+ for (String k : keys) {
+ if (k.equals(selectedKey)) {
+ return true;
+ }
+ }
+ break;
+ }
+ }
+ return false;
+ }
+
+ public PropertieNode getNode(String path) {
+ PropertieNode result = null;
+ switch (mode) {
+ case TREE:
+ String[] names = path.split("\\" + I18nEditorContext.SEPARATOR);
+ result = getRoot();
+ String currentPath = "";
+ for (String name : names) {
+ if (!currentPath.isEmpty()) {
+ currentPath += I18nEditorContext.SEPARATOR;
+ }
+ currentPath += name;
+ result = result.getChildAt(currentPath);
+ }
+ break;
+ case FLAT:
+ result = getRoot().getChildAt(path);
+ break;
+ }
+ return result;
+ }
+
+ public TreeModelMode getMode() {
+ return mode;
+ }
+
+ public void setMode(TreeModelMode mode) {
+ this.mode = mode;
+
+ if (root == null) {
+ return;
+ }
+ PropertieNode r = (PropertieNode) root;
+ if (!r.isLeaf()) {
+ // on supprime tous les fils
+ r.removeAllChildren();
+ }
+ if (keys == null || keys.length == 0) {
+ // pas de clef a reconstruire
+ PropertieNode r2 = new PropertieNode(_("i18neditor.no.keys"));
+ r.add(r2);
+ // on notifie que le modele a ete reconstruit
+ nodeStructureChanged(root);
+ return;
+ }
+
+ // on reconstruit le modele
+
+ switch (mode) {
+ case TREE:
+ buildTreeModel(r, keys);
+ break;
+
+ case FLAT:
+ buildFlatModel(r, keys);
+ break;
+ }
+ // on notifie que le modele a ete reconstruit
+ nodeStructureChanged(root);
+ }
+
+ private void buildTreeModel(PropertieNode r, String[] list) {
+ for (String property : list) {
+ String path = "";
+ PropertieNode parent = r;
+
+ String[] names = property.split("\\" + I18nEditorContext.SEPARATOR);
+ for (String name : names) {
+ if (!path.isEmpty()) {
+
+ path += I18nEditorContext.SEPARATOR;
+ }
+ path += name;
+
+ PropertieNode node = parent.getChildAt(path);
+ if (node == null) {
+ node = new PropertieNode(path);
+ parent.add(node);
+ }
+ parent = node;
+ }
+ }
+ }
+
+ private void buildFlatModel(PropertieNode r, String[] list) {
+
+ for (String property : list) {
+ PropertieNode node = new PropertieNode(property);
+ r.add(node);
+ }
+ }
+}
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PropertiesTreeModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/TreeModelMode.java (from rev 1642, trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/model/TreeModelMode.java)
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/TreeModelMode.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/TreeModelMode.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,36 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.ui;
+
+/**
+ * Pour caracteriser le mode a utiliser dans le modele de navigation.
+ *
+ * @author chemit
+ */
+public enum TreeModelMode {
+
+ /**
+ * pour afficher les clefs sous forme d'arbre
+ */
+ TREE,
+ /**
+ * pour afficher les clefs a plat
+ */
+ FLAT
+}
Property changes on: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/TreeModelMode.java
___________________________________________________________________
Added: svn:mergeinfo
+
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/I18nProjectConfigurePanelUI.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,35 @@
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+package org.nuiton.i18n.editor.ui.project;
+
+import jaxx.runtime.JAXXObject;
+
+/**
+ * Le contrat a respecter pour configurer un type de projet.
+ *
+ * @author chemit
+ */
+public interface I18nProjectConfigurePanelUI extends JAXXObject {
+
+ /**
+ *
+ * @return l'instance partagee du modele de creation de projet
+ */
+ ProjectUIModel getModel();
+}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectStep.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectStep.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectStep.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -21,7 +21,7 @@
import static org.nuiton.i18n.I18n.n_;
/**
- * Pour caractériser les étapes lors du wiazrd de création de projet
+ * Pour caracteriser les étapes lors du wizard de creation de projet
*
* @author tchemit
*/
@@ -32,14 +32,10 @@
*/
CHOOSE_PROJECT_TYPE(n_("i18neditor.project.step.chooseProjectType"), n_("i18neditor.project.step.chooseProjectType.description")),
/**
- * pour configurer un projet de type jar
+ * pour configurer un projet
*/
- CONFIGURE_JAR_PROJECT(n_("i18neditor.project.step.configureJarProject"), n_("i18neditor.project.step.configureJarProject.description")),
+ CONFIGURE_PROJECT(n_("i18neditor.project.step.configureProject"), n_("i18neditor.project.step.configureProject.description")),
/**
- * pour configurer un projet de type directory
- */
- CONFIGURE_DIRECTORY_PROJECT(n_("i18neditor.project.step.configureDirectoryProject"), n_("i18neditor.project.step.configureDirectoryProject.description")),
- /**
* pour choisir les bundles parmis ceux trouvés
*/
SELECT_BUNDLES(n_("i18neditor.project.step.selecteBundles"), n_("i18neditor.project.step.selecteBundles.description")),
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectType.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectType.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectType.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,53 +0,0 @@
-/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
- */
-package org.nuiton.i18n.editor.ui.project;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * Pour caractériser les différents types de projet
- *
- * @author tchemit
- */
-public enum ProjectType {
-
- /**
- * charger un projet a partir d'un jar (ou zip)
- */
- JAR(n_("i18neditor.project.type.jar"), n_("i18neditor.project.type.jar.description")),
- /**
- * charger un projet a partir d'un repertoire
- */
- DIRECTORY(n_("i18neditor.project.type.directory"), n_("i18neditor.project.type.directory.description"));
- private final String label;
- private final String description;
-
- private ProjectType(String label, String description) {
- this.label = label;
- this.description = description;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getDescription() {
- return description;
- }
-}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -16,13 +16,6 @@
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
-/*
- Document : SynchroPanelUI
- Created on : 21 avr. 2009, 23:58:39
- Author : chemit
- Description:
- Purpose of the stylesheet follows.
-*/
#storageMain {
title:"i18neditor.title.change.storage";
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JDialog id="storageMain"
implements='jaxx.runtime.swing.wizard.WizardUI<ProjectStep, ProjectUIModel>'
width='550' height='560' defaultCloseOperation='dispose_on_close'>
@@ -272,8 +294,9 @@
<CardLayout>
<!-- les differents contenu d'onglets -->
<ChooseProjectTypePanelUI id='CHOOSE_PROJECT_TYPE' constructorParams='this'/>
- <ConfigureJarProjectPanelUI id='CONFIGURE_JAR_PROJECT' constructorParams='this'/>
- <ConfigureDirectoryProjectPanelUI id='CONFIGURE_DIRECTORY_PROJECT' constructorParams='this'/>
+ <ConfigureProjectPanelUI id='CONFIGURE_PROJECT' constructorParams='this'/>
+ <!--ConfigureJarProjectPanelUI id='CONFIGURE_JAR_PROJECT' constructorParams='this'/>
+ <ConfigureDirectoryProjectPanelUI id='CONFIGURE_DIRECTORY_PROJECT' constructorParams='this'/-->
<SelectBundlesPanelUI id='SELECT_BUNDLES' constructorParams='this'/>
<PersistPanelUI id='PERSIST' constructorParams='this'/>
<ResumePanelUI id='RESUME' constructorParams='this'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUIModel.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUIModel.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUIModel.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -20,21 +20,19 @@
import java.awt.Component;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.regex.Pattern;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.swing.wizard.WizardModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.i18n.bundle.I18nBundleFactory;
import org.nuiton.i18n.editor.I18nEditorConfig;
-import org.nuiton.i18n.editor.model.I18nProject;
+import org.nuiton.i18n.editor.project.I18nProject;
+import org.nuiton.i18n.editor.project.I18nProjectProvider;
import org.nuiton.util.FileUtil;
-import org.nuiton.util.Resource;
/**
* Le modele de l'ui pour creer un projet via un assistant
@@ -46,7 +44,7 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(ProjectUIModel.class);
public static final String PROJECT_NAME_PROPERTY_NAME = "projectName";
- public static final String PROJECT_TYPE_PROPERTY_NAME = "projectType";
+ public static final String TYPE_PROPERTY_NAME = "type";
public static final String JAR_SOURCE_PROPERTY_NAME = "jarSource";
public static final String DIRECTORY_SOURCE_PROPERTY_NAME = "directorySource";
public static final String SELECTED_BUNDLES_PROPERTY_NAME = "selectedBundles";
@@ -57,7 +55,7 @@
/**
* Le type de projet
*/
- protected ProjectType projectType;
+ protected I18nProjectProvider<? extends I18nProject> type;
/**
* le nom du projet
*/
@@ -99,8 +97,7 @@
public ProjectUIModel() {
super(ProjectStep.class,
ProjectStep.CHOOSE_PROJECT_TYPE,
- ProjectStep.CONFIGURE_JAR_PROJECT,
- ProjectStep.CONFIGURE_DIRECTORY_PROJECT,
+ ProjectStep.CONFIGURE_PROJECT,
ProjectStep.SELECT_BUNDLES,
ProjectStep.RESUME);
}
@@ -132,7 +129,7 @@
@Override
public void start() {
super.start();
- firePropertyChange(PROJECT_TYPE_PROPERTY_NAME, null, projectType);
+ firePropertyChange(TYPE_PROPERTY_NAME, null, type);
firePropertyChange(PROJECT_NAME_PROPERTY_NAME, null, projectName);
firePropertyChange(JAR_SOURCE_PROPERTY_NAME, null, jarSource);
firePropertyChange(DIRECTORY_SOURCE_PROPERTY_NAME, null, directorySource);
@@ -143,22 +140,14 @@
@Override
public void updateUniverse() {
- if (projectType == null) {
+ if (type == null) {
// pas de mode choisi donc l'univers ne change pas
return;
}
List<ProjectStep> universe = new ArrayList<ProjectStep>();
universe.add(ProjectStep.CHOOSE_PROJECT_TYPE);
+ universe.add(ProjectStep.CONFIGURE_PROJECT);
- switch (projectType) {
- case JAR:
- universe.add(ProjectStep.CONFIGURE_JAR_PROJECT);
- break;
- case DIRECTORY:
- universe.add(ProjectStep.CONFIGURE_DIRECTORY_PROJECT);
- break;
- }
-
universe.add(ProjectStep.SELECT_BUNDLES);
universe.add(ProjectStep.PERSIST);
universe.add(ProjectStep.RESUME);
@@ -174,14 +163,11 @@
if (validate) {
switch (s) {
case CHOOSE_PROJECT_TYPE:
- validate = projectType != null;
+ validate = type != null;
break;
- case CONFIGURE_JAR_PROJECT:
- validate = jarSource != null && jarSource.exists() && projectName != null && !projectName.isEmpty();
+ case CONFIGURE_PROJECT:
+ validate = type.validateUIModel(this);
break;
- case CONFIGURE_DIRECTORY_PROJECT:
- validate = directorySource != null && directorySource.exists() && projectName != null && !projectName.isEmpty();
- break;
case SELECT_BUNDLES:
validate = !selectedBundles.isEmpty();
break;
@@ -196,8 +182,8 @@
return validate;
}
- public ProjectType getProjectType() {
- return projectType;
+ public I18nProjectProvider<? extends I18nProject> getType() {
+ return type;
}
public String getProjectName() {
@@ -228,11 +214,11 @@
return storeFile;
}
- public void setProjectType(ProjectType projectType) {
- ProjectType oldValue = this.projectType;
- this.projectType = projectType;
- firePropertyChange(PROJECT_TYPE_PROPERTY_NAME, oldValue, projectType);
- if (oldValue != projectType) {
+ public void setType(I18nProjectProvider<? extends I18nProject> type) {
+ I18nProjectProvider<?> oldValue = this.type;
+ this.type = type;
+ firePropertyChange(TYPE_PROPERTY_NAME, oldValue, type);
+ if (oldValue != type) {
updateUniverse();
}
validate();
@@ -352,44 +338,13 @@
}
public List<URL> detectBundles() {
- List<URL> urls = new ArrayList<URL>();
- switch (projectType) {
- case JAR:
- if (uniqueJarDefinition) {
- // on recherche l'unique bundle dans META-INF/
- try {
- URLClassLoader loader = new URLClassLoader(new URL[]{jarSource.toURI().toURL()});
- List<URL> defs = Resource.getURLs("META-INF/.*-i18n-definition\\.properties", loader);
- log.info("detected unique bundle definition " + defs);
- if (!defs.isEmpty()) {
- // on ne traite que le premier ???
- URL u = defs.get(0);
- String path = u.toString();
- int index = path.lastIndexOf("/");
- path = path.substring(index + 1);
- String bundleName = path.substring(0, path.length() - "-i18n-definition.properties".length());
- log.info("bundleName : " + bundleName);
- urls = Resource.getURLs("META-INF/" + bundleName + "-.*\\.properties", loader);
- urls.remove(u);
- }
- } catch (Exception ex) {
- throw new RuntimeException(ex.getMessage(), ex);
- }
-
- } else {
- try {
- URLClassLoader loader = new URLClassLoader(new URL[]{jarSource.toURI().toURL()});
- urls = Resource.getURLs(I18nBundleFactory.SEARCH_BUNDLE_PATTERN, loader);
- log.info("detected bundles : " + urls);
- } catch (Exception ex) {
- throw new RuntimeException(ex.getMessage(), ex);
- }
- }
- break;
- case DIRECTORY:
- break;
+ List<URL> urls;
+ try {
+ urls = type.detectBundles(this);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
}
- Pattern p = Pattern.compile("(\\.+)-");
+ // suppression du fichier pom.properties...
for (Iterator<URL> it = urls.iterator(); it.hasNext();) {
String path = it.next().toString();
int index = path.lastIndexOf("/");
@@ -402,16 +357,8 @@
}
protected void copyTo(ProjectUIModel dst) {
- dst.setProjectType(getProjectType());
+ dst.setType(getType());
dst.setJarSource(getJarSource());
dst.setDirectorySource(getDirectorySource());
}
-
- public I18nProject toProject() {
- I18nProject p = new I18nProject(projectName, selectedBundles.toArray(new URL[selectedBundles.size()]));
- if (storeProject) {
- p.setStoreFile(storeFile);
- }
- return p;
- }
}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/SelectBundlesTableModel.java
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/SelectBundlesTableModel.java 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/SelectBundlesTableModel.java 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.css
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.css 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.css 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,6 +1,6 @@
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -16,6 +16,7 @@
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
*/
+
#tabPanel {
layout:{new BorderLayout()};
border:{new LineBorder(Color.BLACK,1,true)};
@@ -37,4 +38,4 @@
rows:3;
editable:false;
focusable:false;
-}
\ No newline at end of file
+}
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,4 +1,26 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<JPanel id="tabPanel"
abstract='true'
implements='jaxx.runtime.swing.wizard.WizardStepUI<ProjectStep, ProjectUIModel>'>
@@ -43,7 +65,13 @@
return txt;
}
]]></script>
-
+
+ <!-- layout pour la configuration specifique de chaque type de projet
+ on expose ici le layout sinon cela ne fonctionne pas (layout cree
+ apres 'content' : a fixer dans JAXX) -->
+ <jaxx.runtime.swing.CardLayout2Ext id='contentLayout'
+ constructorParams='this, "content"'/>
+
<!-- titre -->
<JPanel layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
<JProgressBar id='progress' constraints='BorderLayout.CENTER'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,8 +1,8 @@
<!--
/**
- * *##% observe-swing
- * Copyright (C) 2008 - 2009 IRD
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -24,47 +24,49 @@
<!-- L'écran de sélection de type de connexion -->
<!-- ***************************************** -->
<AbstractProjectTabPanelUI _step='{ProjectStep.CHOOSE_PROJECT_TYPE}'>
-
- <style>
-JRadioButton {
- buttonGroup:"mode";
-}
- </style>
<script><![CDATA[
import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
+import org.nuiton.i18n.editor.project.*;
import org.nuiton.i18n.editor.ui.project.*;
void $afterCompleteSetup() {
- model.addPropertyChangeListener(ProjectUIModel.PROJECT_TYPE_PROPERTY_NAME, new PropertyChangeListener() {
+ // ajout des types de projets connus a partir des providers connus
+ int index = 0;
+ for (I18nProjectProvider<?> p : I18nProjectFactory.getProviders()) {
+ JRadioButton b = new JRadioButton();
+ String name = "$JRadioButton" + index;
+ $objectMap.put( name, b);
+ b.setName(name);
+ b.putClientProperty("$buttonGroup", mode);
+ mode.add(b);
+ b.setText(_(p.getLabel()));
+ b.setToolTipText(_(p.getDescription()));
+ b.putClientProperty("$value", p);
+ mode.updateSelectedValue();
+ content.add(b, new GridBagConstraints(0, index++, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
+ }
+ // on ecoute les changement de type de projet
+ model.addPropertyChangeListener(ProjectUIModel.TYPE_PROPERTY_NAME, new PropertyChangeListener() {
+
@Override
public void propertyChange(PropertyChangeEvent evt) {
- ProjectType newMode = (ProjectType) evt.getNewValue();
- log.debug("new project type : " + newMode);
- AbstractButton c = mode.getButton(newMode);
- c.setSelected(true);
- setDescriptionText(_(newMode.getDescription()));
+ I18nProjectProvider<?> newMode = (I18nProjectProvider<?>) evt.getNewValue();
+ if (newMode != null) {
+ log.info("new project type : " + newMode);
+ AbstractButton c = mode.getButton(newMode);
+ c.setSelected(true);
+ setDescriptionText(_(newMode.getDescription()));
+ }
}
});
}
]]>
</script>
- <ButtonGroup id='mode'
- onStateChanged='model.setProjectType((ProjectType) mode.getSelectedValue())'/>
+ <ButtonGroup id='mode'
+ onStateChanged='model.setType((I18nProjectProvider) mode.getSelectedValue())'/>
- <Table id='content' fill='both' weightx='1' constraints='BorderLayout.CENTER'>
- <row>
- <cell>
- <JRadioButton value='{ProjectType.JAR}' text='{ProjectType.JAR.getLabel()}' />
- </cell>
- </row>
- <row>
- <cell>
- <JRadioButton value='{ProjectType.DIRECTORY}' text='{ProjectType.DIRECTORY.getLabel()}' />
- </cell>
- </row>
- </Table>
+ <Table id='content' fill='both' weightx='1' constraints='BorderLayout.CENTER'/>
</AbstractProjectTabPanelUI>
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureDirectoryProjectPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureDirectoryProjectPanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureDirectoryProjectPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,62 +0,0 @@
-
-<AbstractProjectTabPanelUI _step='{ProjectStep.CONFIGURE_DIRECTORY_PROJECT}'>
-
- <script><![CDATA[
-import jaxx.runtime.SwingUtil;
-
-import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
-import org.nuiton.i18n.editor.ui.project.*;
-
-import java.io.File;
-
-public void chooseDirectorySource() {
- File f = model.chooseDirectory(
- this,
- _("i18neditor.title.choose.directory.source"),
- _("i18neditor.action.choose.directory.source.description"),
- model.getJarSource());
- model.setDirectorySource(f);
-}
-
-void $afterCompleteSetup() {
- if (getStep()!=null) {
- setDescriptionText(_(getStep().getDescription()));
- }
-}
-]]>
- </script>
-
- <Table id='content' fill='both' constraints='BorderLayout.CENTER'>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.name.label'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JTextField id='projectName'
- text='{SwingUtil.getStringValue(model.getProjectName())}'
- onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.directory.source.label'/>
- </cell>
- </row>
- <row>
- <cell weightx='1' fill="both">
- <JTextField id="directorySourceFile"
- text='{SwingUtil.getStringValue(model.getDirectorySource()+"")}'
- onKeyReleased='model.setDirectorySource(new File(((JTextField)event.getSource()).getText()))'/>
- </cell>
- <cell anchor="east">
- <JButton id="fileChooserAction"
- actionIcon="fileChooser"
- onActionPerformed="chooseDirectorySource()"/>
- </cell>
- </row>
- </Table>
-
-</AbstractProjectTabPanelUI>
Deleted: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureJarProjectPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureJarProjectPanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureJarProjectPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,73 +0,0 @@
-
-<AbstractProjectTabPanelUI _step='{ProjectStep.CONFIGURE_JAR_PROJECT}'>
-
- <script><![CDATA[
-import jaxx.runtime.SwingUtil;
-
-import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
-import org.nuiton.i18n.editor.ui.project.*;
-
-import java.io.File;
-
-public void chooseJarSource() {
- File f = model.chooseFile (
- this,
- _("i18neditor.title.choose.jar.source"),
- _("i18neditor.action.choose.jar.source"),
- model.getJarSource(),
- "^.+\\.jar$",
- _("i18neditor.action.choose.jar.source.description"));
- model.setJarSource(f);
-}
-
-void $afterCompleteSetup() {
- if (getStep()!=null) {
- setDescriptionText(_(getStep().getDescription()));
- }
-}
-]]>
- </script>
-
- <Table id='content' fill='both' constraints='BorderLayout.CENTER'>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.name.label'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JTextField id='projectName'
- text='{SwingUtil.getStringValue(model.getProjectName())}'
- onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JLabel text='i18neditor.createproject.jar.source.label'/>
- </cell>
- </row>
- <row>
- <cell weightx='1' fill="both">
- <JTextField id="jarSourceFile"
- text='{SwingUtil.getStringValue(model.getJarSource()+"")}'
- onKeyReleased='model.setJarSource(new File(((JTextField)event.getSource()).getText()))'/>
- </cell>
- <cell anchor="east">
- <JButton id="fileChooserAction"
- actionIcon="fileChooser"
- onActionPerformed="chooseJarSource()"/>
- </cell>
- </row>
- <row>
- <cell columns="2">
- <JCheckBox id='uniqueJarDefinition'
- text='i18neditor.createproject.uniqueJarDefinition'
- toolTipText='i18neditor.createproject.uniqueJarDefinition.tip'
- selected='{model.isUniqueJarDefinition()}'
- onItemStateChanged='model.setUniqueJarDefinition(event.getStateChange() == ItemEvent.SELECTED)'/>
- </cell>
- </row>
- </Table>
-
-</AbstractProjectTabPanelUI>
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,69 @@
+<!--
+
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
+<AbstractProjectTabPanelUI _step='{ProjectStep.CONFIGURE_PROJECT}'>
+
+ <script><![CDATA[
+
+import java.lang.reflect.Constructor;
+
+import org.nuiton.i18n.editor.*;
+import org.nuiton.i18n.editor.project.I18nProjectProvider;
+import org.nuiton.i18n.editor.project.I18nProjectFactory;
+import org.nuiton.i18n.editor.ui.project.*;
+
+protected String updateContentLayout(I18nProjectProvider<?> projectType) {
+ if (projectType == null) {
+ return "null";
+ }
+ return projectType.getType().getName();
+}
+
+void $afterCompleteSetup() {
+ if (getStep()!=null) {
+ setDescriptionText(_(getStep().getDescription()));
+ }
+ for (I18nProjectProvider<?> p : I18nProjectFactory.getProviders()) {
+ try {
+ Class<? extends I18nProjectConfigurePanelUI> c = p.getUIClass();
+ Constructor<? extends I18nProjectConfigurePanelUI> constructor = c.getConstructor(jaxx.runtime.JAXXContext.class);
+ I18nProjectConfigurePanelUI ui = constructor.newInstance(this);
+ getContent().add((java.awt.Component) ui, p.getType().getName());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
+]]>
+ </script>
+
+ <jaxx.runtime.swing.CardLayout2Ext id='contentLayout'
+ selected='{updateContentLayout(model.getType())}'/>
+
+ <JPanel id='content' layout='{contentLayout}'>
+
+ <JLabel text='i18neditor.createproject.no.type' constraints='"null"'/>
+
+ </JPanel>
+
+</AbstractProjectTabPanelUI>
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/DirectoryI18nProjectConfigurePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,81 @@
+<!--
+
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
+<Table fill='both' constraints='DirectoryI18nProject.class.getName()'
+ implements='org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI'>
+
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+
+import org.nuiton.i18n.editor.*;
+import org.nuiton.i18n.editor.project.impl.*;
+import org.nuiton.i18n.editor.ui.project.*;
+
+import java.io.File;
+
+protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
+
+@Override
+public ProjectUIModel getModel() {
+ return model;
+}
+
+public void chooseDirectorySource() {
+ File f = model.chooseDirectory(
+ this,
+ _("i18neditor.title.choose.directory.source"),
+ _("i18neditor.action.choose.directory.source.description"),
+ model.getJarSource());
+ model.setDirectorySource(f);
+}
+]]>
+ </script>
+
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.name.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
+ onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.directory.source.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1' fill="both">
+ <JTextField id="directorySourceFile"
+ text='{SwingUtil.getStringValue(model.getDirectorySource()+"")}'
+ onKeyReleased='model.setDirectorySource(new File(((JTextField)event.getSource()).getText()))'/>
+ </cell>
+ <cell anchor="east">
+ <JButton actionIcon="fileChooser"
+ onActionPerformed="chooseDirectorySource()"/>
+ </cell>
+ </row>
+</Table>
Added: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/JarI18nProjectConfigurePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,93 @@
+<!--
+
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
+<Table fill='both' constraints='JarI18nProject.class.getName()'
+ implements='org.nuiton.i18n.editor.ui.project.I18nProjectConfigurePanelUI'>
+
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+
+import org.nuiton.i18n.editor.*;
+import org.nuiton.i18n.editor.project.impl.*;
+import org.nuiton.i18n.editor.ui.project.*;
+
+import java.io.File;
+
+protected ProjectUIModel model = getContextValue(ProjectUIModel.class);
+
+@Override
+public ProjectUIModel getModel() {
+ return model;
+}
+
+public void chooseJarSource() {
+ File f = model.chooseFile (
+ this,
+ _("i18neditor.title.choose.jar.source"),
+ _("i18neditor.action.choose.jar.source"),
+ model.getJarSource(),
+ "^.+\\.jar$",
+ _("i18neditor.action.choose.jar.source.description"));
+ model.setJarSource(f);
+}
+]]>
+ </script>
+
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.name.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JTextField text='{SwingUtil.getStringValue(model.getProjectName())}'
+ onKeyReleased='model.setProjectName(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JLabel text='i18neditor.createproject.jar.source.label'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1' fill="both">
+ <JTextField id="jarSourceFile"
+ text='{SwingUtil.getStringValue(model.getJarSource()+"")}'
+ onKeyReleased='model.setJarSource(new File(((JTextField)event.getSource()).getText()))'/>
+ </cell>
+ <cell anchor="east">
+ <JButton actionIcon="fileChooser"
+ onActionPerformed="chooseJarSource()"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2">
+ <JCheckBox id='uniqueJarDefinition'
+ text='i18neditor.createproject.uniqueJarDefinition'
+ toolTipText='i18neditor.createproject.uniqueJarDefinition.tip'
+ selected='{model.isUniqueJarDefinition()}'
+ onItemStateChanged='model.setUniqueJarDefinition(event.getStateChange() == ItemEvent.SELECTED)'/>
+ </cell>
+ </row>
+</Table>
+
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,11 +1,32 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<AbstractProjectTabPanelUI _step='{ProjectStep.PERSIST}'>
<script><![CDATA[
import jaxx.runtime.SwingUtil;
import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
import org.nuiton.i18n.editor.ui.project.*;
import java.io.File;
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,10 +1,31 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<AbstractProjectTabPanelUI _step='{ProjectStep.RESUME}'>
<script><![CDATA[
import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
import org.nuiton.i18n.editor.ui.project.*;
void $afterCompleteSetup() {
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx 2009-07-22 17:50:16 UTC (rev 1645)
@@ -1,11 +1,32 @@
+<!--
+/**
+ * *##% Nuiton I18n Editor
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%*
+ */
+
+-->
+
<AbstractProjectTabPanelUI _step='{ProjectStep.SELECT_BUNDLES}'>
<script><![CDATA[
import jaxx.runtime.SwingUtil;
import org.nuiton.i18n.editor.*;
-import org.nuiton.i18n.editor.model.*;
import org.nuiton.i18n.editor.ui.project.*;
Added: trunk/nuiton-i18n-editor/src/main/resources/META-INF/services/org.nuiton.i18n.editor.project.I18nProjectProvider
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/META-INF/services/org.nuiton.i18n.editor.project.I18nProjectProvider (rev 0)
+++ trunk/nuiton-i18n-editor/src/main/resources/META-INF/services/org.nuiton.i18n.editor.project.I18nProjectProvider 2009-07-22 17:50:16 UTC (rev 1645)
@@ -0,0 +1,2 @@
+org.nuiton.i18n.editor.project.impl.JarI18nProjectProvider
+org.nuiton.i18n.editor.project.impl.DirectoryI18nProjectProvider
Modified: trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-en_GB.properties 2009-07-22 17:50:16 UTC (rev 1645)
@@ -66,6 +66,7 @@
i18neditor.createproject.doPersist=
i18neditor.createproject.jar.source.label=
i18neditor.createproject.name.label=
+i18neditor.createproject.no.type=
i18neditor.createproject.storeProject.directory=
i18neditor.createproject.storeProject.path=
i18neditor.createproject.uniqueJarDefinition=
@@ -89,6 +90,8 @@
i18neditor.project.step.configureDirectoryProject.description=
i18neditor.project.step.configureJarProject=
i18neditor.project.step.configureJarProject.description=
+i18neditor.project.step.configureProject=
+i18neditor.project.step.configureProject.description=
i18neditor.project.step.label=
i18neditor.project.step.persist=
i18neditor.project.step.persist.description=
Modified: trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/resources/i18n/nuiton-i18n-editor-fr_FR.properties 2009-07-22 17:50:16 UTC (rev 1645)
@@ -66,6 +66,7 @@
i18neditor.createproject.doPersist=Sauver la d\u00E9finition du projet
i18neditor.createproject.jar.source.label=Choisir le jar source
i18neditor.createproject.name.label=Nom du projet
+i18neditor.createproject.no.type=
i18neditor.createproject.storeProject.directory=R\u00E9pertoire de sauvegarde
i18neditor.createproject.storeProject.path=Fichier de sauvegarde
i18neditor.createproject.uniqueJarDefinition=Utilisation d'un bundle final
@@ -87,8 +88,10 @@
i18neditor.project.step.chooseProjectType.description=Choisir le type de projet \u00E0 ouvrir
i18neditor.project.step.configureDirectoryProject=Configuration
i18neditor.project.step.configureDirectoryProject.description=Configurer le projet de type 'r\u00E9pertoire'
-i18neditor.project.step.configureJarProject=Configuration
-i18neditor.project.step.configureJarProject.description=Configurer le projet de type 'jar'
+i18neditor.project.step.configureJarProject=
+i18neditor.project.step.configureJarProject.description=
+i18neditor.project.step.configureProject=Configuration
+i18neditor.project.step.configureProject.description=Configurer le projet
i18neditor.project.step.label=Etape %1$d/%2$d \: %3$s
i18neditor.project.step.persist=Sauvegarde
i18neditor.project.step.persist.description=Permet de sauvegarder la d\u00E9finition du projet
Modified: trunk/nuiton-i18n-editor/src/main/resources/log4j.properties
===================================================================
--- trunk/nuiton-i18n-editor/src/main/resources/log4j.properties 2009-07-06 12:04:17 UTC (rev 1644)
+++ trunk/nuiton-i18n-editor/src/main/resources/log4j.properties 2009-07-22 17:50:16 UTC (rev 1645)
@@ -8,6 +8,6 @@
# package level
log4j.logger.org.nuiton=WARN
log4j.logger.org.nuiton.i18n.editor=INFO
-#log4j.logger.org.nuiton.i18n=INFO
+log4j.logger.org.nuiton.util.Resource=DEBUG
#log4j.logger.org.nuiton.i18n.editor.I18nEditorConfig=DEBUG
#log4j.logger.jaxx.runtime.swing.I18nWidget=DEBUG
1
0
[Lutinutil-commits] r1667 - trunk/src/main/java/org/nuiton/util
by tchemit@users.labs.libre-entreprise.org 11 Jul '09
by tchemit@users.labs.libre-entreprise.org 11 Jul '09
11 Jul '09
Author: tchemit
Date: 2009-07-11 14:07:21 +0200 (Sat, 11 Jul 2009)
New Revision: 1667
Modified:
trunk/src/main/java/org/nuiton/util/MD5InputStream.java
Log:
push back some missing codes
Modified: trunk/src/main/java/org/nuiton/util/MD5InputStream.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/MD5InputStream.java 2009-07-06 20:42:06 UTC (rev 1666)
+++ trunk/src/main/java/org/nuiton/util/MD5InputStream.java 2009-07-11 12:07:21 UTC (rev 1667)
@@ -53,135 +53,140 @@
* @author Santeri Paavolainen <santtu(a)cs.hut.fi>
* @author Timothy W Macinta (twm(a)alum.mit.edu) (added main() method)
**/
-
-
public class MD5InputStream extends FilterInputStream {
- /**
- * MD5 context
- */
- private MD5 md5;
-
- /**
- * Creates a MD5InputStream
- * @param in The input stream
- */
- public MD5InputStream (InputStream in) {
- super(in);
+ /** Class logger. */
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(MD5InputStream.class);
+ /**
+ * MD5 context
+ */
+ protected MD5 md5;
+ protected long streamLength;
- md5 = new MD5();
- }
+ /**
+ * Creates a MD5InputStream
+ * @param in The input stream
+ */
+ public MD5InputStream(InputStream in) {
+ super(in);
- /**
- * Read a byte of data.
- * @see java.io.FilterInputStream
- */
- public int read() throws IOException {
- int c = in.read();
-
- if (c == -1)
- return -1;
-
- if ((c & ~0xff) != 0) {
- System.out.println("MD5InputStream.read() got character with (c & ~0xff) != 0)!");
- } else {
- md5.Update(c);
+ md5 = new MD5();
}
- return c;
- }
+ @Override
+ public int read() throws IOException {
+ int c = in.read();
- /**
- * Reads into an array of bytes.
- *
- * @see java.io.FilterInputStream
- */
- public int read (byte bytes[], int offset, int length) throws IOException {
- int r;
-
- if ((r = in.read(bytes, offset, length)) == -1)
- return r;
+ if (c == -1) {
+ return -1;
+ }
- md5.Update(bytes, offset, r);
+ if ((c & ~0xff) != 0) {
+ log.warn("MD5InputStream.read() got character with (c & ~0xff) != 0)!");
+ } else {
+ streamLength++;
+ md5.Update(c);
+ }
- return r;
- }
+ return c;
+ }
- /**
- * Returns array of bytes representing hash of the stream as
- * finalized for the current state.
- * @see MD5#Final
- */
- public byte[] hash () {
- return md5.Final();
- }
+ @Override
+ public int read(byte bytes[], int offset, int length) throws IOException {
+ int r;
- public MD5 getMD5() {
- return md5;
- }
+ if ((r = in.read(bytes, offset, length)) == -1) {
+ return r;
+ }
+ streamLength += r;
- /**
- * This method is here for testing purposes only - do not rely
- * on it being here.
- **/
- public static void main(String[] arg) {
- try {
+ md5.Update(bytes, offset, r);
- ////////////////////////////////////////////////////////////////
- //
- // usage: java com.twmacinta.util.MD5InputStream [--use-default-md5] [--no-native-lib] filename
- //
- /////////
+ return r;
+ }
- // determine the filename to use and the MD5 impelementation to use
+ /**
+ * Returns array of bytes representing hash of the stream as
+ * finalized for the current state.
+ * @return
+ * @see MD5#Final
+ */
+ public byte[] hash() {
+ return md5.Final();
+ }
- String filename = arg[arg.length-1];
- boolean use_default_md5 = false;
- boolean use_native_lib = true;
- for (int i = 0; i < arg.length-1; i++) {
- if (arg[i].equals("--use-default-md5")) {
- use_default_md5 = true;
- } else if (arg[i].equals("--no-native-lib")) {
- use_native_lib = false;
- }
- }
+ public MD5 getMD5() {
+ return md5;
+ }
- // initialize common variables
-
- byte[] buf = new byte[65536];
- int num_read;
-
- // Use the default MD5 implementation that comes with Java
-
- if (use_default_md5) {
- InputStream in = new BufferedInputStream(new FileInputStream(filename));
- java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
- while ((num_read = in.read(buf)) != -1) {
- digest.update(buf, 0, num_read);
- }
- System.out.println(MD5.asHex(digest.digest())+" "+filename);
- in.close();
-
- // Use the optimized MD5 implementation
-
- } else {
-
- // disable the native library search, if requested
-
- if (!use_native_lib) {
- MD5.initNativeLibrary(true);
- }
-
- // calculate the checksum
-
- MD5InputStream in = new MD5InputStream(new BufferedInputStream(new FileInputStream(filename)));
- while ((num_read = in.read(buf)) != -1);
- System.out.println(MD5.asHex(in.hash())+" "+filename);
- in.close();
- }
- } catch (Exception e) {
- e.printStackTrace();
+ public long getStreamLength() {
+ return streamLength;
}
- }
+ //TODO TC-20090711 : do a unit test instead of this main !
+// /**
+// * This method is here for testing purposes only - do not rely
+// * on it being here.
+// *
+// * @param arg
+// */
+// public static void main(String[] arg) {
+// try {
+//
+// ////////////////////////////////////////////////////////////////
+// //
+// // usage: java com.twmacinta.util.MD5InputStream [--use-default-md5] [--no-native-lib] filename
+// //
+// /////////
+//
+// // determine the filename to use and the MD5 impelementation to use
+//
+// String filename = arg[arg.length - 1];
+// boolean use_default_md5 = false;
+// boolean use_native_lib = true;
+// for (int i = 0; i < arg.length - 1; i++) {
+// if (arg[i].equals("--use-default-md5")) {
+// use_default_md5 = true;
+// } else if (arg[i].equals("--no-native-lib")) {
+// use_native_lib = false;
+// }
+// }
+//
+// // initialize common variables
+//
+// byte[] buf = new byte[65536];
+// int num_read;
+//
+// // Use the default MD5 implementation that comes with Java
+//
+// if (use_default_md5) {
+// InputStream in = new BufferedInputStream(new FileInputStream(filename));
+// java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
+// while ((num_read = in.read(buf)) != -1) {
+// digest.update(buf, 0, num_read);
+// }
+// System.out.println(MD5.asHex(digest.digest()) + " " + filename);
+// in.close();
+//
+// // Use the optimized MD5 implementation
+//
+// } else {
+//
+// // disable the native library search, if requested
+//
+// if (!use_native_lib) {
+// MD5.initNativeLibrary(true);
+// }
+//
+// // calculate the checksum
+//
+// MD5InputStream in = new MD5InputStream(new BufferedInputStream(new FileInputStream(filename)));
+// while ((num_read = in.read(buf)) != -1);
+// System.out.println(MD5.asHex(in.hash()) + " " + filename);
+// in.close();
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
}
1
0
[Lutinutil-commits] r1607 - maven-license-switcher-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 18 May '09
by tchemit@users.labs.libre-entreprise.org 18 May '09
18 May '09
Author: tchemit
Date: 2009-05-18 15:54:24 +0000 (Mon, 18 May 2009)
New Revision: 1607
Modified:
maven-license-switcher-plugin/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: maven-license-switcher-plugin/trunk/pom.xml
===================================================================
--- maven-license-switcher-plugin/trunk/pom.xml 2009-05-18 15:53:58 UTC (rev 1606)
+++ maven-license-switcher-plugin/trunk/pom.xml 2009-05-18 15:54:24 UTC (rev 1607)
@@ -79,7 +79,8 @@
<description>Plugin pour switcher de license dans un module maven 2</description>
<inceptionYear>2008</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <url>http://maven-site.nuiton.org/${project.artifactId}</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
[Lutinutil-commits] r1606 - nuiton-i18n-api/trunk
by tchemit@users.labs.libre-entreprise.org 18 May '09
by tchemit@users.labs.libre-entreprise.org 18 May '09
18 May '09
Author: tchemit
Date: 2009-05-18 15:53:58 +0000 (Mon, 18 May 2009)
New Revision: 1606
Modified:
nuiton-i18n-api/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: nuiton-i18n-api/trunk/pom.xml
===================================================================
--- nuiton-i18n-api/trunk/pom.xml 2009-05-18 15:53:46 UTC (rev 1605)
+++ nuiton-i18n-api/trunk/pom.xml 2009-05-18 15:53:58 UTC (rev 1606)
@@ -48,7 +48,8 @@
<name>Nuiton i18n api</name>
<description>Api of i18n system</description>
<inceptionYear>2004</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <url>http://maven-site.nuiton.org/${project.artifactId}</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
[Lutinutil-commits] r1605 - maven-i18n-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 18 May '09
by tchemit@users.labs.libre-entreprise.org 18 May '09
18 May '09
Author: tchemit
Date: 2009-05-18 15:53:46 +0000 (Mon, 18 May 2009)
New Revision: 1605
Modified:
maven-i18n-plugin/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: maven-i18n-plugin/trunk/pom.xml
===================================================================
--- maven-i18n-plugin/trunk/pom.xml 2009-05-18 15:53:28 UTC (rev 1604)
+++ maven-i18n-plugin/trunk/pom.xml 2009-05-18 15:53:46 UTC (rev 1605)
@@ -102,7 +102,8 @@
basé sur nuiton-i18n-api.
</description>
<inceptionYear>2007</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <url>http://maven-site.nuiton.org/${project.artifactId}</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
[Lutinutil-commits] r1604 - nuitonutilextra/trunk
by tchemit@users.labs.libre-entreprise.org 18 May '09
by tchemit@users.labs.libre-entreprise.org 18 May '09
18 May '09
Author: tchemit
Date: 2009-05-18 15:53:28 +0000 (Mon, 18 May 2009)
New Revision: 1604
Modified:
nuitonutilextra/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: nuitonutilextra/trunk/pom.xml
===================================================================
--- nuitonutilextra/trunk/pom.xml 2009-05-18 15:53:22 UTC (rev 1603)
+++ nuitonutilextra/trunk/pom.xml 2009-05-18 15:53:28 UTC (rev 1604)
@@ -61,7 +61,8 @@
<description>Librairie de classe Java utile à tout projet.</description>
<inceptionYear>2006</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <url>http://maven-site.nuiton.org/${project.artifactId}</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0
18 May '09
Author: tchemit
Date: 2009-05-18 15:53:22 +0000 (Mon, 18 May 2009)
New Revision: 1603
Modified:
nuitonutil/trunk/pom.xml
Log:
utilisation url de site sur nuiton :)
Modified: nuitonutil/trunk/pom.xml
===================================================================
--- nuitonutil/trunk/pom.xml 2009-05-18 10:53:04 UTC (rev 1602)
+++ nuitonutil/trunk/pom.xml 2009-05-18 15:53:22 UTC (rev 1603)
@@ -83,7 +83,8 @@
<name>Nuiton utilities library</name>
<description>Library of usefull class to be used in any project.</description>
<inceptionYear>2004</inceptionYear>
- <url>http://www.nuiton.org/embedded/${project.artifactId}</url>
+ <url>http://maven-site.nuiton.org/${project.artifactId}</url>
+ <!--url>http://www.nuiton.org/embedded/${project.artifactId}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0