This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 56fdd488dbc233b71e28d28f22680f7ff8e8761c Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 16:44:44 2009 +0000 - add a contract NavigationContentUI and use it in NavigationTreeHandler - improve demo --- jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java | 9 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 12 ++- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 2 +- .../jaxx/navigation/FullNavigationTreeDemo.jaxx | 4 +- .../jaxx/navigation/FullNavigationTreeHelper.java | 87 ++------------- .../navigation/FullNavigationTreeModelBuilder.java | 120 +++++++++++++++++++++ .../ActorContentUI.jaxx} | 20 +++- .../jaxx/navigation/content/ActorsContentUI.jaxx | 88 +++++++++++++++ .../MovieContentUI.jaxx} | 20 +++- .../jaxx/navigation/content/MoviesContentUI.jaxx | 86 +++++++++++++++ .../main/resources/i18n/jaxx-demo-en_GB.properties | 5 + .../main/resources/i18n/jaxx-demo-fr_FR.properties | 5 + 12 files changed, 360 insertions(+), 98 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java index 996df37..53efae0 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java @@ -26,6 +26,7 @@ import java.beans.PropertyChangeListener; import java.util.Locale; import java.util.Properties; +import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -110,6 +111,11 @@ public class DemoConfig extends org.nuiton.util.ApplicationConfig { return result; } + public String getDemoPath() { + String result = getOption(Option.DEMO_PATH.key); + return result; + } + public void setFullscreen(boolean fullscreen) { Object oldValue = null; setOption(Option.FULL_SCREEN.key, fullscreen + ""); @@ -159,7 +165,8 @@ public class DemoConfig extends org.nuiton.util.ApplicationConfig { CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true), FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false), - LOCALE("ui.locale", _("jaxxdemo.config.ui.locale"), Locale.FRANCE.toString(), Locale.class, false, false); + LOCALE("ui.locale", _("jaxxdemo.config.ui.locale"), Locale.FRANCE.toString(), Locale.class, false, false), + DEMO_PATH("ui.demo.path", _("jaxxdemo.config.ui.demo.path"), "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(), String.class, false, false); public final String key; public final String description; public final String defaultValue; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 85a20ff..7cd25b6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -93,7 +93,7 @@ public class DemoUIHandler { //implements JAXXHelp { return ui; } - public void displayUI(final DemoUI ui, final NavigationTreeNode node) { + public void displayUI(final DemoUI ui, final String nodePath) { // expend all nodes of the demo tree jaxx.runtime.SwingUtil.expandTree(ui.getNavigation()); @@ -104,12 +104,12 @@ public class DemoUIHandler { //implements JAXXHelp { public void run() { String path; - if (node == null) { + if (nodePath == null) { // take first node path = "$root/jaxxdemo.tree.component.swing"; } else { // take selected node - path = node.getFullPath(); + path = nodePath; } log.info("node to re select " + path); // select node @@ -146,6 +146,7 @@ public class DemoUIHandler { //implements JAXXHelp { DemoUI ui = getUI(rootContext); NavigationTreeNode node = null; + String nodePath = null; if (ui != null) { @@ -154,7 +155,8 @@ public class DemoUIHandler { //implements JAXXHelp { node = ui.getTreeHelper().getSelectedNode(ui); if (node != null) { - log.info("selected node " + node.getFullPath()); + nodePath = node.getFullPath(); + log.info("selected node " + nodePath); } ErrorDialogUI.init(null); @@ -169,7 +171,7 @@ public class DemoUIHandler { //implements JAXXHelp { ui = initUI(rootContext, fullscreen); - displayUI(ui, node); + displayUI(ui, nodePath); } /** diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index f1c1ede..43ad5b5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -119,7 +119,7 @@ public class RunDemo { log.info(_("jaxxdemo.init.ui.done")); - handler.displayUI(ui, null); + handler.displayUI(ui, config.getDemoPath()); } catch (Exception e) { ErrorDialogUI.showError(e); diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index ea83673..3a3f4d3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -28,12 +28,12 @@ import jaxx.runtime.SwingUtil; private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - +setContextValue(helper); helper.createModel(this); @Override protected String[] getSources() { - return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; + return new String[]{ getDefaultSource(), "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; } private void $afterCompleteSetup() { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index 37cc85a..9b8d6f3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -23,7 +23,6 @@ package jaxx.demo.component.jaxx.navigation; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; -import jaxx.runtime.decorator.Decorator; import jaxx.runtime.decorator.DecoratorUtils; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; @@ -31,13 +30,10 @@ import jaxx.runtime.swing.navigation.NavigationTreeHandler; import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; import jaxx.runtime.swing.navigation.NavigationTreeHelper; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationTreeModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; import java.util.Arrays; import java.util.List; @@ -74,6 +70,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { * where the actors are hold in context */ static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors"); + protected FullNavigationTreeModelBuilder builder; public FullNavigationTreeHelper() { super("full"); @@ -85,6 +82,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { * @param context the context where to hold the model */ public void createModel(JAXXContext context) { + log.info("for " + this); People a = new People("0", "Jack", "Black", 0, "/jaxx/demo/images/jack.jpg"); People a2 = new People("1", "Héctor", "Jiménez", 0, "/jaxx/demo/images/hector.jpg"); People a3 = new People("2", "Ana", "de la Reguera", 0, "/jaxx/demo/images/ana.jpg"); @@ -105,87 +103,14 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { @Override public NavigationTreeModel createTreeModel(JAXXContext context) { - List<Movie> movies = MOVIES.getContextValue(context); - List<People> actors = ACTORS.getContextValue(context); - - if (log.isDebugEnabled()) { - log.debug("for " + movies.size() + " movie(s)"); + if (builder == null) { + builder = new FullNavigationTreeModelBuilder(context); } - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/", context, BaseContent.class, - null); - - Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); - Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); - - // construction du noeud root - // il ne contient pas de context et ne sera pas visible - NavigationTreeNode rootNode = builder.buildEmptyRoot(null, "$root"); - - // construction du noeud avec les films recupere la liste des films - // dans le context avec la clef movies - // navigation path = $root/movies - NavigationTreeNode moviesNode = builder.build( - rootNode, - _("movies"), - MOVIES, - "movies", - null, - null); - - for (Movie m : movies) { - - // navigation path = $root/movies/m.id - NavigationTreeNode movieNode = builder.build( - moviesNode, - mDecorator, - "..[@id=\"" + m.getId() + "\"]", - m.getId(), - null, - null); - - // navigation path = $root/movies/m.id/actors - NavigationTreeNode actorsNode = builder.build( - movieNode, - _("actors"), - "../actors", - "actors", - null, - null); - - for (People p : m.getActors()) { - // navigation path = $root/movies/m.id/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - } + builder.createInitialModel(); - // construction du noeud avec les acteurs - NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), - ACTORS, - "actors", null, null); - - for (People p : actors) { - // navigation path = $root/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } NavigationTreeModel model = builder.getModel(); - if (log.isDebugEnabled()) { - builder.printModel(model.getRoot()); - } - // save tree model in context setTreeModel(context, model); return model; @@ -203,7 +128,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { handler = new NavigationTreeHandlerWithCardLayout( getPrefix(), context, - Strategy.PER_NODE) { + Strategy.PER_UI_TYPE) { private static final long serialVersionUID = 1L; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java new file mode 100644 index 0000000..acfeb84 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java @@ -0,0 +1,120 @@ +package jaxx.demo.component.jaxx.navigation; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import jaxx.demo.component.jaxx.navigation.content.*; +import static org.nuiton.i18n.I18n._; + +import java.util.List; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class FullNavigationTreeModelBuilder extends NavigationTreeModelBuilder { + + private static final long serialVersionUID = 1l; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(FullNavigationTreeModelBuilder.class); + + protected FullNavigationTreeModelBuilder(JAXXContext context) { + super("/", context, null, null); + } + + public void addMovie(Movie movie) { + //TODO + } + + public void addActor(People people,Movie... movies) { + //TODO + } + + public void createInitialModel() { + + List<Movie> movies = FullNavigationTreeHelper.MOVIES.getContextValue(getModel().getContext()); + List<People> actors = FullNavigationTreeHelper.ACTORS.getContextValue(getModel().getContext()); + + if (log.isDebugEnabled()) { + log.debug("for " + movies.size() + " movie(s)"); + } + + + Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); + Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); + + // construction du noeud root + // il ne contient pas de context et ne sera pas visible + NavigationTreeNode rootNode = this.buildEmptyRoot(null, "$root"); + + // construction du noeud avec les films recupere la liste des films + // dans le context avec la clef movies + // navigation path = $root/movies + NavigationTreeNode moviesNode = this.build( + rootNode, + _("movies"), + FullNavigationTreeHelper.MOVIES, + "movies", + MoviesContentUI.class, + null); + + for (Movie m : movies) { + + // navigation path = $root/movies/m.id + NavigationTreeNode movieNode = this.build( + moviesNode, + mDecorator, + "..[@id=\"" + m.getId() + "\"]", + m.getId(), + MovieContentUI.class, + null); + + // navigation path = $root/movies/m.id/actors + NavigationTreeNode actorsNode = this.build( + movieNode, + _("actors"), + "../actors", + "actors", + ActorsContentUI.class, + null); + + for (People p : m.getActors()) { + // navigation path = $root/movies/m.id/actors/p.id + this.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + ActorContentUI.class, + null); + } + } + + // construction du noeud avec les acteurs + NavigationTreeNode actorsNode = this.build(rootNode, _("actors"), + FullNavigationTreeHelper.ACTORS, + "actors", ActorsContentUI.class, null); + + for (People p : actors) { + // navigation path = $root/actors/p.id + this.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + ActorContentUI.class, + null); + } + + if (log.isDebugEnabled()) { + printModel(getModel().getRoot()); + } + } +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx similarity index 82% copy from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx copy to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx index bf9496c..9e04cf5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx @@ -18,14 +18,24 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> <script><![CDATA[ import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.demo.component.jaxx.navigation.*; -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); +@Override +public void openUI(NavigationTreeNode node) throws Exception { + People p = (People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected people = "+p); + setData(p); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} String getType(Object data) { if (data == null) { @@ -71,6 +81,8 @@ ImageIcon getImage(Object data) { ]]> </script> + <People id='data' javaBean='(People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' resizeWeight='0.5' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx new file mode 100644 index 0000000..67e20f1 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -0,0 +1,88 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.*; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.navigation.NavigationTreeNode; + +@Override +public void openUI(NavigationTreeNode node) throws Exception { + java.util.List<People> ps = (java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected peoples = "+ps.size()); + setData(ps); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} + +String getType(Object data) { + if (data == null) { + return "no type"; + } + if (data instanceof java.util.List<?>) { + java.util.List<?> l = (java.util.List<?>) data; + if (l.isEmpty()) { + return "Empty collection"; + } + return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; + } + return data.getClass().getSimpleName(); +} + +ListModel getModel(java.util.List<People> data) { + + DefaultListModel model = new DefaultListModel(); + for (People m : data) { + model.addElement(m); + } + return model; +} + + ]]> + </script> + + <java.util.List id='data' + genericType='People' + javaBean='(java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + + <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/> + </JScrollPane> + <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' + floatable='false'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx similarity index 82% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx index bf9496c..fab8195 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx @@ -18,14 +18,24 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> <script><![CDATA[ import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.demo.component.jaxx.navigation.*; -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); +@Override +public void openUI(NavigationTreeNode node) throws Exception { + Movie m = (Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected movie = "+m); + setData(m); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} String getType(Object data) { if (data == null) { @@ -71,6 +81,8 @@ ImageIcon getImage(Object data) { ]]> </script> + <Movie id='data' javaBean='(Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' resizeWeight='0.5' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx new file mode 100644 index 0000000..d6fcded --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -0,0 +1,86 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.*; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.navigation.NavigationTreeNode; + +@Override +public void openUI(NavigationTreeNode node) throws Exception { + java.util.List<Movie> ms = (java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected movies = "+ms.size()); + setData(ms); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} +String getType(Object data) { + if (data == null) { + return "no type"; + } + if (data instanceof java.util.List<?>) { + java.util.List<?> l = (java.util.List<?>) data; + if (l.isEmpty()) { + return "Empty collection"; + } + return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; + } + return data.getClass().getSimpleName(); +} + +ListModel getModel(java.util.List<Movie> data) { + DefaultListModel model = new DefaultListModel(); + for (Movie m : data) { + model.addElement(m); + } + return model; +} + + ]]> + </script> + + <java.util.List id='data' + genericType='Movie' + javaBean='(java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + + <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/> + </JScrollPane> + <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' + floatable='false'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 2aa6120..9729737 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -117,6 +117,7 @@ i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>. jaxxdemo.action.about=About... jaxxdemo.action.about.tip=About JAXXDemo... +jaxxdemo.action.add= jaxxdemo.action.configuration=Preferences jaxxdemo.action.configuration.tip=Change the preferences of the application jaxxdemo.action.exit=Quit @@ -131,6 +132,8 @@ jaxxdemo.action.locale.uk=English jaxxdemo.action.locale.uk.tip=Change to english language jaxxdemo.action.normalscreen=Normal screen jaxxdemo.action.normalscreen.tip=Change to normal screen mode +jaxxdemo.action.remove= +jaxxdemo.action.show= jaxxdemo.action.site=Web site jaxxdemo.action.site.tip=Go to the web site jaxxdemo.config.category.directories=Files @@ -138,6 +141,7 @@ jaxxdemo.config.category.directories.description=Files used by application jaxxdemo.config.category.other=Others jaxxdemo.config.category.other.description=Others preferences jaxxdemo.config.configFileName.description=Configuration file name +jaxxdemo.config.ui.demo.path= jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen) jaxxdemo.config.ui.locale=Locale of the application jaxxdemo.i18neditor.configuration=Configuration @@ -189,5 +193,6 @@ numbereditor.positive.int=Positive integer numbereditor.type=Type numbereditor.with.auto.popup=With auto popup numbereditor.without.auto.popup=Without auto popup +test= valid= x= diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index ffe9202..418d14c 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -117,6 +117,7 @@ i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... +jaxxdemo.action.add= jaxxdemo.action.configuration=Configuration jaxxdemo.action.configuration.tip=Modifier la configuration jaxxdemo.action.exit=Quitter @@ -131,6 +132,8 @@ jaxxdemo.action.locale.uk=Anglais jaxxdemo.action.locale.uk.tip=Changer la langue en anglais jaxxdemo.action.normalscreen=Ecran normal jaxxdemo.action.normalscreen.tip=Revenir en mode normal +jaxxdemo.action.remove= +jaxxdemo.action.show= jaxxdemo.action.site=Site internet jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet jaxxdemo.config.category.directories=R\u00E9pertoires @@ -138,6 +141,7 @@ jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'applicati jaxxdemo.config.category.other=Autre jaxxdemo.config.category.other.description=Autres options jaxxdemo.config.configFileName.description=Le nom du fichier de configuration +jaxxdemo.config.ui.demo.path= jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran jaxxdemo.config.ui.locale=Langue utilis\u00E9e par l'application (fr_FR, en_GB ou es_ES) jaxxdemo.i18neditor.configuration=Configuration @@ -189,5 +193,6 @@ numbereditor.positive.int=Entier primitif positif \: [%1$s] numbereditor.type=Type d'\u00E9diteur numbereditor.with.auto.popup=Avec popup auto numbereditor.without.auto.popup=Sans popup auto +test= valid=valide x=x -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.