r1555 - in trunk/jaxx-demo/src/main: java/jaxx/demo java/jaxx/demo/component/jaxx/editor java/jaxx/demo/component/jaxx/navigation/full java/jaxx/demo/component/jaxx/navigation/item java/jaxx/demo/component/swing java/jaxx/demo/feature/databinding java/jaxx/demo/feature/validation java/jaxx/demo/fun resources/i18n
Author: tchemit Date: 2009-10-04 10:57:25 +0200 (Sun, 04 Oct 2009) New Revision: 1555 Added: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java Removed: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/model/ Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java trunk/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java trunk/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties Log: - add multi-sources in demo - update license header Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo; import java.io.IOException; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,73 +1,87 @@ + <JTabbedPane id='top'> <script><![CDATA[ - import java.io.*; +import org.apache.commons.io.IOUtils; - public DemoPanel(String... extraSources) { - super(); - - for (String extra : extraSources) { - // creation du contenu du fichier - JTextArea content = new JTextArea(); - content.setEditable(false); - content.setText(loadSource(extra)); - // ajout de l'onglet - top.addTab(extra,null,content,null); - } +protected String[] getSources() { + if (getClass() == DemoPanel.class) { + return new String[0]; } + return new String[]{ getDefaultSource() }; +} - public String getLabel() { - String name = getClass().getName(); - name = name.substring(name.lastIndexOf(".") + 1); - if (name.endsWith("Demo")) - name = name.substring(0, name.length() - "Demo".length()); - return name; - } - +protected String getDefaultSource() { + return getClass().getSimpleName() + ".jaxx"; +} - public String getDemoTabTitle() { - return getLabel() + " Demo"; +public String getLabel() { + String name = getClass().getSimpleName(); + if (name.endsWith("Demo")) { + name = name.substring(0, name.length() - "Demo".length()); } + return name; +} - public String loadSource(String filename) { - try { - Reader in = new InputStreamReader(getClass().getResourceAsStream(filename)); - StringWriter out = new StringWriter(); - char[] buffer = new char[2048]; - int c; - while ((c = in.read(buffer)) > 0) - out.write(buffer, 0, c); - return out.toString(); +public String getDemoTabTitle() { + return getLabel() + " Demo"; +} + +public String loadSource(String filename) { + try { + if (log.isDebugEnabled()) { + log.debug(filename + " from " + getClass()); } - catch (IOException e) { - throw new RuntimeException(e); - } + String result = IOUtils.toString(getClass().getResourceAsStream(filename)); + + return result; + } catch (Exception e) { + log.error("could not load file " + filename, e); + return "could not load file " + filename; } +} - public String loadSource() { - try { - String className = getClass().getName(); - Reader in = new InputStreamReader(getClass().getResourceAsStream(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")); - StringWriter out = new StringWriter(); - char[] buffer = new char[2048]; - int c; - while ((c = in.read(buffer)) > 0) - out.write(buffer, 0, c); - return out.toString(); +private void $afterCompleteSetup() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + if (getSources().length == 0) { + top.remove(sourceTabs); + return; + } + for (String extra : getSources()) { + JScrollPane pane = new JScrollPane( + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setBorder(null); + // creation du contenu du fichier + JTextArea content = new JTextArea(); + content.setFont(content.getFont().deriveFont((float) 11)); + content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); + content.setEditable(false); + content.setWrapStyleWord(false); + content.setText(loadSource(extra)); + content.setColumns(80); + pane.getViewport().add(content); + // ajout de l'onglet + sourceTabs.addTab(extra, pane); + int index = sourceTabs.indexOfComponent(pane); + JLabel l = new JLabel(extra); + l.setFont(l.getFont().deriveFont((float) 10)); + sourceTabs.setTabComponentAt(index,l); + } } - catch (IOException e) { - throw new RuntimeException(e); - } - } - ]]></script> + }); +} + ]]> + </script> <tab title='{getDemoTabTitle()}'> <JPanel id='demoPanel'/> </tab> - <!--tab title='Source'> - <JScrollPane height='100'> - <JTextArea text='{loadSource()}' editable='false'/> - </JScrollPane> - </tab--> + <tab title='Sources'> + <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> + </tab> </JTabbedPane> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo; import java.util.Stack; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -73,7 +73,6 @@ selectionModel="{getTreeHelper().createTreeHandler(this)}" cellRenderer='{new NavigationTreeCellRenderer(this, 200)}'> </JTree> - <!--model='{DemoTreeHelper.TREE_MODEL.getContextValue(this)}'--> </JScrollPane> <JPanel id='content'/> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,9 +1,10 @@ /** - * *##% observe-swing - * Copyright (C) 2008 - 2009 IRD + * *##% + * 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 General Public License as + * 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. * @@ -12,9 +13,10 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. * - * You should have received a copy of the GNU General Public + * 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/gpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.demo; @@ -100,8 +102,8 @@ @Override public void run() { - // use best dimensions - ui.getSplitPane().resetToPreferredSizes(); +// // use best dimensions +// ui.getSplitPane().resetToPreferredSizes(); String path; if (node == null) { @@ -113,7 +115,19 @@ } // select node ui.getTreeHelper().selectNode(ui, ui.getNavigation(), path); +// +// // show ui +// ui.setVisible(true); + } + }); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + // use best dimensions + ui.getSplitPane().resetToPreferredSizes(); + // show ui ui.setVisible(true); } Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo; import jaxx.runtime.DefaultApplicationContext; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo.component.jaxx.editor; import java.beans.PropertyChangeListener; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,11 +1,9 @@ - <JPanel layout='{new BorderLayout()}'> <Object id='data' javaBean='helper.getSelectedBean(this)'/> <script><![CDATA[ import jaxx.runtime.SwingUtil; -import jaxx.demo.component.jaxx.navigation.full.model.*; private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); @@ -73,7 +71,7 @@ verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' minimumSize='{SwingUtil.newMinDimension()}'> - <JLabel icon='{getImage(getData())}'/> + <JLabel horizontalAlignment='center' icon='{getImage(getData())}'/> </JScrollPane> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -9,9 +9,14 @@ private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); -setContextValue(helper.createMovies(this), " movies"); +helper.createModel(this); -void $afterCompleteSetup() { +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; +} + +private void $afterCompleteSetup() { SwingUtilities.invokeLater(new Runnable() { @Override @@ -41,7 +46,6 @@ model='{helper.createTreeModel(this)}' selectionModel="{helper.createTreeHandler(this)}" cellRenderer='{new NavigationTreeCellRenderer(this, 150)}' /> - <!--model='{helper.createTreeModel(this, helper.createMovies())}'--> </JScrollPane> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,8 +1,26 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo.component.jaxx.navigation.full; -import java.util.ArrayList; -import java.util.HashSet; -import jaxx.demo.component.jaxx.navigation.full.model.Movie; +import java.util.Arrays; import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; @@ -10,14 +28,13 @@ import static org.nuiton.i18n.I18n._; import java.util.List; -import java.util.Set; -import jaxx.demo.component.jaxx.navigation.full.model.People; import jaxx.runtime.Decorator; import jaxx.runtime.JAXXContext; import jaxx.runtime.MultiJXPathDecorator; import javax.swing.JPanel; +import jaxx.runtime.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; @@ -35,15 +52,29 @@ */ public class FullNavigationTreeHelper extends NavigationTreeHelper { - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private final Log log = LogFactory.getLog(FullNavigationTreeHelper.class); + /** + * where the movies are hold in context + */ + static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXContextEntryDef.newListDef("movies"); + /** + * where the actors are hold in context + */ + static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXContextEntryDef.newListDef("actors"); public FullNavigationTreeHelper() { super("full"); } - public java.util.List<Movie> createMovies(JAXXContext context) { - java.util.List<Movie> result = new java.util.ArrayList<Movie>(); + /** + * Create the model and store it in the given context. + * + * @param context the context where to hold the model + */ + public void createModel(JAXXContext context) { 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"); @@ -52,43 +83,38 @@ m.addActor(a); m.addActor(a2); m.addActor(a3); - result.add(m); - m = new Movie("1", "Nacho 2", 2009, "/jaxx/demo/images/nacho2.png"); - m.addActor(a); - m.addActor(a2); - result.add(m); + Movie m2 = new Movie("1", "Nacho 2", 2009, "/jaxx/demo/images/nacho2.png"); + m2.addActor(a); + m2.addActor(a2); - context.setContextValue(result, "movies"); - - return result; + MOVIES.setContextValue(context, Arrays.asList(m, m2)); + ACTORS.setContextValue(context, Arrays.asList(a, a2, a3)); } @Override public NavigationTreeModel createTreeModel(JAXXContext context) { - List<Movie> movies = context.getContextValue(List.class, "movies"); + List<Movie> movies = MOVIES.getContextValue(context); + List<People> actors = ACTORS.getContextValue(context); - log.info("for " + movies.size() + " movie(s)"); + if (log.isDebugEnabled()) { + log.debug("for " + movies.size() + " movie(s)"); + } - NavigationTreeNode rootNode, moviesNode, movieNode, actorsNode; - - log.info("start creating demo model"); - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - Decorator<Movie> movieDecorator = MultiJXPathDecorator.newDecorator(Movie.class, "${title}$s##${year}$s", "##", " - "); - Decorator<People> peopleDecorator = MultiJXPathDecorator.newDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " "); + Decorator<Movie> mDecorator = MultiJXPathDecorator.newDecorator(Movie.class, "${title}$s##${year}$s", "##", " - "); + Decorator<People> pDecorator = MultiJXPathDecorator.newDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " "); - Set<People> actors = new HashSet<People>(); // construction du noeud root // il ne contient pas de context et ne sera pas visible - rootNode = builder.buildEmptyRoot(null, "$root"); + 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 - moviesNode = builder.build( + NavigationTreeNode moviesNode = builder.build( rootNode, _("movies"), newListDef("movies"), @@ -99,16 +125,16 @@ for (Movie m : movies) { // navigation path = $root/movies/m.id - movieNode = builder.build( + NavigationTreeNode movieNode = builder.build( moviesNode, - movieDecorator, + mDecorator, "..[@id=\"" + m.getId() + "\"]", m.getId(), null, null); // navigation path = $root/movies/m.id/actors - actorsNode = builder.build( + NavigationTreeNode actorsNode = builder.build( movieNode, _("actors"), "../actors", @@ -118,29 +144,26 @@ for (People p : m.getActors()) { // navigation path = $root/movies/m.id/actors/p.id - builder.build( actorsNode, - peopleDecorator, + pDecorator, "..[@id=\"" + p.getId() + "\"]", p.getId(), null, null); - actors.add(p); } } // construction du noeud avec les acteurs - actorsNode = builder.build(rootNode, _("actors"), + NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), newListDef("actors"), "actors", null, null); for (People p : actors) { // navigation path = $root/actors/p.id - builder.build( actorsNode, - peopleDecorator, + pDecorator, "..[@id=\"" + p.getId() + "\"]", p.getId(), null, @@ -148,24 +171,22 @@ } NavigationTreeModel model = builder.getModel(); - context.setContextValue(movies, "movies"); - context.setContextValue(new ArrayList<People>(actors), "actors"); - if (log.isDebugEnabled()) { builder.printModel(context, model.getRoot()); } // save tree model in context setTreeModel(context, model); - return model; } + @Override public NavigationTreeHandler createTreeHandler(JAXXObject context) { + if (log.isDebugEnabled()) { + log.debug("create handler"); + } - log.info("create handler"); - NavigationTreeHandler handler = new NavigationTreeHandlerWithCardLayout( getPrefix(), BaseContent.class, Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java (from rev 1552, trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/model/Movie.java) =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -0,0 +1,127 @@ +/* + * *##% + * 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>. + * ##%* + */ +package jaxx.demo.component.jaxx.navigation.full; + +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * + * @author chemit + */ +public class Movie { + + protected String id; + protected String title; + protected String image; + protected int year; + protected List<People> actors; + + public Movie(String id, String title, int year,String image) { + this(); + this.id = id; + this.title = title; + this.year = year; + this.image=image; + } + + public Movie() { + actors = new ArrayList<People>(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List<People> getActors() { + return actors; + } + + public void setActors(List<People> actors) { + this.actors = actors; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public void addActor(People actor) { + actors.add(actor); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Movie other = (Movie) obj; + if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append("id", id); + b.append("title", title); + b.append("year", year); + b.append("actors", actors); + return b.toString(); + } +} Property changes on: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: svn:mergeinfo + Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java (from rev 1552, trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/model/People.java) =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -0,0 +1,117 @@ +/* + * *##% + * 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>. + * ##%* + */ +package jaxx.demo.component.jaxx.navigation.full; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * + * @author chemit + */ +public class People { + + protected String id; + protected String image; + protected String firstName; + protected String lastName; + protected int age; + + public People(String id, String firstName, String lastName, int age, String image) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + this.image = image; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final People other = (People) obj; + if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append("id", id); + b.append("firstName", firstName); + b.append("lastName", lastName); + b.append("age", age); + return b.toString(); + } +} Property changes on: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: svn:mergeinfo + Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo.component.jaxx.navigation.item; import java.beans.PropertyChangeEvent; Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -7,6 +7,11 @@ import jaxx.runtime.swing.navigation.*; import org.jdesktop.swingx.JXDatePicker; +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "ExempleItemTreeNavigationAdapter.java" }; +} + void $afterCompleteSetup() { new ExempleItemTreeNavigationAdapter(this, nav, content); } @@ -26,7 +31,7 @@ </item> </JTree> </JScrollPane> - <!-- Card panel, only ItemNavigationPanel children is alowed --> + <!-- Card panel, only ItemNavigationPanel children is allowed --> <ItemNavigationCardPanel id="content"> <!-- The associated type is passed by the constructor --> <ItemNavigationPanel id='stringPanel' constructorParams='String.class' layout='{new FlowLayout()}'> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,23 +1,24 @@ -<jaxx.demo.DemoPanel> - <script> - private void displayMessage() { - JOptionPane.showMessageDialog(demoPanel, "Menu item clicked"); - } - </script> - - <JPanel id='demoPanel'> - <JDesktopPane width='350' height='400' background='{null}'> - <JInternalFrame title='JMenu demo' width='300' height='250' resizable='true'> - <JMenuBar id='menuBar'> - <JMenu text='Demo'> - <JMenuItem text='Message Box' onActionPerformed='displayMessage()'/> - </JMenu> - </JMenuBar> - - <JPanel id='framePanel'> - <JLabel text='JMenu demo' id='demoMessage' horizontalAlignment='center'/> - </JPanel> - </JInternalFrame> - </JDesktopPane> - </JPanel> +<jaxx.demo.DemoPanel> + <script> + void $afterCompleteSetup(){} + private void displayMessage() { + JOptionPane.showMessageDialog(demoPanel, "Menu item clicked"); + } + </script> + + <JPanel id='demoPanel'> + <JDesktopPane width='350' height='400' background='{null}'> + <JInternalFrame title='JMenu demo' width='300' height='250' resizable='true'> + <JMenuBar id='menuBar'> + <JMenu text='Demo'> + <JMenuItem text='Message Box' onActionPerformed='displayMessage()'/> + </JMenu> + </JMenuBar> + + <JPanel id='framePanel'> + <JLabel text='JMenu demo' id='demoMessage' horizontalAlignment='center'/> + </JPanel> + </JInternalFrame> + </JDesktopPane> + </JPanel> </jaxx.demo.DemoPanel> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -9,6 +9,7 @@ <String id='contentMessage' javaBean='"message..."'/> <script> + void $afterCompleteSetup(){} public Boolean isEditing2() { return editing2; } public void setEditing2(Boolean newValue) { Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,7 +1,13 @@ <BaseBeanDataBinding> <Boolean id='editing3' javaBean='true'/> - + <script><![CDATA[ +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "BaseBeanDataBinding.jaxx" }; +} +]]> + </script> <Table id='demoPanel'> <row> <cell columns='2'> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo.feature.validation; import java.beans.PropertyChangeListener; @@ -100,4 +120,4 @@ this.dir = dir; p.firePropertyChange("dir", oldDir, dir); } -} \ No newline at end of file +} Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,3 +1,23 @@ +/* + * *##% + * 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>. + * ##%* + */ package jaxx.demo.feature.validation; import java.beans.*; @@ -63,4 +83,4 @@ this.ratio = ratio; p.firePropertyChange("ratio", oldRatio, ratio); } -} \ No newline at end of file +} Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,325 +1,330 @@ -<jaxx.demo.DemoPanel> - <style source="Validation.css"/> - -<script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -void $afterCompleteSetup() { -}]]> -</script> - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageListModel id='errors'--> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' - onContentsChanged='ok.setEnabled(errors.isEmpty())'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <Table fill='both' id='demoPanel'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='{model1.getText()}' - _validatorLabel='{n_("form.text")}' - onKeyReleased='model1.setText(text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - _validatorLabel='{n_("form.text2")}' - onKeyReleased='model1.setText2(text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.setRatio(ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text' text='{model2.getText()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - onStateChanged='model2.setRatio(_ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model2.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='180'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()}' - onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane> - <JList id='errorList' model='{errors}' - cellRenderer='{new jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer()}'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</jaxx.demo.DemoPanel> +<jaxx.demo.DemoPanel> + <style source="Validation.css"/> + +<script><![CDATA[ +import static org.nuiton.i18n.I18n.n_; +void $afterCompleteSetup() { +} +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "Validation.css", "Model.java", "Identity.java" }; +} +]]> +</script> + <!-- models --> + <Model id='model1'/> + <Model id='model2'/> + <Identity id='identity'/> + + <!-- errors model --> + <!-- Not existing :) --> + <!--jaxx.runtime.validator.gwt.GWTValidatorMessageListModel id='errors'--> + <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' + onContentsChanged='ok.setEnabled(errors.isEmpty())'/> + + <!-- validators --> + <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="text"/> + <field name="text2"/> + <field name="ratio"/> + </BeanValidator> + <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> + <field name="text" component="_text"/> + <field name="text2" component="_text2"/> + <field name="ratio" component="_ratio"/> + </BeanValidator> + <BeanValidator id='validator3' autoField='true' bean='identity' + uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> + <field name="email" component="email2"/> + </BeanValidator> + + <Table fill='both' id='demoPanel'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='text' text='{model1.getText()}' + _validatorLabel='{n_("form.text")}' + onKeyReleased='model1.setText(text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='text2' text='{model1.getText2()}' + _validatorLabel='{n_("form.text2")}' + onKeyReleased='model1.setText2(text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' + value='{model1.getRatio()}' + _validatorLabel='{n_("form.ratio")}' + onStateChanged='model1.setRatio(ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model1.getRatio()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text' text='{model2.getText()}' + _validatorLabel='{n_("form2.text")}' + onKeyReleased='model2.setText(_text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text2' text='{model2.getText2()}' + _validatorLabel='{n_("form2.text2")}' + onKeyReleased='model2.setText2(_text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='_ratio' minimum='0' maximum='100' + value='{model2.getRatio()}' + _validatorLabel='{n_("form2.ratio")}' + onStateChanged='model2.setRatio(_ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model2.getRatio()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' + layout='{new GridLayout()}' width='250' height='180'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JTextField id='firstName' text='{identity.getFirstName()}' + onKeyReleased='identity.setFirstName(firstName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JTextField id='lastName' text='{identity.getLastName()}' + onKeyReleased='identity.setLastName(lastName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JTextField id='email2' text='{identity.getEmail()}' + onKeyReleased='identity.setEmail(email2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' + onStateChanged='identity.setAge(age.getValue())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Config file :'/> + </cell> + <cell> + <JTextField id='config' text='{identity.getConfig()}' + onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Working directory:'/> + </cell> + <cell> + <JTextField id='dir' text='{identity.getDir()}' + onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getFirstName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getLastName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getEmail()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JLabel text='{identity.getAge()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Config file:'/> + </cell> + <cell> + <JLabel text='{identity.getConfig()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Directory file:'/> + </cell> + <cell> + <JLabel text='{identity.getDir()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane> + <JList id='errorList' model='{errors}' + cellRenderer='{new jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer()}'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton id='cancel' text='cancel' + onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + <JButton id='ok' text='valid' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + </JPanel> + </cell> + </row> + </Table> + +</jaxx.demo.DemoPanel> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,331 +1,336 @@ -<jaxx.demo.DemoPanel> - <style source="Validation.css"/> - - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageTableModel id='errors2'/--> - <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errors2' - onTableChanged='ok.setEnabled(errors2.getRowCount()==0)'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); -} -]]></script> - - <Table fill='both' id='demoPanel'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='{model1.getText()}' - onKeyReleased='model1.setText(text.getText())' - _validatorLabel='{n_("form.text")}' - /> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - onKeyReleased='model1.setText2(text2.getText())' - _validatorLabel='{n_("form.text2")}' - /> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.setRatio(ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text' text='{model2.getText()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - onStateChanged='model2.setRatio(_ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model2.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='180'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()}' - onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> - <JTable id='errorTable' model='{errors2}' rowSelectionAllowed='true' autoCreateRowSorter='true' - autoResizeMode='2' cellSelectionEnabled='false' selectionMode='0'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</jaxx.demo.DemoPanel> +<jaxx.demo.DemoPanel> + <style source="Validation.css"/> + + <!-- models --> + <Model id='model1'/> + <Model id='model2'/> + <Identity id='identity'/> + + <!-- errors model --> + <!-- Not existing :) --> + <!--jaxx.runtime.validator.gwt.GWTValidatorMessageTableModel id='errors2'/--> + <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errors2' + onTableChanged='ok.setEnabled(errors2.getRowCount()==0)'/> + + <!-- validators --> + <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="text"/> + <field name="text2"/> + <field name="ratio"/> + </BeanValidator> + <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> + <field name="text" component="_text"/> + <field name="text2" component="_text2"/> + <field name="ratio" component="_ratio"/> + </BeanValidator> + <BeanValidator id='validator3' autoField='true' bean='identity' + uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> + <field name="email" component="email2"/> + </BeanValidator> + + <script><![CDATA[ +import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.SwingUtil; + +void $afterCompleteSetup() { + jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); +} + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "Validation.css", "Model.java", "Identity.java" }; +} +]]></script> + + <Table fill='both' id='demoPanel'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='text' text='{model1.getText()}' + onKeyReleased='model1.setText(text.getText())' + _validatorLabel='{n_("form.text")}' + /> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='text2' text='{model1.getText2()}' + onKeyReleased='model1.setText2(text2.getText())' + _validatorLabel='{n_("form.text2")}' + /> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' + value='{model1.getRatio()}' + _validatorLabel='{n_("form.ratio")}' + onStateChanged='model1.setRatio(ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model1.getRatio()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text' text='{model2.getText()}' + _validatorLabel='{n_("form2.text")}' + onKeyReleased='model2.setText(_text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text2' text='{model2.getText2()}' + _validatorLabel='{n_("form2.text2")}' + onKeyReleased='model2.setText2(_text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='_ratio' minimum='0' maximum='100' + value='{model2.getRatio()}' + _validatorLabel='{n_("form2.ratio")}' + onStateChanged='model2.setRatio(_ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model2.getRatio()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' + layout='{new GridLayout()}' width='250' height='180'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JTextField id='firstName' text='{identity.getFirstName()}' + onKeyReleased='identity.setFirstName(firstName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JTextField id='lastName' text='{identity.getLastName()}' + onKeyReleased='identity.setLastName(lastName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JTextField id='email2' text='{identity.getEmail()}' + onKeyReleased='identity.setEmail(email2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' + onStateChanged='identity.setAge(age.getValue())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Config file :'/> + </cell> + <cell> + <JTextField id='config' text='{identity.getConfig()}' + onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Working directory:'/> + </cell> + <cell> + <JTextField id='dir' text='{identity.getDir()}' + onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getFirstName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getLastName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getEmail()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JLabel text='{identity.getAge()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Config file:'/> + </cell> + <cell> + <JLabel text='{identity.getConfig()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Directory file:'/> + </cell> + <cell> + <JLabel text='{identity.getDir()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' model='{errors2}' rowSelectionAllowed='true' autoCreateRowSorter='true' + autoResizeMode='2' cellSelectionEnabled='false' selectionMode='0'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton id='cancel' text='cancel' + onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + <JButton id='ok' text='valid' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + </JPanel> + </cell> + </row> + </Table> + +</jaxx.demo.DemoPanel> Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,89 +1,95 @@ -<jaxx.demo.DemoPanel> - <style source='Calculator.css'/> - <script><![CDATA[ - plus.setText("+"); - sign.setText("+/-"); -]]></script> - <!-- use fully-qualified name just in case this is compiled into a different package --> - <CalculatorEngine id='engine'/> - - <Table id='demoPanel' fill='both'> - <row> - <cell columns='4'> - <JLabel id='display' text='{engine.getDisplayText()}'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton id='c' text='C' onActionPerformed='engine.clear()' styleClass='clear'/> - </cell> - <cell> - <JButton id='ce' text='CE' onActionPerformed='engine.clearEntry()' styleClass='clear'/> - </cell> - <cell> - <JButton id='equals' text='=' onActionPerformed='engine.equal()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d7' text='7' onActionPerformed='engine.digit(7)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d8' text='8' onActionPerformed='engine.digit(8)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d9' text='9' onActionPerformed='engine.digit(9)' styleClass='digit'/> - </cell> - <cell> - <JButton id='plus' onActionPerformed='engine.add()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d4' text='4' onActionPerformed='engine.digit(4)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d5' text='5' onActionPerformed='engine.digit(5)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d6' text='6' onActionPerformed='engine.digit(6)' styleClass='digit'/> - </cell> - <cell> - <JButton id='subtract' text='-' onActionPerformed='engine.subtract()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d1' text='1' onActionPerformed='engine.digit(1)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d2' text='2' onActionPerformed='engine.digit(2)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d3' text='3' onActionPerformed='engine.digit(3)' styleClass='digit'/> - </cell> - <cell> - <JButton id='multiply' text='x' onActionPerformed='engine.multiply()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d0' text='0' onActionPerformed='engine.digit(0)' styleClass='digit'/> - </cell> - <cell> - <JButton id='sign' onActionPerformed='engine.toggleSign()' styleClass='operator'/> - </cell> - <cell> - <JButton id='dot' text='.' onActionPerformed='engine.dot()' styleClass='digit'/> - </cell> - <cell> - <JButton id='divide' text='÷' onActionPerformed='engine.divide()' styleClass='operator'/> - </cell> - </row> - </Table> +<jaxx.demo.DemoPanel> + <style source='Calculator.css'/> + <script><![CDATA[ + plus.setText("+"); + sign.setText("+/-"); + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "Calculator.css", "CalculatorEngine.java" }; +} +]]> + </script> + <!-- use fully-qualified name just in case this is compiled into a different package --> + <CalculatorEngine id='engine'/> + + <Table id='demoPanel' fill='both'> + <row> + <cell columns='4'> + <JLabel id='display' text='{engine.getDisplayText()}'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JButton id='c' text='C' onActionPerformed='engine.clear()' styleClass='clear'/> + </cell> + <cell> + <JButton id='ce' text='CE' onActionPerformed='engine.clearEntry()' styleClass='clear'/> + </cell> + <cell> + <JButton id='equals' text='=' onActionPerformed='engine.equal()' styleClass='operator'/> + </cell> + </row> + + <row> + <cell> + <JButton id='d7' text='7' onActionPerformed='engine.digit(7)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d8' text='8' onActionPerformed='engine.digit(8)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d9' text='9' onActionPerformed='engine.digit(9)' styleClass='digit'/> + </cell> + <cell> + <JButton id='plus' onActionPerformed='engine.add()' styleClass='operator'/> + </cell> + </row> + + <row> + <cell> + <JButton id='d4' text='4' onActionPerformed='engine.digit(4)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d5' text='5' onActionPerformed='engine.digit(5)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d6' text='6' onActionPerformed='engine.digit(6)' styleClass='digit'/> + </cell> + <cell> + <JButton id='subtract' text='-' onActionPerformed='engine.subtract()' styleClass='operator'/> + </cell> + </row> + + <row> + <cell> + <JButton id='d1' text='1' onActionPerformed='engine.digit(1)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d2' text='2' onActionPerformed='engine.digit(2)' styleClass='digit'/> + </cell> + <cell> + <JButton id='d3' text='3' onActionPerformed='engine.digit(3)' styleClass='digit'/> + </cell> + <cell> + <JButton id='multiply' text='x' onActionPerformed='engine.multiply()' styleClass='operator'/> + </cell> + </row> + + <row> + <cell> + <JButton id='d0' text='0' onActionPerformed='engine.digit(0)' styleClass='digit'/> + </cell> + <cell> + <JButton id='sign' onActionPerformed='engine.toggleSign()' styleClass='operator'/> + </cell> + <cell> + <JButton id='dot' text='.' onActionPerformed='engine.dot()' styleClass='digit'/> + </cell> + <cell> + <JButton id='divide' text='÷' onActionPerformed='engine.divide()' styleClass='operator'/> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,177 +1,197 @@ -package jaxx.demo.fun; - -import java.beans.*; -import java.math.*; - -public class CalculatorEngine { - public static final String DISPLAY_TEXT_PROPERTY = "displayText"; - - public static final int ADD = 0; - public static final int SUBTRACT = 1; - public static final int MULTIPLY = 2; - public static final int DIVIDE = 3; - public static final int RESULT = 4; - - private int operation = -1; - private boolean clear = true; // true to clear on next key - private String displayText = "0"; - private BigDecimal value; - private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); - - - public String getDisplayText() { - return displayText; - } - - - public void setDisplayText(String displayText) { - String oldDisplayText = this.displayText; - this.displayText = displayText; - firePropertyChange(DISPLAY_TEXT_PROPERTY, oldDisplayText, displayText); - } - - - public void clear() { - clearEntry(); - value = new BigDecimal(0); - operation = -1; - } - - - public void clearEntry() { - setDisplayText("0"); - clear = true; - } - - - private void checkClear() { - if (clear) { - setDisplayText(""); - clear = false; - } - } - - - public void digit(int digit) { - checkClear(); - setDisplayText(getDisplayText() + String.valueOf(digit)); - } - - - public void dot() { - checkClear(); - if (getDisplayText().indexOf('.') == -1) { - if (getDisplayText().length() == 0) { - setDisplayText("0."); - } else { - setDisplayText(getDisplayText() + '.'); - } - } - } - - - public void toggleSign() { - String text = getDisplayText(); - if (text.startsWith("-")) { - text = text.substring(1); - } else if (!text.equals("0")) { - text = '-' + text; - } - setDisplayText(text); - } - - - public void equal() { - BigDecimal displayValue = new BigDecimal(getDisplayText()); - BigDecimal newValue = displayValue; - switch (operation) { - case ADD: - newValue = value.add(displayValue); - break; - case SUBTRACT: - newValue = value.subtract(displayValue); - break; - case MULTIPLY: - newValue = value.multiply(displayValue); - break; - case DIVIDE: - newValue = value.divide(displayValue, 8, BigDecimal.ROUND_HALF_UP); - break; - } - value = newValue; - setDisplayText(toString(newValue)); - clear = true; - operation = -1; - } - - - public static String toString(BigDecimal decimal) { - // can't use stripTrailingZeros, as it wasn't introduced until 1.5 - String result = decimal.toString(); - if (result.indexOf(".") != -1) { - while (result.endsWith("0")) { - result = result.substring(0, result.length() - 1); - } - if (result.endsWith(".")) { - result = result.substring(0, result.length() - 1); - } - } - return result; - } - - - public void operation(int operation) { - if (this.operation != -1) { - equal(); - } else { - value = new BigDecimal(getDisplayText()); - clear = true; - } - this.operation = operation; - } - - - public void add() { - operation(ADD); - } - - - public void subtract() { - operation(SUBTRACT); - } - - - public void multiply() { - operation(MULTIPLY); - } - - - public void divide() { - operation(DIVIDE); - } - - - public void addPropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(listener); - } - - - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(property, listener); - } - - - public void removePropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(listener); - } - - - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(property, listener); - } - - - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - propertyChangeSupport.firePropertyChange(property, oldValue, newValue); - } -} \ No newline at end of file +/* + * *##% + * 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>. + * ##%* + */ +package jaxx.demo.fun; + +import java.beans.*; +import java.math.*; + +public class CalculatorEngine { + public static final String DISPLAY_TEXT_PROPERTY = "displayText"; + + public static final int ADD = 0; + public static final int SUBTRACT = 1; + public static final int MULTIPLY = 2; + public static final int DIVIDE = 3; + public static final int RESULT = 4; + + private int operation = -1; + private boolean clear = true; // true to clear on next key + private String displayText = "0"; + private BigDecimal value; + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + + public String getDisplayText() { + return displayText; + } + + + public void setDisplayText(String displayText) { + String oldDisplayText = this.displayText; + this.displayText = displayText; + firePropertyChange(DISPLAY_TEXT_PROPERTY, oldDisplayText, displayText); + } + + + public void clear() { + clearEntry(); + value = new BigDecimal(0); + operation = -1; + } + + + public void clearEntry() { + setDisplayText("0"); + clear = true; + } + + + private void checkClear() { + if (clear) { + setDisplayText(""); + clear = false; + } + } + + + public void digit(int digit) { + checkClear(); + setDisplayText(getDisplayText() + String.valueOf(digit)); + } + + + public void dot() { + checkClear(); + if (getDisplayText().indexOf('.') == -1) { + if (getDisplayText().length() == 0) { + setDisplayText("0."); + } else { + setDisplayText(getDisplayText() + '.'); + } + } + } + + + public void toggleSign() { + String text = getDisplayText(); + if (text.startsWith("-")) { + text = text.substring(1); + } else if (!text.equals("0")) { + text = '-' + text; + } + setDisplayText(text); + } + + + public void equal() { + BigDecimal displayValue = new BigDecimal(getDisplayText()); + BigDecimal newValue = displayValue; + switch (operation) { + case ADD: + newValue = value.add(displayValue); + break; + case SUBTRACT: + newValue = value.subtract(displayValue); + break; + case MULTIPLY: + newValue = value.multiply(displayValue); + break; + case DIVIDE: + newValue = value.divide(displayValue, 8, BigDecimal.ROUND_HALF_UP); + break; + } + value = newValue; + setDisplayText(toString(newValue)); + clear = true; + operation = -1; + } + + + public static String toString(BigDecimal decimal) { + // can't use stripTrailingZeros, as it wasn't introduced until 1.5 + String result = decimal.toString(); + if (result.indexOf(".") != -1) { + while (result.endsWith("0")) { + result = result.substring(0, result.length() - 1); + } + if (result.endsWith(".")) { + result = result.substring(0, result.length() - 1); + } + } + return result; + } + + + public void operation(int operation) { + if (this.operation != -1) { + equal(); + } else { + value = new BigDecimal(getDisplayText()); + clear = true; + } + this.operation = operation; + } + + + public void add() { + operation(ADD); + } + + + public void subtract() { + operation(SUBTRACT); + } + + + public void multiply() { + operation(MULTIPLY); + } + + + public void divide() { + operation(DIVIDE); + } + + + public void addPropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + + public void addPropertyChangeListener(String property, PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(property, listener); + } + + + public void removePropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + + public void removePropertyChangeListener(String property, PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(property, listener); + } + + + protected void firePropertyChange(String property, Object oldValue, Object newValue) { + propertyChangeSupport.firePropertyChange(property, oldValue, newValue); + } +} Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx 2009-10-04 08:57:25 UTC (rev 1555) @@ -1,85 +1,92 @@ -<jaxx.demo.DemoPanel> - <style source="LabelStyle.css"/> - - <Table id='demoPanel' anchor='north' fill='both'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='Data Binding'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Red:'/> - </cell> - <cell> - <JSlider id='red' value='128' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Green:'/> - </cell> - <cell> - <JSlider id='green' value='0' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Blue:'/> - </cell> - <cell> - <JSlider id='blue' value='255' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Size:'/> - </cell> - <cell> - <JSlider id='dummySize' value='36' minimum='6' maximum='60'/> - </cell> - </row> - - <row> - <cell columns='2' fill='both' weighty='1'> - <JPanel border='{BorderFactory.createTitledBorder("Preview")}' - height='90' - layout='{new BorderLayout()}'> - <VBox background='{(Color)( backgroundCheckbox.isSelected() ? backgroundColor.getSelectedValue() : null)}' - margin='0' - horizontalAlignment='center' - verticalAlignment='middle'> - <JLabel text='{text.getText()}' font-size='{dummySize.getValue()}' - foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </VBox> - </JPanel> - </cell> - </row> - </Table> - </cell> - - <cell> - <VBox spacing='0' border='{BorderFactory.createTitledBorder("Background")}'> - <JCheckBox id='backgroundCheckbox' text='Show Background'/> - <JRadioButton text='Red' buttonGroup='backgroundColor' value='{Color.RED}' selected='true'/> - <JRadioButton text='Orange' buttonGroup='backgroundColor' value='{Color.ORANGE}'/> - <JRadioButton text='Yellow' buttonGroup='backgroundColor' value='{Color.YELLOW}'/> - <JRadioButton text='Green' buttonGroup='backgroundColor' value='{Color.GREEN}'/> - <JRadioButton text='Cyan' buttonGroup='backgroundColor' value='{Color.CYAN}'/> - <JRadioButton text='Blue' buttonGroup='backgroundColor' value='{Color.BLUE}'/> - <JRadioButton text='Purple' buttonGroup='backgroundColor' value='{new Color(160, 30, 255)}'/> - </VBox> - </cell> - </row> - </Table> +<jaxx.demo.DemoPanel> + <style source="LabelStyle.css"/> + <script><![CDATA[ +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "LabelStyle.css" }; +} + +]]> + </script> + <Table id='demoPanel' anchor='north' fill='both'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='text' text='Data Binding'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Red:'/> + </cell> + <cell> + <JSlider id='red' value='128' maximum='255' styleClass='color'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Green:'/> + </cell> + <cell> + <JSlider id='green' value='0' maximum='255' styleClass='color'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Blue:'/> + </cell> + <cell> + <JSlider id='blue' value='255' maximum='255' styleClass='color'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Size:'/> + </cell> + <cell> + <JSlider id='dummySize' value='36' minimum='6' maximum='60'/> + </cell> + </row> + + <row> + <cell columns='2' fill='both' weighty='1'> + <JPanel border='{BorderFactory.createTitledBorder("Preview")}' + height='90' + layout='{new BorderLayout()}'> + <VBox background='{(Color)( backgroundCheckbox.isSelected() ? backgroundColor.getSelectedValue() : null)}' + margin='0' + horizontalAlignment='center' + verticalAlignment='middle'> + <JLabel text='{text.getText()}' font-size='{dummySize.getValue()}' + foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> + </VBox> + </JPanel> + </cell> + </row> + </Table> + </cell> + + <cell> + <VBox spacing='0' border='{BorderFactory.createTitledBorder("Background")}'> + <JCheckBox id='backgroundCheckbox' text='Show Background'/> + <JRadioButton text='Red' buttonGroup='backgroundColor' value='{Color.RED}' selected='true'/> + <JRadioButton text='Orange' buttonGroup='backgroundColor' value='{Color.ORANGE}'/> + <JRadioButton text='Yellow' buttonGroup='backgroundColor' value='{Color.YELLOW}'/> + <JRadioButton text='Green' buttonGroup='backgroundColor' value='{Color.GREEN}'/> + <JRadioButton text='Cyan' buttonGroup='backgroundColor' value='{Color.CYAN}'/> + <JRadioButton text='Blue' buttonGroup='backgroundColor' value='{Color.BLUE}'/> + <JRadioButton text='Purple' buttonGroup='backgroundColor' value='{new Color(160, 30, 255)}'/> + </VBox> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-10-04 08:57:25 UTC (rev 1555) @@ -73,6 +73,7 @@ Sign\ on= Simple\ Button= Size\:= +Sources= Spacing\:= Start= Stop= Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-10-04 08:25:09 UTC (rev 1554) +++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-10-04 08:57:25 UTC (rev 1555) @@ -73,6 +73,7 @@ Sign\ on=Signer Simple\ Button=Bouton simple Size\:=Taille \: +Sources=Sources Spacing\:=Espacement \: Start=D\u00E9marrer Stop=Arr\u00EAter
participants (1)
-
tchemit@users.nuiton.org