[Lutinutil-commits] r891 - in trunk/commandline/commandline-demo: . src/main src/main/java src/main/java/org src/main/java/org/codelutin src/main/java/org/codelutin/commandline src/main/java/org/codelutin/commandline/demo src/main/java/org/codelutin/commandline/demo/ui src/main/java/org/codelutin/commandline/demo/ui/actions src/main/resources src/main/resources/i18n src/main/uimodel src/main/uimodel/org src/main/uimodel/org/codelutin src/main/uimodel/org/codelutin/commandline src/main/uimodel/org/codelutin/
Author: tchemit Date: 2008-07-23 15:34:33 +0000 (Wed, 23 Jul 2008) New Revision: 891 Added: trunk/commandline/commandline-demo/run-demo.sh trunk/commandline/commandline-demo/src/main/java/org/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyContext.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyMain.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyActionManager.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyMainUI.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/AboutAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ChangeLocaleAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ConfigAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/HelpAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/MyAbstractAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/QuitAction.java trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/SiteAction.java trunk/commandline/commandline-demo/src/main/resources/log4j.properties trunk/commandline/commandline-demo/src/main/uimodel/ trunk/commandline/commandline-demo/src/main/uimodel/org/ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JMainUI.jaxx Modified: trunk/commandline/commandline-demo/ trunk/commandline/commandline-demo/pom.xml trunk/commandline/commandline-demo/src/main/resources/commandline.properties trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst Log: commandline-demo with ui and jaxx-swing-action :) Property changes on: trunk/commandline/commandline-demo ___________________________________________________________________ Name: svn:ignore + target *.log Modified: trunk/commandline/commandline-demo/pom.xml =================================================================== --- trunk/commandline/commandline-demo/pom.xml 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/pom.xml 2008-07-23 15:34:33 UTC (rev 891) @@ -28,7 +28,16 @@ <groupId>org.codelutin.commandline</groupId> <artifactId>commandline-ui</artifactId> </dependency> + <dependency> + <groupId>org.codelutin.jaxx</groupId> + <artifactId>jaxx-swing-action</artifactId> + </dependency> + <dependency> + <groupId>lutinlib</groupId> + <artifactId>lutinwidget</artifactId> + </dependency> + </dependencies> @@ -46,6 +55,13 @@ <packaging>jar</packaging> + <properties> + + <!--Main class in JAR --> + <maven.jar.main.class>org.codelutin.commandline.demo.MyMain</maven.jar.main.class> + + </properties> + <build> <plugins> <plugin> @@ -53,10 +69,34 @@ <artifactId>maven-i18n-plugin</artifactId> <executions> <execution> + <id>javaActionConfig</id> <phase>compile</phase> - <configuration> + <goals> + <goal>parserJavaActionConfig</goal> + </goals> + <configuration> + <treateDefaultEntry>false</treateDefaultEntry> <entries> <entry> + <basedir>${maven.src.dir}/main/java</basedir> + <includes> + <param>org\/codelutin\/commandline\/demo\/ui\/actions\/**\/*Action.java</param> + </includes> + <excludes> + <param> + org\/codelutin\/commandline\/demo\/ui\/actions\/**\/*AbstractAction.java + </param> + </excludes> + </entry> + </entries> + </configuration> + </execution> + <execution> + <id>java</id> + <phase>compile</phase> + <configuration> + <entries> + <entry> <basedir>${maven.gen.dir}/java</basedir> </entry> </entries> @@ -108,6 +148,89 @@ </execution> </executions> </plugin> + + <plugin> + <groupId>org.codelutin.jaxx</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <copyToCP>true</copyToCP> + <actionsFile>/jaxx/commandlinedemo-actions.properties</actionsFile> + </configuration> + <executions> + <execution> + <id>generate jaxx</id> + <goals> + <goal>generate</goal> + </goals> + </execution> + <execution> + <id>jaxx-generate-actions-provider</id> + <goals> + <goal>generate-actions-provider</goal> + </goals> + <configuration> + <fqn>org.codelutin.commandline.demo.ui.MyActionProvider</fqn> + <fqnAction>org.codelutin.commandline.demo.ui.actions.MyAbstractAction</fqnAction> + <providerName>commandlinedemo</providerName> + </configuration> + </execution> + <execution> + <id>jaxx-generate-actions</id> + <goals> + <goal>generate-actions-properties</goal> + </goals> + <configuration> + <includes> + <param> + org\/codelutin\/commandline\/demo\/ui\/actions\/**\/*Action.java + </param> + </includes> + <excludes> + <param> + org\/codelutin\/commandline\/demo\/ui\/actions\/**\/*AbstractAction.java + </param> + </excludes> + </configuration> + </execution> + </executions> + </plugin> + + + + <!-- Package phase --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>${maven.jar.main.class}</mainClass> + <addClasspath>true</addClasspath> + <addExtensions/> + <classpathPrefix>./dependency/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> </build> Added: trunk/commandline/commandline-demo/run-demo.sh =================================================================== --- trunk/commandline/commandline-demo/run-demo.sh (rev 0) +++ trunk/commandline/commandline-demo/run-demo.sh 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,39 @@ +#!/bin/sh + +DEBUG_PORT=5005 +VERSION=$(xmlstarlet sel -N "p=http://maven.apache.org/POM/4.0.0" -t -v "/p:project/p:version" pom.xml) +JAVA=java +RELEASE="commandline-demo-$VERSION" +MX=128M + +############################################################################### +####### parse arguments ####################################################### +############################################################################### + +while true; do + case "$1" in + -d|--debug) + echo "Debug mode" + DEBUG="-server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT" + shift ;; + -n|--nosuspend) + echo "Debug no suspend mode" + DEBUG="$DEBUG,suspend=n" + shift ;; + \-\-) shift ; break ;; + *) break; + esac +done + +############################################################################### +####### init dir ############################################################## +############################################################################### + +dir=$(dirname $0) +cd $dir + +############################################################################### +####### launch appli ########################################################## +############################################################################### +echo "java $RELEASE $@" +$JAVA $DEBUG -Xmx$MX -Xms$MX -jar target/$RELEASE.jar $@ \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyContext.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyContext.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyContext.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,48 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo; + +import org.codelutin.commandline.demo.ui.JMainUI; +import org.codelutin.commandline.demo.ui.MyMainUI; +import org.codelutin.i18n.I18n; + +/** @author chemit */ +public class MyContext extends CommandLineDemoAbstractContext { + + /** main UI */ + protected JMainUI mainUI; + + public MyContext() throws Exception { + super(); + } + + public void initI18n() { + I18n.init(getMainConfig().getLocale(), getMainConfig().getEncoding()); + } + + public JMainUI getMainUI() { + if (mainUI == null) { + mainUI = new MyMainUI(); + } + return mainUI; + } + + public void disposeUI() { + if (mainUI != null) { + mainUI.dispose(); + mainUI = null; + } + } +} Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyMain.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyMain.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/MyMain.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,122 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.commandline.demo.ui.MyActionManager; +import org.codelutin.option.OptionParserResult; +import org.codelutin.option.ParserFailedException; + +import java.io.IOException; + +/** @author chemit */ +public class MyMain { + + private static final Log log = LogFactory.getLog(MyMain.class); + + /** le context principal de l'application */ + protected static MyContext context; + + public static MyContext getContext() { + checkInitContext(); + return context; + } + + /** + * initialisation de l'application : + * <p/> + * chargement du context + * + * @param args les arguments pass�s � l'application + */ + public static synchronized void init(String... args) { + + try { + // instanciate context, parser and configs + context = new MyContext(); + + // init context + context.init(args); + + } catch (IOException e) { + log.error("io error : " + e.getMessage()); + e.printStackTrace(); + System.exit(1); + + } catch (ParserFailedException e) { + log.error("parser error : " + e.getMessage()); + e.printStackTrace(); + System.exit(1); + } catch (Exception e) { + log.error("fatal error : " + e.getMessage()); + e.printStackTrace(); + System.exit(1); + } + + } + + /** Lancement de l'ui apr�s init de l'application. */ + public static void launch() { + + getContext().getMainUI().setVisible(true); + + } + + + /** @param args les arguments pass�s au programme */ + public static void main(String[] args) { + + init(args); + + try { + OptionParserResult optionParserResult = getContext().getParser().getLastResult(); + if (optionParserResult.size() > 0) { + optionParserResult.doAllActions(getContext()); + } + } catch (Exception e) { + log.error("a problem occurs while treating commandline : " + e.getMessage(), e); + //TODO should we stop ? + } + + if (getContext().isQuit()) { + // nothing more to be done here + return; + } + + launch(); + + } + + public static void checkInitContext() { + if (context == null) { + throw new RuntimeException("context is null, you must init first the " + MyContext.class.getName() + " class via init method"); + } + } + + public static void dispose(boolean reload) { + + MyActionManager.dispose(); + + getContext().disposeUI(); + + //ErrorDialog.disposeUI(); + + if (reload) { + launch(); + } + } + +} Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyActionManager.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyActionManager.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyActionManager.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,116 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.jaxx.action.ActionFactoryFromProvider; +import org.codelutin.jaxx.action.ActionFactory; +import org.codelutin.commandline.demo.ui.actions.MyAbstractAction; + +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; +import javax.swing.JComboBox; + +import jaxx.runtime.JAXXObject; + +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class MyActionManager { + + private static final Log log = LogFactory.getLog(MyActionManager.class); + + /** l'usine d'actions */ + private static ActionFactory factory; + + /** + * @param ui l'ui � charger + * @return le tableau des actions instanci�es ou r�cup�r�es du cache de + * la factory + */ + public static AbstractAction[] loadActions(JAXXObject ui) { + AbstractAction[] actions; + actions = getFactory().loadActions(ui); + return actions; + + } + + /** + * Retourne (et instancie la premi�re fois l'usine d'actions) + * + * @return l'usine d'actions + * @see org.codelutin.jaxx.action.ActionFactory + */ + public static ActionFactory getFactory() { + if (factory == null) { + // used a simple factory implementation + factory = new ActionFactoryFromProvider(); + } + return factory; + } + + public static void fireAction(String actionKey, Object source) { + fireAction(actionKey, source, (AbstractButton) null); + } + + + public static AbstractAction newAction(String actionKey) { + return newAction(actionKey, (AbstractButton) null); + } + + public static void resetCache() { + getFactory().resetCache(); + } + + public static void dispose() { + resetCache(); + for (String actionKey : getFactory().getActionNames()) { + MyAbstractAction action = (MyAbstractAction) newAction(actionKey); + if (action != null) { + action.disposeUI(); + } + } + } + + + public static void fireAction(String actionKey, Object source, AbstractButton component) { + AbstractAction action = newAction(actionKey, component); + fireAction0(actionKey, source, action); + } + + public static void fireAction(String actionKey, Object source, JComboBox component) { + AbstractAction action = newAction(actionKey, component); + fireAction0(actionKey, source, action); + } + + protected static AbstractAction newAction(String actionKey, AbstractButton component) { + return getFactory().newAction(actionKey, component); + } + + protected static AbstractAction newAction(String actionKey, JComboBox component) { + return getFactory().newAction(actionKey, component); + } + + protected static void fireAction0(String actionKey, Object source, AbstractAction action) { + if (action == null) { + log.warn("could not find action " + actionKey); + return; + } + ActionEvent event = new ActionEvent(source, ActionEvent.ACTION_FIRST, actionKey); + action.actionPerformed(event); + } + +} Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyMainUI.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyMainUI.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/MyMainUI.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,107 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.commandline.demo.MyContext; +import org.codelutin.commandline.demo.MyMain; +import org.codelutin.commandline.demo.ui.actions.ChangeLocaleAction; +import org.codelutin.commandline.demo.ui.actions.MyAbstractAction; +import static org.codelutin.i18n.I18n._; + +import javax.swing.AbstractButton; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.Locale; +import java.util.regex.Matcher; + +/** @author chemit */ +public class MyMainUI extends JMainUI { + + /** log */ + private static final Log log = LogFactory.getLog(MyMainUI.class); + + public MyMainUI() { + super(); + + MyMain.checkInitContext(); + + finalizeInit(MyMain.getContext()); + + } + + protected void finalizeInit(MyContext context) { + + // chargement dans l'ui des actions + MyActionManager.loadActions(this); + + getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK), "quit"); + getRootPane().getActionMap().put("quit", MyActionManager.newAction("quit")); + + // repaint i18n actions + refreshI18nActions(context); + + } + + /** + * Rafraichit les actions i18n dans le menu en fonction de la locale + * actuellement utilis�e. + * + * @param context application context + */ + public void refreshI18nActions(MyContext context) { + + Locale locale = context.getMainConfig().getLocale(); + //CountryEnum country = context.getConfig().getUserCountry(); + String[] actions = MyActionManager.getFactory().getActionNames(); + for (String actionName : actions) { + Matcher matcher = ChangeLocaleAction.PATTERN_NAME.matcher(actionName); + if (!matcher.matches()) { + continue; + } + AbstractButton button = (AbstractButton) getObjectById(actionName); + ChangeLocaleAction action = (ChangeLocaleAction) button.getAction(); + boolean enable = !action.equalsLocale(locale); + log.debug("incoming locale : " + locale); + log.debug("load i18n action " + action + " is enable ? " + enable); + UpdateButton(button, enable, enable ? action.getLocale() : null); + button.setEnabled(enable); + } + } + + public static void DisableButton(AbstractButton... buttons) { + for (AbstractButton button : buttons) { + UpdateButton(button, false); + } + } + + public static void EnableButton(AbstractButton button, Object... params) { + UpdateButton(button, true, params); + } + + public static void UpdateButton(AbstractButton button, boolean enabled, Object... params) { + button.setEnabled(enabled); + if (!enabled) { + button.setToolTipText(null); + } else { + MyAbstractAction action = (MyAbstractAction) button.getAction(); + String t = _(action.getI18nToolTipText(), params); + button.setToolTipText(t); + } + } +} Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/AboutAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/AboutAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/AboutAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,49 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +/** + * Action pour afficher la dialogue de modification de configuration + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "about", + name = "lima.action.about", + shortDescription = "lima.action.about.tooltip", + longDescription = "lima.action.about.help", + smallIcon = "action/about.png", + mnemonic = 'a', + hideActionText = false +) +public class AboutAction extends MyAbstractAction { + private static final long serialVersionUID = 9050439968144935986L; + + + public AboutAction(String name) { + super(name); + } + + @Override + public void doAction(java.awt.event.ActionEvent e) { + log.info("To be done!"); + } + + @Override + public void disposeUI() { + super.disposeUI(); + } + +} \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ChangeLocaleAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ChangeLocaleAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ChangeLocaleAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,111 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +/** @author chemit */ + +import org.codelutin.commandline.demo.MyMain; +import static org.codelutin.i18n.I18n._; + +import javax.swing.Action; +import java.awt.event.ActionEvent; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Une action pour recharger la locale. + * <p/> + * Le nom de l'action doit etre de la forme i18n_XX_YY o� XX est la langue + * et YY le pays de la locale � charger. + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "changeLocale", + shortDescription = "lima.action.changeLocale.tooltip", + longDescription = "lima.action.changeLocale.help", + hideActionText = false, + multiNames = {"i18n_fr", "i18n_en"} +) +@org.codelutin.i18n.I18nable +public class ChangeLocaleAction extends MyAbstractAction { + + public static final Pattern PATTERN_NAME = Pattern.compile("i18n_(\\w\\w)"); + + protected Locale locale; + + private static final long serialVersionUID = 4180668477670765253L; + + public ChangeLocaleAction(String name) { + super(name); + Matcher matcher = PATTERN_NAME.matcher(name); + if (!matcher.matches()) { + throw new IllegalArgumentException(_(getClass().getName() + " should have a name like this 'i18n_XX', but was {0}", name)); + } + + locale = org.codelutin.i18n.I18n.newLocale(matcher.group(1)); + + //putValue(Action.NAME, _(locale.getLibelle())); + //TODO Make it works again :) + putValue(Action.NAME, _(locale.getDisplayLanguage())); + putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(getIcon())); + } + + @Override + public String getI18nToolTipText() { + return "lima.action.changeLocale.tooltip"; + } + + public String getIcon() { + return "action/i18n-" + locale.getLanguage() + ".png"; + } + + @Override + protected boolean beforeAction(ActionEvent e) throws Exception { + return true; + //TODO Faut-il proposer une confirmation ? + //String s = _(locale.getLibelle()); + //int result = JOptionPane.showConfirmDialog(null, _("lima.confirm.changeLanguage", s), "changeLanguage", JOptionPane.YES_NO_OPTION); + //return result == JOptionPane.OK_OPTION; + } + + @Override + public void doAction(ActionEvent e) { + + getContext().getMainConfig().setLocale(locale); + // on doit initialiser la nouvelle locale avant de decharger les ui + // au cas ou un appel � une ui surviendrait et dans quel cas la locale + // serait toujours sur l'ancienne valeur ... + getContext().initI18n(); + // save config + getContext().saveSafely(); + // dispose then reload main ui + MyMain.dispose(true); + } + + @Override + public String toString() { + return super.toString() + " Locale " + locale; + } + + public boolean equalsLocale(Locale locale) { + return this.locale.equals(locale) || this.locale.getLanguage().equals(locale.getLanguage()); + } + + public Locale getLocale() { + return locale; + } +} \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ConfigAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ConfigAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/ConfigAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,64 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +import org.codelutin.option.ui.ConfigUI; + + +/** + * Action pour afficher la dialogue de modification de configuration + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "config", + name = "lima.action.config", + shortDescription = "lima.action.config.tooltip", + longDescription = "lima.action.config.help", + smallIcon = "action/config.png", + mnemonic = 'P', + hideActionText = false +) +public class ConfigAction extends MyAbstractAction { + + ConfigUI ui; + + private static final long serialVersionUID = 1449553547444065616L; + + public ConfigAction(String name) { + super(name); + } + + @Override + public void doAction(java.awt.event.ActionEvent e) { + getUi().setVisible(true); + } + + @Override + public void disposeUI() { + super.disposeUI(); + if (ui != null) { + ui.dispose(); + ui = null; + } + } + + public ConfigUI getUi() { + if (ui == null) { + ui = new ConfigUI().init(getContext(), getContext().getMainConfig(), getContext().getRemoteConfig()); + } + return ui; + } +} \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/HelpAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/HelpAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/HelpAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,50 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +/** + * Action pour afficher la dialogue de modification de configuration + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "help", + name = "lima.action.help", + shortDescription = "lima.action.help.tooltip", + longDescription = "lima.action.help.help", + smallIcon = "action/help.png", + mnemonic = 'h', + hideActionText = false +) +public class HelpAction extends MyAbstractAction { + private static final long serialVersionUID = 9050439968144935986L; + + + public HelpAction(String name) { + super(name); + } + + @Override + public void doAction(java.awt.event.ActionEvent e) { + log.info("To be done!"); + } + + @Override + public void disposeUI() { + super.disposeUI(); + } + + +} \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/MyAbstractAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/MyAbstractAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/MyAbstractAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,112 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +import jaxx.runtime.JAXXObject; +import org.apache.commons.logging.LogFactory; +import org.codelutin.commandline.demo.MyContext; +import org.codelutin.commandline.demo.MyMain; + +import javax.swing.AbstractAction; +import javax.swing.JComponent; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public abstract class MyAbstractAction extends AbstractAction { + + static org.apache.commons.logging.Log log = LogFactory.getLog(MyAbstractAction.class); + + private static final long serialVersionUID = -810023044364620841L; + + protected ActionEvent e; + + public void actionPerformed(java.awt.event.ActionEvent e) { + + log.debug("------------------------------------------------------------"); + log.debug("event : " + e); + log.debug("source : " + e.getSource()); + this.e = e; + try { + boolean accepted = beforeAction(e); + log.debug("action : " + this); + if (accepted) { + log.info(getActionName() + " (treate:" + accepted + ") : " + this); + } else { + log.debug(getActionName() + " (treate:" + accepted + ") : " + this); + } + if (accepted) { + doAction(e); + updateUI(); + } + } catch (Exception e1) { + showError(e1); + } finally { + this.e = null; + // always clear action after use : actions are staless + clear(); + } + } + + protected String getActionName() { + return (String) getValue(ACTION_COMMAND_KEY); + } + + protected boolean beforeAction(ActionEvent e) throws Exception { + return isEnabled(); + } + + protected JComponent getUIObject(String name, JAXXObject container) { + if (container == null) { + return null; + } + return (JComponent) container.getObjectById(name); + } + + public String getI18nToolTipText() { + return "commandlinedemo.action." + getActionName() + ".tooltip"; + } + + protected void doAction(ActionEvent e) throws Exception { + // nothing by default + } + + public void updateUI() { + // nothing by default + } + + public void disposeUI() { + // nothing by default + } + + protected void clear() { + // nothing by default + } + + + protected void showError(Exception e) { + log.error(e); + } + + protected MyAbstractAction(String name) { + super(name); + log.debug("> " + this); + } + + protected MyContext getContext() { + return MyMain.getContext(); + } + + +} Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/QuitAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/QuitAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/QuitAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,81 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +import static org.codelutin.i18n.I18n._; +import org.codelutin.commandline.demo.MyMain; + +import javax.swing.JOptionPane; +import java.awt.event.ActionEvent; + + +/** + * Action pour afficher la dialogue de modification de configuration + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "quit", + name = "lima.action.quit", + shortDescription = "lima.action.quit.tooltip", + longDescription = "lima.action.quit.help", + smallIcon = "action/quit.png", + mnemonic = 'q', + hideActionText = false +) +public class QuitAction extends MyAbstractAction { + private static final long serialVersionUID = 9050439968144935986L; + + + public QuitAction(String name) { + super(name); + } + + protected boolean beforeAction(ActionEvent e) throws Exception { + + boolean result = super.beforeAction(e); + + if (result) { + String[] response = {_("lima.yes"), _("lima.no")}; + int n = JOptionPane.showOptionDialog(null, + _("lima.close_question"), + _("lima.question"), + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, //do not use a custom Icon + response, //the titles of buttons + response[1]); //default button title + + result = n == JOptionPane.YES_OPTION; + + } + + return result; + + + } + + @Override + public void doAction(java.awt.event.ActionEvent e) { + MyMain.dispose(false); + } + + @Override + public void disposeUI() { + super.disposeUI(); + } + + +} \ No newline at end of file Added: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/SiteAction.java =================================================================== --- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/SiteAction.java (rev 0) +++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/SiteAction.java 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,59 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.commandline.demo.ui.actions; + +import java.awt.Desktop; +import java.awt.event.ActionEvent; +import java.net.URL; + + +/** + * Action pour afficher la dialogue de modification de configuration + * + * @author Code Lutin, Chemit Tony + */ +@org.codelutin.jaxx.action.ActionConfig( + actionCommand = "site", + name = "lima.action.site", + shortDescription = "lima.action.site.tooltip", + longDescription = "lima.action.site.help", + smallIcon = "action/site.png", + mnemonic = 's', + hideActionText = false +) +public class SiteAction extends MyAbstractAction { + private static final long serialVersionUID = 9050439968144935986L; + + protected URL siteUrl; + + public SiteAction(String name) { + super(name); + } + + protected boolean beforeAction(ActionEvent e) throws Exception { + if (!super.beforeAction(e) && !Desktop.isDesktopSupported() && !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + return false; + } + siteUrl = getContext().getMainConfig().getSiteURL(); + return siteUrl != null; + } + + @Override + public void doAction(java.awt.event.ActionEvent e) throws Exception { + super.doAction(e); + Desktop.getDesktop().browse(siteUrl.toURI()); + } + +} \ No newline at end of file Modified: trunk/commandline/commandline-demo/src/main/resources/commandline.properties =================================================================== --- trunk/commandline/commandline-demo/src/main/resources/commandline.properties 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/src/main/resources/commandline.properties 2008-07-23 15:34:33 UTC (rev 891) @@ -16,7 +16,7 @@ main.config.definition.debugMode=java.lang.Boolean:false main.config.modifiers.debugMode=mandatory -main.config.definition.siteURL=java.net.URL:http://lima.labs.libre-entreprise.org +main.config.definition.siteURL=java.net.URL:http://commandline.labs.libre-entreprise.org main.config.modifiers.siteURL=final,static,mandatory ### Modified: trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties =================================================================== --- trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties 2008-07-23 15:34:33 UTC (rev 891) @@ -1,27 +1,53 @@ -#Wed Jul 23 13:41:57 CEST 2008 -commandlinedemo.config.main.configFileName.description=commandlinedemo.config.main.configFileName.description -commandlinedemo.config.main.debugMode.description=commandlinedemo.config.main.debugMode.description -commandlinedemo.config.main.description=commandlinedemo.config.main.description -commandlinedemo.config.main.encoding.description=commandlinedemo.config.main.encoding.description -commandlinedemo.config.main.locale.description=commandlinedemo.config.main.locale.description -commandlinedemo.config.main.projectName.description=commandlinedemo.config.main.projectName.description -commandlinedemo.config.main.siteURL.description=commandlinedemo.config.main.siteURL.description -commandlinedemo.config.main.userFirstName.description=commandlinedemo.config.main.userFirstName.description -commandlinedemo.config.main.userLastName.description=commandlinedemo.config.main.userLastName.description -commandlinedemo.config.main.userMail.description=commandlinedemo.config.main.userMail.description -commandlinedemo.config.main.version.description=commandlinedemo.config.main.version.description -commandlinedemo.config.remote.URI.description=commandlinedemo.config.remote.URI.description -commandlinedemo.config.remote.description=commandlinedemo.config.remote.description -commandlinedemo.config.remote.login.description=commandlinedemo.config.remote.login.description -commandlinedemo.config.remote.password.description=commandlinedemo.config.remote.password.description -commandlinedemo.config.remote.proxyLogin.description=commandlinedemo.config.remote.proxyLogin.description -commandlinedemo.config.remote.proxyPassword.description=commandlinedemo.config.remote.proxyPassword.description -commandlinedemo.config.remote.useProxy.description=commandlinedemo.config.remote.useProxy.description -commandlinedemo.option.description.changeConfig=commandlinedemo.option.description.changeConfig -commandlinedemo.option.description.changeFileConfig=commandlinedemo.option.description.changeFileConfig -commandlinedemo.option.description.editConfig=commandlinedemo.option.description.editConfig -commandlinedemo.option.description.help=commandlinedemo.option.description.help -commandlinedemo.option.description.helpConfig=commandlinedemo.option.description.helpConfig -commandlinedemo.option.description.resetConfig=commandlinedemo.option.description.resetConfig -commandlinedemo.option.description.showConfig=commandlinedemo.option.description.showConfig -commandlinedemo.option.description.ui=commandlinedemo.option.description.ui +commandlinedemo.config.main.configFileName.description= +commandlinedemo.config.main.debugMode.description= +commandlinedemo.config.main.description= +commandlinedemo.config.main.encoding.description= +commandlinedemo.config.main.locale.description= +commandlinedemo.config.main.projectName.description= +commandlinedemo.config.main.siteURL.description= +commandlinedemo.config.main.userFirstName.description= +commandlinedemo.config.main.userLastName.description= +commandlinedemo.config.main.userMail.description= +commandlinedemo.config.main.version.description= +commandlinedemo.config.remote.URI.description= +commandlinedemo.config.remote.description= +commandlinedemo.config.remote.login.description= +commandlinedemo.config.remote.password.description= +commandlinedemo.config.remote.proxyLogin.description= +commandlinedemo.config.remote.proxyPassword.description= +commandlinedemo.config.remote.useProxy.description= +commandlinedemo.option.description.changeConfig= +commandlinedemo.option.description.changeFileConfig= +commandlinedemo.option.description.editConfig= +commandlinedemo.option.description.help= +commandlinedemo.option.description.helpConfig= +commandlinedemo.option.description.resetConfig= +commandlinedemo.option.description.showConfig= +commandlinedemo.option.description.ui= +lima.action.about= +lima.action.about.help= +lima.action.about.tooltip= +lima.action.changeLocale.help= +lima.action.changeLocale.tooltip= +lima.action.config= +lima.action.config.help= +lima.action.config.tooltip= +lima.action.help= +lima.action.help.help= +lima.action.help.tooltip= +lima.action.quit= +lima.action.quit.help= +lima.action.quit.tooltip= +lima.action.site= +lima.action.site.help= +lima.action.site.tooltip= +lima.close_question= +lima.confirm.changeLanguage= +lima.no= +lima.question= +lima.yes= +mainui.menu.edit= +mainui.menu.file= +mainui.menu.help= +mainui.menu.help.i18n= +mainui.title= Modified: trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties =================================================================== --- trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties 2008-07-23 15:34:33 UTC (rev 891) @@ -24,3 +24,30 @@ commandlinedemo.option.description.resetConfig= commandlinedemo.option.description.showConfig= commandlinedemo.option.description.ui= +lima.action.about= +lima.action.about.help= +lima.action.about.tooltip= +lima.action.changeLocale.help= +lima.action.changeLocale.tooltip= +lima.action.config= +lima.action.config.help= +lima.action.config.tooltip= +lima.action.help= +lima.action.help.help= +lima.action.help.tooltip= +lima.action.quit= +lima.action.quit.help= +lima.action.quit.tooltip= +lima.action.site= +lima.action.site.help= +lima.action.site.tooltip= +lima.close_question= +lima.confirm.changeLanguage= +lima.no= +lima.question= +lima.yes= +mainui.menu.edit= +mainui.menu.file= +mainui.menu.help= +mainui.menu.help.i18n= +mainui.title= Added: trunk/commandline/commandline-demo/src/main/resources/log4j.properties =================================================================== --- trunk/commandline/commandline-demo/src/main/resources/log4j.properties (rev 0) +++ trunk/commandline/commandline-demo/src/main/resources/log4j.properties 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,11 @@ +# Global logging configuration +log4j.rootLogger=ERROR, file +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.file=demo.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +# package level +log4j.logger.org.codelutin.commandline=INFO +log4j.logger.org.codelutin.option=INFO +#log4j.logger.org.codelutin=INFO Added: trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JMainUI.jaxx =================================================================== --- trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JMainUI.jaxx (rev 0) +++ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JMainUI.jaxx 2008-07-23 15:34:33 UTC (rev 891) @@ -0,0 +1,34 @@ +<JFrame title="mainui.title" width="1024" height="768" defaultCloseOperation="dispose_on_close"> + <JMenuBar> + <JMenu text="mainui.menu.file"> + <JMenuItem id="quit"/> + </JMenu> + <JMenu text="mainui.menu.edit"> + <JMenuItem id="config"/> + </JMenu> + <JMenu text="mainui.menu.help" mnemonic="{'H'}"> + <JMenuItem id="help"/> + <JMenuItem id="site"/> + <JMenuItem id="about"/> + <JMenu text='mainui.menu.help.i18n' mnemonic="{'L'}" + icon='{createImageIcon("action/translate.png")}'> + <JMenuItem id="i18n_fr"/> + <JMenuItem id="i18n_en"/> + </JMenu> + </JMenu> + </JMenuBar> + <Table insets='0,0,0,0'> + <!-- le panel principal à surcharger selon le context --> + <row fill="both" weightx="1" weighty="1"> + <cell> + <JTabbedPane id="contentTabbedPane"/> + </cell> + </row> + <!-- la barre de status --> + <row> + <cell fill="both"> + <org.codelutin.widget.StatusBar id='statusBar'/> + </cell> + </row> + </Table> +</JFrame> \ No newline at end of file Modified: trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst =================================================================== --- trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst 2008-07-23 15:34:33 UTC (rev 891) @@ -62,7 +62,7 @@ commandlinedemo.config.main.projectName.description -#. siteURL (URL) <defaultValue:http://lima.labs.libre-entreprise.org> +#. siteURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org> commandlinedemo.config.main.siteURL.description Modified: trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst =================================================================== --- trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst 2008-07-23 15:33:57 UTC (rev 890) +++ trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst 2008-07-23 15:34:33 UTC (rev 891) @@ -62,7 +62,7 @@ commandlinedemo.config.main.projectName.description -#. siteURL (URL) <defaultValue:http://lima.labs.libre-entreprise.org> +#. siteURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org> commandlinedemo.config.main.siteURL.description
participants (1)
-
tchemit@users.labs.libre-entreprise.org