[Buix-commits] r910 - in lutinjaxx/trunk/maven-jaxx-plugin/src: . examples examples/Calculator examples/Calculator/src examples/Calculator/src/main examples/Calculator/src/main/java examples/Calculator/src/main/java/examples examples/Calculator/src/main/java/examples/Calculator examples/Calculator/src/main/jnlp examples/Components examples/Components/src examples/Components/src/main examples/Components/src/main/java examples/Components/src/main/java/examples examples/Components/src/main/java/examples/Compon
Author: tchemit Date: 2008-10-15 12:00:26 +0000 (Wed, 15 Oct 2008) New Revision: 910 Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.css lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/CalculatorEngine.java lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/Components.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/DemoPanel.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JButtonDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxMenuItemDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JComboBoxDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JDialogDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JListDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JMenuItemDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JPasswordFieldDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JProgressBarDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonMenuItemDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSliderDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSpinnerDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSplitPaneDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextAreaDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextFieldDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JToggleButtonDemo.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Amethyst.jpg lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Lynx.jpg lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Tomato.jpg lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/pencil_black.gif lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/sun.jnlp lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/template.vm lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/Counter/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/Counter/Counter.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/sun.jnlp lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/template.vm lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.css lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/sun.jnlp lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/template.vm lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java Log: mise en place des examples Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinjaxx</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>Calculator</artifactId> + + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-core</artifactId> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Calculator example</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx Calculator example</description> + <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + + <properties> + <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + + <!-- jnlp --> + <keystorepath>${keystorepath}</keystorepath> + <keystorealias>CodeLutin</keystorealias> + <keystorepass>codelutin</keystorepass> + + </properties> + + <build> + <finalName>${project.artifactId}</finalName> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/src/main/java</src> + <force>true</force> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>${maven.jar.main.class}</mainClass> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> + <execution> + <id>JnlpSun</id> + <phase>package</phase> + <configuration> + <tasks> + <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" + todir="${project.basedir}/target/jnlp"> + <filterset> + <filter token="help" value="javahelp-2.0.02.jar"/> + <filter token="url" value="${project.url}"/> + </filterset> + </copy> + <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" + todir="${project.basedir}/target/jnlp/lib"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <dependencies> + <excludes> + <exclude>javax.help:javahelp</exclude> + </excludes> + </dependencies> + <libPath>lib</libPath> + <jnlp> + <outputFile>launch-${project.artifactId}.jnlp</outputFile> + <mainClass>${maven.jar.main.class}</mainClass> + </jnlp> + + <sign> + <keystore>${keystorepath}</keystore> + <keypass/> + <storepass>${keystorepass}</storepass> + <storetype/> + <alias>${keystorealias}</alias> + <validity/> + <dnameCn/> + <dnameOu/> + <dnameO/> + <dnameL/> + <dnameSt/> + <dnameC/> + <verify>false</verify> + <keystoreConfig> + <delete>false</delete> + <gen>false</gen> + </keystoreConfig> + </sign> + + + <pack200>false</pack200> + <gzip>true</gzip> + <verbose>false</verbose> + </configuration> + </plugin> + + </plugins> + </build> +</project> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.css =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.css (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.css 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,52 @@ +Application { + lookAndFeel: system; +} + +#table { + border: {BorderFactory.createEmptyBorder(4, 4, 4, 4)}; + font-face: "Trebuchet MS"; +} + +#display { + background: #BCE5AD; + opaque: true; + horizontalAlignment: right; + border: {BorderFactory.createBevelBorder(BevelBorder.LOWERED)}; + font-size: 22; + font-weight: bold; +} + +#display:{object.getText().startsWith("-")} { + foreground: red; +} + +JButton { + font-size: 18; + width: 60; + height: 35; +} + +JButton.digit { + foreground: blue; +} + +JButton#dot { + font-size: 20; +} + +JButton.operator { + font-size: 18; + foreground: #009900; +} + +JButton.clear { + foreground: red; +} + +JButton:mouseover { + font-weight: bold; +} + +JButton.operator:mouseover { + font-weight: normal; +} \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/Calculator.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,46 @@ +<Application title='Calculator'> + <style source='Calculator.css'/> + + <!-- use fully-qualified name just in case this is compiled into a different package --> + <examples.Calculator.CalculatorEngine id='engine'/> + + <Table fill='both' id='table'> + <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' text='+' 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' text='+/-' 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> +</Application> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/CalculatorEngine.java =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/CalculatorEngine.java (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/java/examples/Calculator/CalculatorEngine.java 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,165 @@ +package examples.Calculator; + +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 Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> + <information> + <title>Sun MicroSystems</title> + <vendor>Sun MicroSystems, Inc.</vendor> + <offline-allowed/> + </information> + <resources> + <jar href="lib/@help@"/> + </resources> + <component-desc/> +</jnlp> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp + spec="1.0+" + codebase="$project.Url" href="$outputFile"> + <information> + <title>$informationTitle</title> + <vendor>$informationVendor</vendor> + <homepage href="$informationHomepage" /> + <description>$informationDescription</description> + <offline-allowed /> + </information> + <resources> + <j2se version="1.5+" max-heap-size="512m"/> + $dependencies + <extension name="sun" href="sun.jnlp"/> + </resources> + <security> + <all-permissions /> + </security> + <application-desc main-class="$mainClass" /> +</jnlp> Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinjaxx</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>Components</artifactId> + + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-core</artifactId> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Components example</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx Calculator example</description> + <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + + <properties> + <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + + <!-- jnlp --> + <keystorepath>${keystorepath}</keystorepath> + <keystorealias>CodeLutin</keystorealias> + <keystorepass>codelutin</keystorepass> + + </properties> + + <build> + <finalName>${project.artifactId}</finalName> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/src/main/java</src> + <force>true</force> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>${maven.jar.main.class}</mainClass> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> + <execution> + <id>JnlpSun</id> + <phase>package</phase> + <configuration> + <tasks> + <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" + todir="${project.basedir}/target/jnlp"> + <filterset> + <filter token="help" value="javahelp-2.0.02.jar"/> + <filter token="url" value="${project.url}"/> + </filterset> + </copy> + <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" + todir="${project.basedir}/target/jnlp/lib"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <dependencies> + <excludes> + <exclude>javax.help:javahelp</exclude> + </excludes> + </dependencies> + <libPath>lib</libPath> + <jnlp> + <outputFile>launch-${project.artifactId}.jnlp</outputFile> + <mainClass>${maven.jar.main.class}</mainClass> + </jnlp> + + <sign> + <keystore>${keystorepath}</keystore> + <keypass/> + <storepass>${keystorepass}</storepass> + <storetype/> + <alias>${keystorealias}</alias> + <validity/> + <dnameCn/> + <dnameOu/> + <dnameO/> + <dnameL/> + <dnameSt/> + <dnameC/> + <verify>false</verify> + <keystoreConfig> + <delete>false</delete> + <gen>false</gen> + </keystoreConfig> + </sign> + + + <pack200>false</pack200> + <gzip>true</gzip> + <verbose>false</verbose> + </configuration> + </plugin> + + </plugins> + </build> +</project> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/Components.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/Components.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/Components.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,81 @@ +<Application title="Component Demo" width='600' height='600' defaultCloseOperation='exit_on_close'> + <script> + protected void changePanel() { + Object value = list.getSelectionValue(); + if (value instanceof DemoPanel) { + cardLayout.show(preview, ((DemoPanel) value).getLabel()); + } + } + </script> + <JSplitPane dividerLocation='200'> + <JScrollPane> + <JTree id='list' showsRootHandles='true' onValueChanged='changePanel()' + cellRenderer='{new javax.swing.tree.DefaultTreeCellRenderer() { + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { + if (value instanceof DemoPanel) + value = ((DemoPanel) value).getLabel(); + return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + } + } + }'> + <item value='Buttons'> + <item value='{buttonDemo}'/> + <item value='{checkBoxDemo}'/> + <item value='{radioButtonDemo}'/> + <item value='{toggleButtonDemo}'/> + </item> + + <item value='Form elements'> + <item value='Text'> + <item value='{passwordFieldDemo}'/> + <item value='{textFieldDemo}'/> + <item value='{textAreaDemo}'/> + </item> + + <item value='{comboBoxDemo}'/> + <item value='{listDemo}'/> + <item value='{sliderDemo}'/> + <item value='{spinnerDemo}'/> + </item> + + <item value='Layout components'> + <item value='{splitPaneDemo}'/> + </item> + + <item value='Menus'> + <item value='{menuItemDemo}'/> + <item value='{checkBoxMenuItemDemo}'/> + <item value='{radioButtonMenuItemDemo}'/> + </item> + + <item value='Windows'> + <item value='{dialogDemo}'/> + </item> + + <item value='{progressBarDemo}'/> + </JTree> + </JScrollPane> + + <java.awt.CardLayout id='cardLayout'/> + + <JPanel id='preview' layout='{cardLayout}'> + <examples.Components.JButtonDemo id='buttonDemo' constraints='buttonDemo.getLabel()'/> + <examples.Components.JCheckBoxDemo id='checkBoxDemo' constraints='checkBoxDemo.getLabel()'/> + <examples.Components.JCheckBoxMenuItemDemo id='checkBoxMenuItemDemo' constraints='checkBoxMenuItemDemo.getLabel()'/> + <examples.Components.JComboBoxDemo id='comboBoxDemo' constraints='comboBoxDemo.getLabel()'/> + <examples.Components.JDialogDemo id='dialogDemo' constraints='dialogDemo.getLabel()'/> + <examples.Components.JListDemo id='listDemo' constraints='listDemo.getLabel()'/> + <examples.Components.JMenuItemDemo id='menuItemDemo' constraints='menuItemDemo.getLabel()'/> + <examples.Components.JPasswordFieldDemo id='passwordFieldDemo' constraints='passwordFieldDemo.getLabel()'/> + <examples.Components.JProgressBarDemo id='progressBarDemo' constraints='progressBarDemo.getLabel()'/> + <examples.Components.JSliderDemo id='sliderDemo' constraints='sliderDemo.getLabel()'/> + <examples.Components.JSpinnerDemo id='spinnerDemo' constraints='spinnerDemo.getLabel()'/> + <examples.Components.JSplitPaneDemo id='splitPaneDemo' constraints='splitPaneDemo.getLabel()'/> + <examples.Components.JRadioButtonDemo id='radioButtonDemo' constraints='radioButtonDemo.getLabel()'/> + <examples.Components.JRadioButtonMenuItemDemo id='radioButtonMenuItemDemo' constraints='radioButtonMenuItemDemo.getLabel()'/> + <examples.Components.JToggleButtonDemo id='toggleButtonDemo' constraints='toggleButtonDemo.getLabel()'/> + <examples.Components.JTextFieldDemo id='textFieldDemo' constraints='textFieldDemo.getLabel()'/> + <examples.Components.JTextAreaDemo id='textAreaDemo' constraints='textAreaDemo.getLabel()'/> + </JPanel> + </JSplitPane> +</Application> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/DemoPanel.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/DemoPanel.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/DemoPanel.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,45 @@ +<JTabbedPane id='top'> + <script><![CDATA[ + import java.io.*; + + 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; + } + + + public String getDemoTabTitle() { + return getLabel() + " Demo"; + } + + + 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(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + ]]></script> + + <tab title='{getDemoTabTitle()}'> + <JPanel id='demoPanel'/> + </tab> + + <tab title='Source'> + <JScrollPane height='100'> + <JTextArea text='{loadSource()}' editable='false'/> + </JScrollPane> + </tab> +</JTabbedPane> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JButtonDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JButtonDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JButtonDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,28 @@ +<DemoPanel> + <style> + JButton.fancy { + foreground: blue; + font-face: Arial; + font-size: 18; + } + + JButton.fancy:mouseover { + foreground: red; + font-style: italic; + } + </style> + + <script> + public void buttonClicked(JButton button) { + JOptionPane.showMessageDialog(this, button.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE); + } + </script> + + <javax.swing.ImageIcon id='pencil' constructorParams='getClass().getResource("images/pencil_black.gif")'/> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JButton text='Simple Button' onActionPerformed='buttonClicked((JButton) event.getSource())'/> + <JButton text='Fancy Button' styleClass='fancy' icon='{pencil}' + onActionPerformed='buttonClicked((JButton) event.getSource())'/> + </VBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,29 @@ +<DemoPanel> + <script><![CDATA[ + public String getText(boolean bold, boolean italic, boolean underline) { + String text ="Sample Text"; + if (bold) + text = "<b>" + text + "</b>"; + if (italic) + text = "<i>" + text + "</i>"; + if (underline) + text = "<u>" + text + "</u>"; + return "<html>" + text; + } + ]]></script> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <Table anchor='west'> + <row> + <cell><JCheckBox id='bold' text='Bold' mnemonic='B'/></cell> + <cell rows='3'><JLabel font='{new Font("Arial", 0, 18)}' text='{getText(bold.isSelected(), italic.isSelected(), underline.isSelected())}'/></cell> + </row> + <row> + <cell><JCheckBox id='italic' text='Italic' mnemonic='I'/></cell> + </row> + <row> + <cell><JCheckBox id='underline' text='Underline' mnemonic='U'/></cell> + </row> + </Table> + </VBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxMenuItemDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxMenuItemDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JCheckBoxMenuItemDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,59 @@ +<JMenuItemDemo> + <style> + .form { + enabled: { enabledCheckBox.isSelected() }; + editable: { editableCheckBox.isSelected() }; + } + </style> + + <JMenuBar id='menuBar'> + <JMenu text='View'> + <JCheckBoxMenuItem id='enabledCheckBox' text='Enabled' selected='true'/> + <JCheckBoxMenuItem id='editableCheckBox' text='Editable' selected='true'/> + </JMenu> + </JMenuBar> + + <Table id='framePanel' anchor='northwest'> + <row> + <cell> + <JLabel text='First Name:' displayedMnemonic='F' labelFor='{firstName}'/> + </cell> + + <cell weightx='1' fill='horizontal'> + <JTextField id='firstName' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Last Name:' displayedMnemonic='L' labelFor='{lastName}'/> + </cell> + + <cell fill='horizontal'> + <JTextField id='lastName' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Email Address:' displayedMnemonic='E' labelFor='{email}'/> + </cell> + + <cell fill='horizontal'> + <JTextField id='email' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Comments:' displayedMnemonic='C' labelFor='{comments}'/> + </cell> + + <cell weightx='1' weighty='1' fill='both'> + <JScrollPane width='150' height='75'> + <JTextArea id='comments' styleClass="form"/> + </JScrollPane> + </cell> + </row> + </Table> +</JMenuItemDemo> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JComboBoxDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JComboBoxDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JComboBoxDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<DemoPanel> + <Table id='demoPanel'> + <row> + <cell> + <JLabel text='Button label:'/> + </cell> + + <cell> + <JComboBox id='comboBox' editable='true'> + <item value='OK' selected='true'/> + <item value='Cancel'/> + <item value='Help'/> + </JComboBox> + </cell> + + <cell> + <JButton text='{comboBox.getSelectedItem()}'/> + </cell> + </row> + </Table> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JDialogDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JDialogDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JDialogDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,78 @@ +<DemoPanel> + <script> + String username; + String password; + + private class OKAction extends javax.swing.AbstractAction { + public OKAction() { + putValue(NAME, "OK"); + } + + + public void actionPerformed(ActionEvent e) { + username = usernameField.getText(); + password = new String(passwordField.getPassword()); + dialog.dispose(); + } + } + + + private class CancelAction extends javax.swing.AbstractAction { + public CancelAction() { + putValue(NAME, "Cancel"); + } + + + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + } + + JRootPane rootPane = dialog.getRootPane(); + rootPane.setDefaultButton(ok); + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); + rootPane.getActionMap().put("cancel", new CancelAction()); + </script> + + <JDialog title='Sign on' id='dialog' modal='true' onWindowOpened='dialog.setLocationRelativeTo(demoPanel); + passwordField.setText("");'> + <Table> + <row> + <cell> + <JLabel text='Username:' displayedMnemonic='U' labelFor='{usernameField}'/> + </cell> + + <cell> + <JTextField id='usernameField'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Password:' displayedMnemonic='P' labelFor='{passwordField}'/> + </cell> + + <cell> + <JPasswordField id='passwordField'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0, 6, 6)}'> + <JButton id='ok' text='OK' action='{new OKAction()}'/> + <JButton text='Cancel' action='{new CancelAction()}'/> + </JPanel> + </cell> + </row> + </Table> + </JDialog> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JButton text='Show password dialog' onActionPerformed='dialog.setVisible(true)'/> + <VBox> + <JLabel text='{username != null ? "Username: " + username : ""}'/> + <JLabel text='{password != null ? "Password: " + password : ""}'/> + </VBox> + </VBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JListDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JListDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JListDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,59 @@ +<DemoPanel> + <Table id='demoPanel'> + <row> + <cell> + <JLabel text='Supported Swing components:'/> + </cell> + </row> + + <row> + <cell> + <JScrollPane> + <JList> + <item value='JApplet'/> + <item value='JButton'/> + <item value='JCheckBox'/> + <item value='JCheckBoxMenuItem'/> + <item value='JColorChooser'/> + <item value='JComboBox'/> + <item value='JDesktopPane'/> + <item value='JDialog'/> + <item value='JEditorPane'/> + <item value='JFileChooser'/> + <item value='JFormattedTextField'/> + <item value='JFrame'/> + <item value='JInternalFrame'/> + <item value='JLabel'/> + <item value='JLayeredPane'/> + <item value='JList'/> + <item value='JMenu'/> + <item value='JMenuBar'/> + <item value='JMenuItem'/> + <item value='JOptionPane'/> + <item value='JPanel'/> + <item value='JPasswordField'/> + <item value='JPopupMenu'/> + <item value='JProgressBar'/> + <item value='JRadioButton'/> + <item value='JRadioButtonMenuItem'/> + <item value='JScrollBar'/> + <item value='JScrollPane'/> + <item value='JSeparator'/> + <item value='JSlider'/> + <item value='JSpinner'/> + <item value='JSplitPane'/> + <item value='JTabbedPane'/> + <item value='JTable'/> + <item value='JTextArea'/> + <item value='JTextField'/> + <item value='JTextPane'/> + <item value='JToggleButton'/> + <item value='JToolBar'/> + <item value='JTree'/> + <item value='JWindow'/> + </JList> + </JScrollPane> + </cell> + </row> + </Table> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JMenuItemDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JMenuItemDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JMenuItemDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,23 @@ +<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> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JPasswordFieldDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JPasswordFieldDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JPasswordFieldDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,10 @@ +<DemoPanel> + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <HBox> + <JLabel text='Password:' displayedMnemonic='P' labelFor='{password}'/> + <JPasswordField id='password'/> + </HBox> + + <JLabel text='You entered: {new String(password.getPassword())}'/> + </VBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JProgressBarDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JProgressBarDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JProgressBarDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,72 @@ +<DemoPanel> + <script><![CDATA[ + import javax.swing.Timer; + + int red = 0; + int green = 0; + int blue = 0; + int speed = 2; + int redDirection = 1; + int greenDirection = 1; + int blueDirection = 1; + + Timer redTimer = new Timer(5, new ActionListener() { + public void actionPerformed(ActionEvent e) { + red = Math.max(0, Math.min(255, red + speed * redDirection)); + if (red == 0 || red == 255) + redDirection = -redDirection; + } + }); + + Timer greenTimer = new Timer(50, new ActionListener() { + public void actionPerformed(ActionEvent e) { + green = Math.max(0, Math.min(255, green + speed * greenDirection)); + if (green == 0 || green == 255) + greenDirection = -greenDirection; + } + }); + + Timer blueTimer = new Timer(500, new ActionListener() { + public void actionPerformed(ActionEvent e) { + blue = Math.max(0, Math.min(255, blue + speed * blueDirection)); + if (blue == 0 || blue == 255) + blueDirection = -blueDirection; + } + }); + + redTimer.start(); + greenTimer.start(); + blueTimer.start(); + ]]></script> + + <Table insets='6' id='demoPanel'> + <row> + <cell columns='3'> + <JLabel text='Welcome to the JAXX framework!' font='{UIManager.getFont("Label.font").deriveFont(18f)}' foreground='{new Color(red, green, blue)}'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(red, 0, 0)}' value='{red}' maximum='255'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(0, green, 0)}' value='{green}' maximum='255'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(0, 0, blue)}' value='{blue}' maximum='255'/> + </cell> + </row> + + <row> + <cell weightx='1' anchor='east'><JButton text='Start' onActionPerformed='redTimer.start(); greenTimer.start(); blueTimer.start()'/></cell> + <cell><JButton text='Stop' onActionPerformed='redTimer.stop(); greenTimer.stop(); blueTimer.stop()'/></cell> + </row> + </Table> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,11 @@ +<DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <VBox> + <JRadioButton text='Animal' value='Lynx.jpg' buttonGroup='radioButtons' selected='true'/> + <JRadioButton text='Vegetable' buttonGroup='radioButtons' value='Tomato.jpg'/> + <JRadioButton text='Mineral' buttonGroup='radioButtons' value='Amethyst.jpg'/> + </VBox> + + <JLabel icon='{new ImageIcon(getClass().getResource("images/" + radioButtons.getSelectedValue()))}'/> + </HBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonMenuItemDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonMenuItemDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JRadioButtonMenuItemDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,14 @@ +<JMenuItemDemo> + <JMenuBar id='menuBar'> + <JMenu text='Font size'> + <JRadioButtonMenuItem text='10' value='{new Integer(10)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='12' value='{new Integer(12)}' buttonGroup='fontSize' selected='true'/> + <JRadioButtonMenuItem text='14' value='{new Integer(14)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='18' value='{new Integer(18)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='24' value='{new Integer(24)}' buttonGroup='fontSize'/> + </JMenu> + </JMenuBar> + + <JLabel id='demoMessage' text='Font size: {fontSize.getSelectedValue()}' horizontalAlignment='center' + font='{UIManager.getFont("Label.font").deriveFont(fontSize.getSelectedValue() != null ? (float) ((Integer) fontSize.getSelectedValue()).intValue() : 12)}'/> +</JMenuItemDemo> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSliderDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSliderDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSliderDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,12 @@ +<DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <VBox> + <JSlider id='red' maximum='255' value='200'/> + <JSlider id='green' maximum='255' value='180'/> + <JSlider id='blue' maximum='255' value='240'/> + </VBox> + + <JPanel border='{BorderFactory.createEtchedBorder()}' width='64' height='64' + background='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> + </HBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSpinnerDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSpinnerDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSpinnerDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,13 @@ +<DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> + + <JSpinner minimum='0' maximum='50' id='spinner'/> + + <VBox spacing='{((Integer) spinner.getValue()).intValue()}'> + <JLabel text='Use the spinner to'/> + <JLabel text='adjust the spacing'/> + <JLabel text='between these lines'/> + </VBox> + </HBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSplitPaneDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSplitPaneDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JSplitPaneDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,13 @@ +<DemoPanel> + <JPanel id='demoPanel' layout='{new BorderLayout()}'> + <JSplitPane> + <JScrollPane> + <JLabel icon='{new ImageIcon(getClass().getResource("images/Amethyst.jpg"))}'/> + </JScrollPane> + + <JScrollPane> + <JLabel icon='{new ImageIcon(getClass().getResource("images/Lynx.jpg"))}'/> + </JScrollPane> + </JSplitPane> + </JPanel> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextAreaDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextAreaDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextAreaDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,33 @@ +<DemoPanel> + <Table id='demoPanel' anchor='northwest'> + <row> + <cell> + <JLabel text='Normal text:' displayedMnemonic='N' labelFor='{textArea}'/> + </cell> + + <cell weightx='1' fill='both'> + <JScrollPane height='120'> + <JTextArea id='textArea' text='Try typing some text here.'/> + </JScrollPane> + </cell> + </row> + + <row> + <cell> + <JLabel text='Upper case text:'/> + </cell> + + <cell weightx='1' fill='both'> + <JScrollPane height='120'> + <JTextArea editable='false' background='{null}' text='{textArea.getText().toUpperCase()}'/> + </JScrollPane> + </cell> + </row> + + <row> + <cell weighty='1'> + <JPanel/> + </cell> + </row> + </Table> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextFieldDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextFieldDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JTextFieldDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<DemoPanel> + <JPanel id='demoPanel'> + <Table> + <row> + <cell> + <JLabel text='Your name:' displayedMnemonic='n' labelFor='{textField}'/> + </cell> + + <cell> + <JTextField id='textField'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JButton text='Greet' onActionPerformed='JOptionPane.showMessageDialog(demoPanel, "Hello, " + textField.getText() + "!")'/> + </cell> + </row> + </Table> + </JPanel> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JToggleButtonDemo.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JToggleButtonDemo.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/JToggleButtonDemo.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,9 @@ +<DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JToggleButton text='1' id='one'/> + <JToggleButton text='2' id='two'/> + <JToggleButton text='3' id='three'/> + + <JLabel text='Total: {(one.isSelected() ? 1 : 0) + (two.isSelected() ? 2 : 0) + (three.isSelected() ? 3 : 0)}'/> + </HBox> +</DemoPanel> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Amethyst.jpg =================================================================== (Binary files differ) Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Amethyst.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Lynx.jpg =================================================================== (Binary files differ) Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Lynx.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Tomato.jpg =================================================================== (Binary files differ) Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/Tomato.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/pencil_black.gif =================================================================== (Binary files differ) Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/java/examples/Components/images/pencil_black.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/sun.jnlp =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/sun.jnlp (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/sun.jnlp 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> + <information> + <title>Sun MicroSystems</title> + <vendor>Sun MicroSystems, Inc.</vendor> + <offline-allowed/> + </information> + <resources> + <jar href="lib/@help@"/> + </resources> + <component-desc/> +</jnlp> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/template.vm =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/template.vm (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/src/main/jnlp/template.vm 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp + spec="1.0+" + codebase="$project.Url" href="$outputFile"> + <information> + <title>$informationTitle</title> + <vendor>$informationVendor</vendor> + <homepage href="$informationHomepage" /> + <description>$informationDescription</description> + <offline-allowed /> + </information> + <resources> + <j2se version="1.5+" max-heap-size="512m"/> + $dependencies + <extension name="sun" href="sun.jnlp"/> + </resources> + <security> + <all-permissions /> + </security> + <application-desc main-class="$mainClass" /> +</jnlp> Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinjaxx</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>Counter</artifactId> + + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-core</artifactId> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Counter example</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx Calculator example</description> + <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + + <properties> + <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + + <!-- jnlp --> + <keystorepath>${keystorepath}</keystorepath> + <keystorealias>CodeLutin</keystorealias> + <keystorepass>codelutin</keystorepass> + + </properties> + + <build> + <finalName>${project.artifactId}</finalName> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/src/main/java</src> + <force>true</force> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>${maven.jar.main.class}</mainClass> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> + <execution> + <id>JnlpSun</id> + <phase>package</phase> + <configuration> + <tasks> + <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" + todir="${project.basedir}/target/jnlp"> + <filterset> + <filter token="help" value="javahelp-2.0.02.jar"/> + <filter token="url" value="${project.url}"/> + </filterset> + </copy> + <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" + todir="${project.basedir}/target/jnlp/lib"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <dependencies> + <excludes> + <exclude>javax.help:javahelp</exclude> + </excludes> + </dependencies> + <libPath>lib</libPath> + <jnlp> + <outputFile>launch-${project.artifactId}.jnlp</outputFile> + <mainClass>${maven.jar.main.class}</mainClass> + </jnlp> + + <sign> + <keystore>${keystorepath}</keystore> + <keypass/> + <storepass>${keystorepass}</storepass> + <storetype/> + <alias>${keystorealias}</alias> + <validity/> + <dnameCn/> + <dnameOu/> + <dnameO/> + <dnameL/> + <dnameSt/> + <dnameC/> + <verify>false</verify> + <keystoreConfig> + <delete>false</delete> + <gen>false</gen> + </keystoreConfig> + </sign> + + + <pack200>false</pack200> + <gzip>true</gzip> + <verbose>false</verbose> + </configuration> + </plugin> + + </plugins> + </build> +</project> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/Counter/Counter.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/Counter/Counter.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/java/examples/Counter/Counter.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,9 @@ +<Application title="Counter"> + <script>int count;</script> + <JTextField text='{count}' constraints='BorderLayout.NORTH'/> + <HBox constraints='BorderLayout.SOUTH'> + <JButton text='Dec (-)' onActionPerformed='count--'/> + <JButton text='Reset' onActionPerformed='count = 0'/> + <JButton text='Inc (+)' onActionPerformed='count++'/> + </HBox> +</Application> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/sun.jnlp =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/sun.jnlp (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/sun.jnlp 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> + <information> + <title>Sun MicroSystems</title> + <vendor>Sun MicroSystems, Inc.</vendor> + <offline-allowed/> + </information> + <resources> + <jar href="lib/@help@"/> + </resources> + <component-desc/> +</jnlp> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/template.vm =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/template.vm (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/src/main/jnlp/template.vm 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp + spec="1.0+" + codebase="$project.Url" href="$outputFile"> + <information> + <title>$informationTitle</title> + <vendor>$informationVendor</vendor> + <homepage href="$informationHomepage" /> + <description>$informationDescription</description> + <offline-allowed /> + </information> + <resources> + <j2se version="1.5+" max-heap-size="512m"/> + $dependencies + <extension name="sun" href="sun.jnlp"/> + </resources> + <security> + <all-permissions /> + </security> + <application-desc main-class="$mainClass" /> +</jnlp> Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinjaxx</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>LabelStyle</artifactId> + + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-core</artifactId> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>LabelStyle example</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx Calculator example</description> + <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + + <properties> + <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + + <!-- jnlp --> + <keystorepath>${keystorepath}</keystorepath> + <keystorealias>CodeLutin</keystorealias> + <keystorepass>codelutin</keystorepass> + + </properties> + + <build> + <finalName>${project.artifactId}</finalName> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/src/main/java</src> + <force>true</force> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>${maven.jar.main.class}</mainClass> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> + <execution> + <id>JnlpSun</id> + <phase>package</phase> + <configuration> + <tasks> + <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" + todir="${project.basedir}/target/jnlp"> + <filterset> + <filter token="help" value="javahelp-2.0.02.jar"/> + <filter token="url" value="${project.url}"/> + </filterset> + </copy> + <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" + todir="${project.basedir}/target/jnlp/lib"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <dependencies> + <excludes> + <exclude>javax.help:javahelp</exclude> + </excludes> + </dependencies> + <libPath>lib</libPath> + <jnlp> + <outputFile>launch-${project.artifactId}.jnlp</outputFile> + <mainClass>${maven.jar.main.class}</mainClass> + </jnlp> + + <sign> + <keystore>${keystorepath}</keystore> + <keypass/> + <storepass>${keystorepass}</storepass> + <storetype/> + <alias>${keystorealias}</alias> + <validity/> + <dnameCn/> + <dnameOu/> + <dnameO/> + <dnameL/> + <dnameSt/> + <dnameC/> + <verify>false</verify> + <keystoreConfig> + <delete>false</delete> + <gen>false</gen> + </keystoreConfig> + </sign> + + + <pack200>false</pack200> + <gzip>true</gzip> + <verbose>false</verbose> + </configuration> + </plugin> + + </plugins> + </build> +</project> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.css =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.css (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.css 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,34 @@ +JSlider { + paintTicks: true; +} + +JSlider.color { + minorTickSpacing: 10; + majorTickSpacing: 50; + border: { BorderFactory.createEmptyBorder(1, 1, 1, 1) }; +} + +JSlider.color:focused { + border: { BorderFactory.createLineBorder(Color.BLACK, 1) }; +} + +JSlider#red:focused { + background: #E7ADAD; +} + +JSlider#green:focused { + background: #B2E7AD; +} + +JSlider#blue:focused { + background: #ADB2E7; +} + +JSlider#dummySize { + minorTickSpacing: 2; + majorTickSpacing: 6; +} + +JRadioButton { + enabled: { backgroundCheckbox.isSelected() }; +} \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/java/examples/LabelStyle/LabelStyle.jaxx 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,64 @@ +<Application title="LabelStyle.jaxx"> + <style source="LabelStyle.css"/> + + <Table 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> +</Application> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/sun.jnlp =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/sun.jnlp (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/sun.jnlp 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> + <information> + <title>Sun MicroSystems</title> + <vendor>Sun MicroSystems, Inc.</vendor> + <offline-allowed/> + </information> + <resources> + <jar href="lib/@help@"/> + </resources> + <component-desc/> +</jnlp> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/template.vm =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/template.vm (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/template.vm 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp + spec="1.0+" + codebase="$project.Url" href="$outputFile"> + <information> + <title>$informationTitle</title> + <vendor>$informationVendor</vendor> + <homepage href="$informationHomepage" /> + <description>$informationDescription</description> + <offline-allowed /> + </information> + <resources> + <j2se version="1.5+" max-heap-size="512m"/> + $dependencies + <extension name="sun" href="sun.jnlp"/> + </resources> + <security> + <all-permissions /> + </security> + <application-desc main-class="$mainClass" /> +</jnlp> Added: lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java 2008-10-15 12:00:26 UTC (rev 910) @@ -0,0 +1,99 @@ +package org.codelutin.jaxx; + +import junit.framework.TestCase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.VerificationException; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** @author chemit */ +public class BuildExamples extends TestCase { + + protected static final Log log = LogFactory.getLog(BuildExamples.class); + + protected File srcDir; + + protected File destDir; + + protected File siteDir; + protected File siteDestDir; + + protected Verifier verifier; + + protected File getBasedir() { + String b = System.getenv("basedir"); + if (b == null) { + b = new File("").getAbsolutePath(); + } + return new File(b); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + log.info("start " + getName()); + String dirname = getName().substring(4); + + srcDir = new File(getBasedir(), "src" + File.separator + "examples" + File.separator + dirname); + destDir = new File(getBasedir(), "target" + File.separator + "examples" + File.separator + dirname); + siteDestDir = new File(getBasedir(), "target" + File.separator + "generated-site" + File.separator + "resources" + File.separator + "examples"); + siteDir = new File(destDir, "target" + File.separator + "jnlp"); + + destDir.mkdirs(); + + FileUtils.copyDirectoryStructure(srcDir, destDir); + + verifier = new Verifier(destDir.getAbsolutePath(), true); + + List<String> cliOptions = new ArrayList<String>(); + cliOptions.add("-Dmaven.verbose=true"); + verifier.setCliOptions(cliOptions); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + srcDir = destDir = null; + if (verifier != null) { + verifier.resetStreams(); + verifier = null; + } + } + + /** + * fixme : make this test works again. + * + * @throws Exception if any + */ + public void estComponents() throws Exception { + buildExample(); + } + + public void testCalculator() throws Exception { + buildExample(); + } + + public void testCounter() throws Exception { + buildExample(); + } + + public void testLabelStyle() throws Exception { + buildExample(); + } + + protected void buildExample() throws VerificationException, IOException { + verifier.executeGoals(Arrays.asList("jaxx:generate", "package")); + verifier.verifyErrorFreeLog(); + FileUtils.copyDirectory(new File(siteDir, "lib"), new File(siteDestDir,"lib")); + FileUtils.copyDirectory(siteDir, siteDestDir,"*.jnlp",""); + } + + +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org