Author: sletellier Date: 2010-06-09 15:08:53 +0200 (Wed, 09 Jun 2010) New Revision: 1960 Url: http://nuiton.org/repositories/revision/jaxx/1960 Log: - Update headers - Add comments - Refactor ui comportement Added: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoCellRenderer.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoDataProvider.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoHelper.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoNode.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/ActorsNodeLoadors.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/MoviesNodeLoadors.java Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,29 +1,27 @@ <!-- #%L JAXX :: Demo - $Id: FullNavigationTreeDemo.jaxx 1861 2010-04-29 14:16:39Z tchemit $ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ %% Copyright (C) 2008 - 2010 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 + 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 + + 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>. #L% --> - <jaxx.demo.DemoPanel> <CardLayout2 id='contentLayout'/> @@ -38,6 +36,8 @@ import jaxx.demo.entities.Movie; import jaxx.demo.entities.People; import javax.swing.tree.TreePath; +import java.lang.reflect.Constructor; +import jaxx.demo.component.jaxx.tree.content.ContentUI; private JaxxTreeDemoDataProvider dataProvider = new JaxxTreeDemoDataProvider(); private JaxxTreeDemoHelper helper = new JaxxTreeDemoHelper(dataProvider); @@ -56,6 +56,7 @@ private void $afterCompleteSetup() { setContextValue(helper); + // Creation of selection listener to open ui when tree selection change TreeSelectionListener selectionListener = new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent event) { @@ -76,8 +77,11 @@ // Register decorator DecoratorProvider decoratorProvider = getContextValue(DecoratorProvider.class); + + // Attach renderer navigation.setCellRenderer(new JaxxTreeDemoCellRenderer(decoratorProvider, dataProvider)); + // Register tree helper.setTree(navigation, true, selectionListener); SwingUtilities.invokeLater(new Runnable() { @@ -108,56 +112,59 @@ // Actors categorie node if (JaxxTreeDemoHelper.ACTORS_CATEGORY_NODE.equals(id)) { - java.util.List<People> peopleList = dataProvider.getPeoples(); - ActorsContentUI ui = getContentIfExist(ActorsContentUI.class); - String contentName = ActorsContentUI.class.getName(); - if (ui == null) { - ui = new ActorsContentUI(this); - content.add(ui, contentName); - } - ui.setData(peopleList); - contentLayout.show(content, contentName); + java.util.List<People> peoples = dataProvider.getPeoples(); + showUI(peoples, ActorsContentUI.class); // Movies categorie node } else if (JaxxTreeDemoHelper.MOVIES_CATEGORY_NODE.equals(id)) { - java.util.List<Movie> movieList = dataProvider.getMovies(); - MoviesContentUI ui = getContentIfExist(MoviesContentUI.class); - String contentName = MoviesContentUI.class.getName(); - if (ui == null) { - ui = new MoviesContentUI(this); - content.add(ui, contentName); - } - ui.setData(movieList); - contentLayout.show(content, contentName); + java.util.List<Movie> movies = dataProvider.getMovies(); + showUI(movies, MoviesContentUI.class); } // People node } else if (editType.equals(People.class)) { People people = dataProvider.getPeople(id); + showUI(people, ActorContentUI.class); - ActorContentUI ui = getContentIfExist(ActorContentUI.class); - String contentName = ActorContentUI.class.getName(); - if (ui == null) { - ui = new ActorContentUI(this); - content.add(ui, contentName); - } - ui.setData(people); - contentLayout.show(content, contentName); - // Movie node } else if (editType.equals(Movie.class)) { Movie movie = dataProvider.getMovie(id); + showUI(movie, MovieContentUI.class); + } +} - MovieContentUI ui = getContentIfExist(MovieContentUI.class); - String contentName = MovieContentUI.class.getName(); - if (ui == null) { - ui = new MovieContentUI(this); - content.add(ui, contentName); +// Create by introspection content ui +protected <B> void showUI(B bean, Class<? extends ContentUI> uiClass) { + + // Verify if instance is existing + ContentUI ui = getContentIfExist(uiClass); + + // Get layout identifier + String contentName = uiClass.getName(); + + if (ui == null) { + try { + // Get constructor + Constructor<? extends ContentUI> constructor = + uiClass.getConstructor(JAXXContext.class); + + // Invoke instance creation + ui = constructor.newInstance(this); + } catch (Exception eee) { + log.error(eee); + ErrorDialogUI.showError(eee); } - ui.setData(movie); - contentLayout.show(content, contentName); + + // Add to content panel + content.add(ui, contentName); } + + // Attach bean + ui.setData(bean); + + // show ui + contentLayout.show(content, contentName); } // Get content if exist in content, else return null Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoCellRenderer.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoCellRenderer.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoCellRenderer.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,28 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ + package jaxx.demo.component.jaxx.tree; import jaxx.demo.entities.Movie; @@ -42,6 +67,7 @@ Object toDecorate = null; + // People node if (editType.equals(People.class)) { toDecorate = getDataProvider().getPeople(id); Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoDataProvider.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoDataProvider.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoDataProvider.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,28 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ + package jaxx.demo.component.jaxx.tree; import jaxx.demo.entities.Movie; @@ -80,7 +105,9 @@ public List<People> getPeoples(String moviesId){ - log.info("Get people for movie " + moviesId); + if (log.isDebugEnabled()) { + log.debug("Get people for movie " + moviesId); + } return movies.get(moviesId).getActors(); } Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoHelper.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoHelper.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoHelper.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,27 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ package jaxx.demo.component.jaxx.tree; @@ -26,6 +50,7 @@ public TreeModel createTreeModel() { + // Create root static node JaxxTreeDemoNode root = new JaxxTreeDemoNode( String.class, "Root node", @@ -33,6 +58,7 @@ null ); + // Create movies category node JaxxTreeDemoNode moviesCategoryNode = new JaxxTreeDemoNode( String.class, n_(MOVIES_CATEGORY_NODE), @@ -40,6 +66,7 @@ new MoviesNodeLoadors() ); + // Create peoples category node JaxxTreeDemoNode peoplesCategoryNode = new JaxxTreeDemoNode( String.class, n_(ACTORS_CATEGORY_NODE), @@ -47,16 +74,21 @@ new ActorsNodeLoadors() ); + // Add to root root.add(moviesCategoryNode); root.add(peoplesCategoryNode); + // Create model DefaultTreeModel model = getModel(); if (model == null) { model = createModel(root); } else { model.setRoot(root); } + + // Populate childs nodes root.populateChilds(model, getDataProvider()); + return model; } } Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoNode.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoNode.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemoNode.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,28 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ + package jaxx.demo.component.jaxx.tree; import jaxx.runtime.swing.tree.JaxxNode; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,35 +1,29 @@ <!-- #%L JAXX :: Demo - $Id: ActorContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ %% Copyright (C) 2008 - 2010 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 + 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 + + 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>. #L% --> +<ContentUI superGenericType='People'> -<JSplitPane id='splitPane' - orientation='{JSplitPane.VERTICAL_SPLIT}' - resizeWeight='0.5' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> - <script><![CDATA[ import jaxx.demo.entities.*; @@ -48,25 +42,33 @@ ]]></script> - <People id='data' javaBean='null'/> + <JSplitPane id='splitPane' + orientation='{JSplitPane.VERTICAL_SPLIT}' + resizeWeight='0.5' + constraints='BorderLayout.CENTER' + oneTouchExpandable='true'> - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.actor.title"))}' - editable='false' - font-size='11' - text='{getContent(getData())}'/> - </JScrollPane> + <People id='data' javaBean='null'/> - <JScrollPane border='{new TitledBorder("Picture")}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' - minimumSize='{SwingUtil.newMinDimension()}'> + <JScrollPane border='{null}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JLabel horizontalAlignment='center' - icon='{getImage(getData())}'/> + <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.actor.title"))}' + editable='false' + font-size='11' + text='{getContent(getData())}'/> + </JScrollPane> - </JScrollPane> + <JScrollPane border='{new TitledBorder("Picture")}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' + minimumSize='{SwingUtil.newMinDimension()}'> -</JSplitPane> + <JLabel horizontalAlignment='center' + icon='{getImage(getData())}'/> + + </JScrollPane> + + </JSplitPane> +</ContentUI> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,29 +1,28 @@ <!-- #%L JAXX :: Demo - $Id: ActorsContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ %% Copyright (C) 2008 - 2010 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 + 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 + + 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>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<ContentUI superGenericType='java.util.List<People>'> <script><![CDATA[ import jaxx.demo.entities.*; @@ -56,28 +55,31 @@ protected void selectChild() { People selected = (People)list.getSelectedValue(); - getContextValue(JaxxTreeDemoHelper.class).selectNode(selected.getId()); + getHelper().selectNode(selected.getId()); } ]]></script> <java.util.List id='data' genericType='People' javaBean='null'/> - <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.actors.title"))}' - constraints='BorderLayout.CENTER' - columnHeaderView='{toolbar}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{new DefaultListModel()}' - cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> - </JScrollPane> - <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' - floatable='false'> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' - onActionPerformed='selectChild()'/> - <JButton text='jaxxdemo.action.add'/> - <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> - </JPanel> - </JToolBar> + <JPanel layout='{new BorderLayout()}'> -</JPanel> + <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.actors.title"))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JList id='list' model='{new DefaultListModel()}' + cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> + </JScrollPane> + <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' + floatable='false'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' + onActionPerformed='selectChild()'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + + </JPanel> +</ContentUI> \ No newline at end of file Added: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -0,0 +1,42 @@ +<!-- + #%L + JAXX :: Demo + $Id: ContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $ + $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ + %% + Copyright (C) 2008 - 2010 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>. + #L% + --> + +<JPanel abstract='true' + layout='{new BorderLayout()}' + genericType='B extends Object'> + + <script><![CDATA[ +import jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper; + +// Get helper in context +JaxxTreeDemoHelper getHelper() { + return getContextValue(JaxxTreeDemoHelper.class); +} + +public abstract B getData(); + +public abstract void setData(B data); + ]]> + </script> +</JPanel> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,34 +1,28 @@ <!-- #%L JAXX :: Demo - $Id: MovieContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ %% Copyright (C) 2008 - 2010 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 + 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 + + 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>. #L% --> - -<JSplitPane id='splitPane' - orientation='{JSplitPane.VERTICAL_SPLIT}' - resizeWeight='0.5' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> +<ContentUI superGenericType='Movie'> <script><![CDATA[ import jaxx.demo.entities.*; @@ -47,26 +41,33 @@ } ]]></script> - <Movie id='data' javaBean='null'/> + <JSplitPane id='splitPane' + orientation='{JSplitPane.VERTICAL_SPLIT}' + resizeWeight='0.5' + constraints='BorderLayout.CENTER' + oneTouchExpandable='true'> - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - - <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.movie.title"))}' - editable='false' - font-size='11' - text='{getContent(getData())}'/> - </JScrollPane> + <Movie id='data' javaBean='null'/> - <JScrollPane border='{new TitledBorder("Picture")}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' - minimumSize='{SwingUtil.newMinDimension()}'> + <JScrollPane border='{null}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JLabel horizontalAlignment='center' - icon='{getImage(getData())}'/> + <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.movie.title"))}' + editable='false' + font-size='11' + text='{getContent(getData())}'/> + </JScrollPane> - </JScrollPane> + <JScrollPane border='{new TitledBorder("Picture")}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' + minimumSize='{SwingUtil.newMinDimension()}'> -</JSplitPane> \ No newline at end of file + <JLabel horizontalAlignment='center' + icon='{getImage(getData())}'/> + + </JScrollPane> + + </JSplitPane> +</ContentUI> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,29 +1,28 @@ <!-- #%L JAXX :: Demo - $Id: MoviesContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/compo... $ %% Copyright (C) 2008 - 2010 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 + 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 + + 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>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<ContentUI superGenericType='java.util.List<Movie>'> <script><![CDATA[ import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; @@ -56,32 +55,35 @@ protected void selectChild() { Movie selected = (Movie)list.getSelectedValue(); - getContextValue(JaxxTreeDemoHelper.class).selectNode(selected.getId()); + getHelper().selectNode(selected.getId()); } ]]></script> <java.util.List id='data' genericType='Movie' javaBean='null'/> - <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.movies.title"))}' - constraints='BorderLayout.CENTER' - columnHeaderView='{toolbar}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JPanel layout='{new BorderLayout()}'> - <JList id='list' model='{new DefaultListModel()}' - cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> + <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.movies.title"))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - </JScrollPane> + <JList id='list' model='{new DefaultListModel()}' + cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> - <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' - floatable='false'> + </JScrollPane> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' - onActionPerformed='selectChild()'/> - <JButton text='jaxxdemo.action.add'/> - <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> - </JPanel> - </JToolBar> + <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' + floatable='false'> -</JPanel> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' + onActionPerformed='selectChild()'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + + </JPanel> +</ContentUI> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/ActorsNodeLoadors.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/ActorsNodeLoadors.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/ActorsNodeLoadors.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,28 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ + package jaxx.demo.component.jaxx.tree.loadors; import jaxx.demo.component.jaxx.tree.JaxxTreeDemoNode; @@ -20,24 +45,27 @@ @Override public List<People> getData(Class<?> parentClass, - String parentId, + String moviesId, DataProvider dataProvider) throws Exception { // Get people for parentId JaxxTreeDemoDataProvider provider = (JaxxTreeDemoDataProvider) dataProvider; // If its not root - if (parentId != null) { - return provider.getPeoples(parentId); + if (moviesId != null) { + + // Return peoples for movies id + return provider.getPeoples(moviesId); } + // Return all peoples return provider.getPeoples(); } @Override public JaxxTreeDemoNode createNode(JaxxTreeDemoNode parentNode, People data) { - // Create actor nodes + // Create actor static nodes JaxxTreeDemoNode actorsNode = new JaxxTreeDemoNode( getBeanType(), data.getId(), Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/MoviesNodeLoadors.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/MoviesNodeLoadors.java 2010-06-09 10:15:46 UTC (rev 1959) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/loadors/MoviesNodeLoadors.java 2010-06-09 13:08:53 UTC (rev 1960) @@ -1,3 +1,28 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 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>. + * #L% + */ + package jaxx.demo.component.jaxx.tree.loadors; import jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper; @@ -27,13 +52,15 @@ DataProvider dataProvider) throws Exception { JaxxTreeDemoDataProvider provider = (JaxxTreeDemoDataProvider) dataProvider; + + // Return all movies return provider.getMovies(); } @Override public JaxxTreeDemoNode createNode(JaxxTreeDemoNode parentNode, Movie data) { - // Create movies nodes + // Create movies static nodes JaxxTreeDemoNode moviesNode = new JaxxTreeDemoNode( getBeanType(), data.getId(), @@ -49,7 +76,7 @@ new ActorsNodeLoadors() ); - // Add to movies node + // Add actors nodes to movies node moviesNode.add(ActorsCategoryNode); return moviesNode;
participants (1)
-
sletellier@users.nuiton.org