. For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml;
-
-import org.swixml.converters.ImageIconConverter;
-
-import javax.swing.*;
-import java.util.StringTokenizer;
-
-/**
- * XSplitPane simple extends JSplitPane to clear components
- * during the construction process
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- */
-
-public class XTabbedPane extends JTabbedPane {
-
- /**
- * Sets the title for all tabs.
- * An internal exception is raised if there is no tab at that index.
- *
- * @param titles String comma sep. list of titles, for all tabs
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- */
- public void setTitles( String titles ) {
- StringTokenizer st = new StringTokenizer( titles, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setTitleAt( i, st.nextToken().trim() );
- }
- }
-
-
- /**
- * Sets the keyboard mnemonic for accessing the specified tab.
- * The mnemonic is the key which when combined with the look and feel's
- * mouseless modifier (usually Alt) will activate the specified
- * tab.
- *
- * A mnemonic must correspond to a single key on the keyboard
- * and should be specified using one of the VK_XXX
- * keycodes defined in java.awt.event.KeyEvent.
- * Mnemonics are case-insensitive, therefore a key event
- * with the corresponding keycode would cause the button to be
- * activated whether or not the Shift modifier was pressed.
- *
- * This will update the displayed mnemonic property for the specified
- * tab.
- *
- * @since 1.4
- * @param mnemonics String comma sep. list of mnemonic, for all tabs
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- * @see #getMnemonicAt(int)
- * @see #setDisplayedMnemonicIndexAt(int,int)
- */
- public void setMnemonics( String mnemonics ) {
- StringTokenizer st = new StringTokenizer( mnemonics, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setMnemonicAt( i, Integer.parseInt( st.nextToken().trim() ) );
- }
- }
-
-
- /**
- * Provides a hint to the look and feel as to which character in the
- * text should be decorated to represent the mnemonic. Not all look and
- * feels may support this. A value of -1 indicates either there is
- * no mnemonic for this tab, or you do not wish the mnemonic to be
- * displayed for this tab.
- *
- * The value of this is updated as the properties relating to the
- * mnemonic change (such as the mnemonic itself, the text...).
- * You should only ever have to call this if
- * you do not wish the default character to be underlined. For example, if
- * the text at tab index 3 was 'Apple Price', with a mnemonic of 'p',
- * and you wanted the 'P'
- * to be decorated, as 'Apple Price', you would have to invoke
- * setDisplayedMnemonicIndex(3, 6) after invoking
- * setMnemonicAt(3, KeyEvent.VK_P).
- *
Note that it is the programmer's responsibility to ensure
- * that each tab has a unique mnemonic or unpredictable results may
- * occur.
- *
- * @since 1.4
-
- * @param displaymnemonics String comma sep. list of index into the String
- * to underline for all tabs
- * @exception IndexOutOfBoundsException if tabIndex is
- * out of range (tabIndex < 0 || tabIndex >= tab
- * count)
- * @exception IllegalArgumentException will be thrown if
- * mnemonicIndex is >= length of the tab
- * title , or < -1
- * @see #setMnemonicAt(int,int)
- * @see #getDisplayedMnemonicIndexAt(int)
- */
- public void setDisplayedMnemonics( String displaymnemonics ) {
- StringTokenizer st = new StringTokenizer( displaymnemonics, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setDisplayedMnemonicIndexAt( i, Integer.parseInt( st.nextToken().trim() ) );
- }
- }
-
- /**
- * Sets whether or not the tab at index is enabled.
- * An internal exception is raised if there is no tab at that index.
- *
- * @param enabled String comma sep. list of booleans, if or not the tab should be enabled
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- *
- * @see #isEnabledAt
- */
- public void setEnabled( String enabled ) {
- StringTokenizer st = new StringTokenizer( enabled, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setEnabledAt( i, Boolean.valueOf( st.nextToken().trim() ).booleanValue() );
- }
- }
-
-
- /**
- * Sets the tooltip text at index to toolTipText
- * which can be null.
- * An internal exception is raised if there is no tab at that index.
- *
- * @param toolTipTexts String comma sep. list of tooltip texts to be displayed for all the tabs
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- *
- * @see #getToolTipTextAt
- */
- public void setToolTipTexts( String toolTipTexts ) {
- StringTokenizer st = new StringTokenizer( toolTipTexts, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setToolTipTextAt( i, st.nextToken().trim() );
- }
- }
-
-
- /**
- * Sets the icons for all tabs. Does not set disabled icon at icon
- * To set disabled icon, use setDisableIconAt().
- * An internal exception is raised if there is no tab at that index.
- *
- * @param icons String comma sep. list of icons to be displayed in alls tabs
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- *
- * @see #setDisabledIconAt
- * @see #getIconAt
- */
- public void setIcons( String icons ) {
- StringTokenizer st = new StringTokenizer( icons, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setIconAt( i, (ImageIcon) ImageIconConverter.conv( null, new Attribute("icon", st.nextToken()), null ) );
- }
- }
-
-
- /**
- * Sets the disabled icon at index to icon
- * which can be null.
- * An internal exception is raised if there is no tab at that index.
- *
- * @param icons String comma sep. list of icons to be displayed in alls tabs
- * @exception IndexOutOfBoundsException if index is out of range
- * (index < 0 || index >= tab count)
- *
- * @see #getDisabledIconAt
- */
- public void setDisabledIcons( String icons ) {
- StringTokenizer st = new StringTokenizer( icons, "," );
- int n = st.countTokens();
- for (int i = 0; i < n; i++) {
- super.setDisabledIconAt( i, (ImageIcon) ImageIconConverter.conv( null, new Attribute("icon", st.nextToken()), null ) );
- }
- }
-}
-
+/*--
+ $Id: XTabbedPane.java,v 1.1 2004/03/01 07:56:09 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml;
+
+import org.swixml.converters.ImageIconConverter;
+
+import javax.swing.*;
+import java.util.StringTokenizer;
+
+/**
+ * XSplitPane simple extends JSplitPane to clear components
+ * during the construction process
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ */
+
+public class XTabbedPane extends JTabbedPane {
+
+ /**
+ * Sets the title for all tabs.
+ * An internal exception is raised if there is no tab at that index.
+ *
+ * @param titles String comma sep. list of titles, for all tabs
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ */
+ public void setTitles( String titles ) {
+ StringTokenizer st = new StringTokenizer( titles, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setTitleAt( i, st.nextToken().trim() );
+ }
+ }
+
+
+ /**
+ * Sets the keyboard mnemonic for accessing the specified tab.
+ * The mnemonic is the key which when combined with the look and feel's
+ * mouseless modifier (usually Alt) will activate the specified
+ * tab.
+ *
+ * A mnemonic must correspond to a single key on the keyboard
+ * and should be specified using one of the VK_XXX
+ * keycodes defined in java.awt.event.KeyEvent.
+ * Mnemonics are case-insensitive, therefore a key event
+ * with the corresponding keycode would cause the button to be
+ * activated whether or not the Shift modifier was pressed.
+ *
+ * This will update the displayed mnemonic property for the specified
+ * tab.
+ *
+ * @since 1.4
+ * @param mnemonics String comma sep. list of mnemonic, for all tabs
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ * @see #getMnemonicAt(int)
+ * @see #setDisplayedMnemonicIndexAt(int,int)
+ */
+ public void setMnemonics( String mnemonics ) {
+ StringTokenizer st = new StringTokenizer( mnemonics, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setMnemonicAt( i, Integer.parseInt( st.nextToken().trim() ) );
+ }
+ }
+
+
+ /**
+ * Provides a hint to the look and feel as to which character in the
+ * text should be decorated to represent the mnemonic. Not all look and
+ * feels may support this. A value of -1 indicates either there is
+ * no mnemonic for this tab, or you do not wish the mnemonic to be
+ * displayed for this tab.
+ *
+ * The value of this is updated as the properties relating to the
+ * mnemonic change (such as the mnemonic itself, the text...).
+ * You should only ever have to call this if
+ * you do not wish the default character to be underlined. For example, if
+ * the text at tab index 3 was 'Apple Price', with a mnemonic of 'p',
+ * and you wanted the 'P'
+ * to be decorated, as 'Apple Price', you would have to invoke
+ * setDisplayedMnemonicIndex(3, 6) after invoking
+ * setMnemonicAt(3, KeyEvent.VK_P).
+ *
Note that it is the programmer's responsibility to ensure
+ * that each tab has a unique mnemonic or unpredictable results may
+ * occur.
+ *
+ * @since 1.4
+
+ * @param displaymnemonics String comma sep. list of index into the String
+ * to underline for all tabs
+ * @exception IndexOutOfBoundsException if tabIndex is
+ * out of range (tabIndex < 0 || tabIndex >= tab
+ * count)
+ * @exception IllegalArgumentException will be thrown if
+ * mnemonicIndex is >= length of the tab
+ * title , or < -1
+ * @see #setMnemonicAt(int,int)
+ * @see #getDisplayedMnemonicIndexAt(int)
+ */
+ public void setDisplayedMnemonics( String displaymnemonics ) {
+ StringTokenizer st = new StringTokenizer( displaymnemonics, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setDisplayedMnemonicIndexAt( i, Integer.parseInt( st.nextToken().trim() ) );
+ }
+ }
+
+ /**
+ * Sets whether or not the tab at index is enabled.
+ * An internal exception is raised if there is no tab at that index.
+ *
+ * @param enabled String comma sep. list of booleans, if or not the tab should be enabled
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ *
+ * @see #isEnabledAt
+ */
+ public void setEnabled( String enabled ) {
+ StringTokenizer st = new StringTokenizer( enabled, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setEnabledAt( i, Boolean.valueOf( st.nextToken().trim() ).booleanValue() );
+ }
+ }
+
+
+ /**
+ * Sets the tooltip text at index to toolTipText
+ * which can be null.
+ * An internal exception is raised if there is no tab at that index.
+ *
+ * @param toolTipTexts String comma sep. list of tooltip texts to be displayed for all the tabs
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ *
+ * @see #getToolTipTextAt
+ */
+ public void setToolTipTexts( String toolTipTexts ) {
+ StringTokenizer st = new StringTokenizer( toolTipTexts, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setToolTipTextAt( i, st.nextToken().trim() );
+ }
+ }
+
+
+ /**
+ * Sets the icons for all tabs. Does not set disabled icon at icon
+ * To set disabled icon, use setDisableIconAt().
+ * An internal exception is raised if there is no tab at that index.
+ *
+ * @param icons String comma sep. list of icons to be displayed in alls tabs
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ *
+ * @see #setDisabledIconAt
+ * @see #getIconAt
+ */
+ public void setIcons( String icons ) {
+ StringTokenizer st = new StringTokenizer( icons, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setIconAt( i, (ImageIcon) ImageIconConverter.conv( null, new Attribute("icon", st.nextToken()), null ) );
+ }
+ }
+
+
+ /**
+ * Sets the disabled icon at index to icon
+ * which can be null.
+ * An internal exception is raised if there is no tab at that index.
+ *
+ * @param icons String comma sep. list of icons to be displayed in alls tabs
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ *
+ * @see #getDisabledIconAt
+ */
+ public void setDisabledIcons( String icons ) {
+ StringTokenizer st = new StringTokenizer( icons, "," );
+ int n = st.countTokens();
+ for (int i = 0; i < n; i++) {
+ super.setDisabledIconAt( i, (ImageIcon) ImageIconConverter.conv( null, new Attribute("icon", st.nextToken()), null ) );
+ }
+ }
+}
+
diff --git a/src/main/java/org/swixml/XTitledSeparator.java b/swixml-core/src/main/java/org/swixml/XTitledSeparator.java
similarity index 97%
rename from src/main/java/org/swixml/XTitledSeparator.java
rename to swixml-core/src/main/java/org/swixml/XTitledSeparator.java
index 78ad0c7..ffced83 100644
--- a/src/main/java/org/swixml/XTitledSeparator.java
+++ b/swixml-core/src/main/java/org/swixml/XTitledSeparator.java
@@ -1,115 +1,115 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml;
-
-import java.awt.BorderLayout;
-import javax.swing.JComponent;
-import javax.swing.SwingConstants;
-
-import com.jgoodies.forms.factories.DefaultComponentFactory;
-
-/**
- * A wrapper class for JGoodies Forms ComponentFactory.createSeparator(),
- * which creates a titled separator.
- *
- * @author Karl Tauber
- */
-public class XTitledSeparator extends JComponent {
-
- private String text;
- private int alignment = SwingConstants.LEFT;
-
- public XTitledSeparator() {
- super();
- setLayout(new BorderLayout());
- update();
- }
-
- private void update() {
- removeAll();
- add( DefaultComponentFactory.getInstance().createSeparator(text, alignment));
- }
-
- /**
- * Returns the title of the separator.
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the title of the separator.
- */
- public void setText( String text ) {
- this.text = text;
- update();
- }
-
- /**
- * Returns the title alignment.
- * One of SwingConstants.LEFT, SwingConstants.CENTER
- * or SwingConstants.RIGHT.
- */
- public int getAlignment() {
- return alignment;
- }
-
- /**
- * Sets the title alignment.
- * One of SwingConstants.LEFT, SwingConstants.CENTER
- * or SwingConstants.RIGHT.
- */
- public void setAlignment( int alignment ) {
- this.alignment = alignment;
- update();
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml;
+
+import java.awt.BorderLayout;
+import javax.swing.JComponent;
+import javax.swing.SwingConstants;
+
+import com.jgoodies.forms.factories.DefaultComponentFactory;
+
+/**
+ * A wrapper class for JGoodies Forms ComponentFactory.createSeparator(),
+ * which creates a titled separator.
+ *
+ * @author Karl Tauber
+ */
+public class XTitledSeparator extends JComponent {
+
+ private String text;
+ private int alignment = SwingConstants.LEFT;
+
+ public XTitledSeparator() {
+ super();
+ setLayout(new BorderLayout());
+ update();
+ }
+
+ private void update() {
+ removeAll();
+ add( DefaultComponentFactory.getInstance().createSeparator(text, alignment));
+ }
+
+ /**
+ * Returns the title of the separator.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Sets the title of the separator.
+ */
+ public void setText( String text ) {
+ this.text = text;
+ update();
+ }
+
+ /**
+ * Returns the title alignment.
+ * One of SwingConstants.LEFT, SwingConstants.CENTER
+ * or SwingConstants.RIGHT.
+ */
+ public int getAlignment() {
+ return alignment;
+ }
+
+ /**
+ * Sets the title alignment.
+ * One of SwingConstants.LEFT, SwingConstants.CENTER
+ * or SwingConstants.RIGHT.
+ */
+ public void setAlignment( int alignment ) {
+ this.alignment = alignment;
+ update();
+ }
+}
diff --git a/src/main/java/org/swixml/XVBox.java b/swixml-core/src/main/java/org/swixml/XVBox.java
similarity index 97%
rename from src/main/java/org/swixml/XVBox.java
rename to swixml-core/src/main/java/org/swixml/XVBox.java
index 194fb25..923c465 100755
--- a/src/main/java/org/swixml/XVBox.java
+++ b/swixml-core/src/main/java/org/swixml/XVBox.java
@@ -1,69 +1,69 @@
-/*--
- $Id: XVBox.java,v 1.1 2004/03/01 07:56:09 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import javax.swing.*;
-
-/**
- * XVBox simply extends the Box container
- * but ceates a vertical Box.
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- */
-public class XVBox extends Box {
-
- public XVBox() {
- super( BoxLayout.Y_AXIS );
- }
-}
+/*--
+ $Id: XVBox.java,v 1.1 2004/03/01 07:56:09 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import javax.swing.*;
+
+/**
+ * XVBox simply extends the Box container
+ * but ceates a vertical Box.
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ */
+public class XVBox extends Box {
+
+ public XVBox() {
+ super( BoxLayout.Y_AXIS );
+ }
+}
diff --git a/swixml-core/src/main/java/org/swixml/converters/.gitignore b/swixml-core/src/main/java/org/swixml/converters/.gitignore
new file mode 100644
index 0000000..fdb381f
--- /dev/null
+++ b/swixml-core/src/main/java/org/swixml/converters/.gitignore
@@ -0,0 +1 @@
+/*.DS_Store
diff --git a/src/main/java/org/swixml/converters/ActionConverter.java b/swixml-core/src/main/java/org/swixml/converters/ActionConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/ActionConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/ActionConverter.java
index 5fa544d..9c13699 100755
--- a/src/main/java/org/swixml/converters/ActionConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/ActionConverter.java
@@ -1,91 +1,91 @@
-/*--
- $Id: ActionConverter.java,v 1.1 2004/03/01 07:55:57 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import javax.swing.*;
-
-
-/**
- * The ActionConverter is a tagging class that is only used to regsiter the Action.class
- * with the ConverterLibrary
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- *
- * @since swixml 1.0
- */
-public class ActionConverter implements Converter {
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param type Class Data type to which the Attribute's value should be converted
- * @param attr Attribute the attribute, providing the value to be converted.
- *
- */
- public Object convert( Class type, Attribute attr, Localizer localizer ) throws Exception {
- return null;
- }
-
- /**
- * A conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return Action.class;
- }
-}
+/*--
+ $Id: ActionConverter.java,v 1.1 2004/03/01 07:55:57 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import javax.swing.*;
+
+
+/**
+ * The ActionConverter is a tagging class that is only used to regsiter the Action.class
+ * with the ConverterLibrary
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ *
+ * @since swixml 1.0
+ */
+public class ActionConverter implements Converter {
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param type Class Data type to which the Attribute's value should be converted
+ * @param attr Attribute the attribute, providing the value to be converted.
+ *
+ */
+ public Object convert( Class type, Attribute attr, Localizer localizer ) throws Exception {
+ return null;
+ }
+
+ /**
+ * A conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return Action.class;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/BorderConverter.java b/swixml-core/src/main/java/org/swixml/converters/BorderConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/BorderConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/BorderConverter.java
index f7eebd3..e0d52cb 100755
--- a/src/main/java/org/swixml/converters/BorderConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/BorderConverter.java
@@ -1,181 +1,181 @@
-/*--
- $Id: BorderConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.ConverterLibrary;
-import org.swixml.Localizer;
-import org.swixml.SwingEngine;
-
-import javax.swing.*;
-import javax.swing.border.Border;
-import java.lang.reflect.Method;
-import java.util.StringTokenizer;
-
-/**
- * The BorderConverter class defines a converter that creates Border objects based on a provided String.
- * The BorderConverter internally uses the javax.swing.BorderFactory and its static create.. methods
- * to instatiate differnt kinds of borders, based on the given String.
- * Additional parameters to create a border need to be comma separated and enclosed in parentheses.
- * Parameter types get converted through the ConverterLibrary. Therefore, only parameter classes are supported that
- * have registered converters in the ConverLibrary.
- * Examples for Valid XML attribute notations:
- *
- *
- * - border="MatteBorder(4,4,4,4,red)"
- * - border="EmptyBorder(5,5,5,5)"
- * - border="TitledBorder(My Title)"
- * - border="RaisedBevelBorder"
- * - border="TitledBorder(TitledBorder, myTitle, TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM, VERDANA-BOLD-18, blue)"
- *
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see javax.swing.BorderFactory
- * @see javax.swing.border.AbstractBorder
- * @see org.swixml.ConverterLibrary
- */
-public class BorderConverter implements Converter {
- /**
- * converter's return type
- */
- public static final Class TEMPLATE = Border.class;
-
- /**
- * all methods the BorderFactory provides
- */
- private static final Method[] METHODS = BorderFactory.class.getMethods();
-
- /**
- * Returns a javax.swing Border
- *
- * @param type Class not used
- * @param attr Attribute value needs to provide Border type name and optional parameter
- * @return Object runtime type is subclass of AbstractBorder
- */
- public Object convert(final Class type, final Attribute attr, Localizer localizer) {
- Border border = null;
- StringTokenizer st = new StringTokenizer(attr.getValue(), "(,)"); // border type + parameters
- int n = st.countTokens() - 1; // number of parameter to create a border
- String borderType = st.nextToken().trim();
- Method method = null;
- ConverterLibrary cvtlib = ConverterLibrary.getInstance();
- //
- // Special case for single parameter construction, give priority to String Type
- //
- if (n == 0) {
- try {
- method = BorderFactory.class.getMethod("create" + borderType);
-
- } catch (NoSuchMethodException e) {
- // intent. empty
- }
- if (method == null) { // try with empty string
- n = 1;
- st = new StringTokenizer(" ", "(,)");
- }
- }
- if (n == 1) {
- try {
- method = BorderFactory.class.getMethod("create" + borderType, new Class[]{String.class});
- } catch (NoSuchMethodException e) {
- // no need to do anything here.
- }
- }
- for (int i = 0; method == null && i < METHODS.length; i++) {
- if (METHODS[i].getParameterTypes().length == n && METHODS[i].getName().endsWith(borderType)) {
- method = METHODS[i];
-
- for (int j = 0; j < method.getParameterTypes().length; j++) {
- if (String.class.equals(method.getParameterTypes()[j])) {
- continue;
- }
- if (null == cvtlib.getConverter(method.getParameterTypes()[j])) {
- method = null;
- break;
- }
- }
- }
- }
- try {
- Object[] args = new Object[n];
- for (int i = 0; i < n; i++) { // fill argument array
- Converter converter = cvtlib.getConverter(method.getParameterTypes()[i]);
- Attribute attrib = new Attribute(String.class.equals(converter.convertsTo()) ? "title" : "NA", st.nextToken().trim());
- if (converter != null) {
- args[i] = converter.convert(method.getParameterTypes()[i], attrib, localizer);
- } else {
- args[i] = attrib.getValue();
- }
- }
- border = (Border) method.invoke(null, args);
- } catch (Exception e) {
- if (SwingEngine.DEBUG_MODE)
- System.err.println("Couldn't create border, " + attr.getValue() + "\n" + e.getMessage());
- }
- return border;
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- *
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: BorderConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.ConverterLibrary;
+import org.swixml.Localizer;
+import org.swixml.SwingEngine;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import java.lang.reflect.Method;
+import java.util.StringTokenizer;
+
+/**
+ * The BorderConverter class defines a converter that creates Border objects based on a provided String.
+ * The BorderConverter internally uses the javax.swing.BorderFactory and its static create.. methods
+ * to instatiate differnt kinds of borders, based on the given String.
+ * Additional parameters to create a border need to be comma separated and enclosed in parentheses.
+ * Parameter types get converted through the ConverterLibrary. Therefore, only parameter classes are supported that
+ * have registered converters in the ConverLibrary.
+ * Examples for Valid XML attribute notations:
+ *
+ *
+ * - border="MatteBorder(4,4,4,4,red)"
+ * - border="EmptyBorder(5,5,5,5)"
+ * - border="TitledBorder(My Title)"
+ * - border="RaisedBevelBorder"
+ * - border="TitledBorder(TitledBorder, myTitle, TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM, VERDANA-BOLD-18, blue)"
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see javax.swing.BorderFactory
+ * @see javax.swing.border.AbstractBorder
+ * @see org.swixml.ConverterLibrary
+ */
+public class BorderConverter implements Converter {
+ /**
+ * converter's return type
+ */
+ public static final Class TEMPLATE = Border.class;
+
+ /**
+ * all methods the BorderFactory provides
+ */
+ private static final Method[] METHODS = BorderFactory.class.getMethods();
+
+ /**
+ * Returns a javax.swing Border
+ *
+ * @param type Class not used
+ * @param attr Attribute value needs to provide Border type name and optional parameter
+ * @return Object runtime type is subclass of AbstractBorder
+ */
+ public Object convert(final Class type, final Attribute attr, Localizer localizer) {
+ Border border = null;
+ StringTokenizer st = new StringTokenizer(attr.getValue(), "(,)"); // border type + parameters
+ int n = st.countTokens() - 1; // number of parameter to create a border
+ String borderType = st.nextToken().trim();
+ Method method = null;
+ ConverterLibrary cvtlib = ConverterLibrary.getInstance();
+ //
+ // Special case for single parameter construction, give priority to String Type
+ //
+ if (n == 0) {
+ try {
+ method = BorderFactory.class.getMethod("create" + borderType);
+
+ } catch (NoSuchMethodException e) {
+ // intent. empty
+ }
+ if (method == null) { // try with empty string
+ n = 1;
+ st = new StringTokenizer(" ", "(,)");
+ }
+ }
+ if (n == 1) {
+ try {
+ method = BorderFactory.class.getMethod("create" + borderType, new Class[]{String.class});
+ } catch (NoSuchMethodException e) {
+ // no need to do anything here.
+ }
+ }
+ for (int i = 0; method == null && i < METHODS.length; i++) {
+ if (METHODS[i].getParameterTypes().length == n && METHODS[i].getName().endsWith(borderType)) {
+ method = METHODS[i];
+
+ for (int j = 0; j < method.getParameterTypes().length; j++) {
+ if (String.class.equals(method.getParameterTypes()[j])) {
+ continue;
+ }
+ if (null == cvtlib.getConverter(method.getParameterTypes()[j])) {
+ method = null;
+ break;
+ }
+ }
+ }
+ }
+ try {
+ Object[] args = new Object[n];
+ for (int i = 0; i < n; i++) { // fill argument array
+ Converter converter = cvtlib.getConverter(method.getParameterTypes()[i]);
+ Attribute attrib = new Attribute(String.class.equals(converter.convertsTo()) ? "title" : "NA", st.nextToken().trim());
+ if (converter != null) {
+ args[i] = converter.convert(method.getParameterTypes()[i], attrib, localizer);
+ } else {
+ args[i] = attrib.getValue();
+ }
+ }
+ border = (Border) method.invoke(null, args);
+ } catch (Exception e) {
+ if (SwingEngine.DEBUG_MODE)
+ System.err.println("Couldn't create border, " + attr.getValue() + "\n" + e.getMessage());
+ }
+ return border;
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ *
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/ColorConverter.java b/swixml-core/src/main/java/org/swixml/converters/ColorConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/ColorConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/ColorConverter.java
index de673a5..c7d6fd8 100755
--- a/src/main/java/org/swixml/converters/ColorConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/ColorConverter.java
@@ -1,143 +1,143 @@
-/*--
- $Id: ColorConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-import org.swixml.SwingEngine;
-
-import java.awt.*;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.StringTokenizer;
-
-/**
- * The ColorConverter class defines a Converter that turns the Strings into a Color object
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- *
- * @see java.awt.Color
-
- *
- * Examples for Valid XML attribute notations:
- * The following example show valid xml attributes to create Color objects:
- *
- * - background="3399CC"
- * - background="red"
- * - foreground="991144"
- *
- *
- */
-public class ColorConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = Color.class;
-
- /**
- * Returns a java.awt.Color runtime object
- * @param type Class not used
- * @param attr Attribute value needs to provide a String
- * @return runtime type is subclass of java.awt.Color
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- return ColorConverter.conv(type,attr);
- }
- /**
- * Returns a java.awt.Color runtime object
- * @param type Class not used
- * @param attr Attribute value needs to provide a String
- * @return runtime type is subclass of java.awt.Color
- */
- public static Object conv( final Class type, final Attribute attr ) {
- if (attr != null) {
- try {
- Field field = Color.class.getField( attr.getValue() );
- if (Color.class.equals( field.getType() ) && Modifier.isStatic( field.getModifiers() ))
- return field.get( Color.class );
- } catch (NoSuchFieldException e) {
- } catch (SecurityException e) {
- } catch (IllegalAccessException e) {
- }
- StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
- if (1 == st.countTokens()) {
- try {
- return new Color( Integer.parseInt( st.nextToken().trim(), 16 ) );
- } catch (NumberFormatException e) {
- if (SwingEngine.DEBUG_MODE) System.err.println( e );
- return null;
- }
- }
- int[] para = Util.ia( st );
- if (4 <= para.length)
- return new Color( para[0], para[1], para[2], para[3] );
- if (3 <= para.length)
- return new Color( para[0], para[1], para[2] );
- if (1 <= para.length)
- return new Color( para[0] );
- }
- return null;
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-
-}
+/*--
+ $Id: ColorConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+import org.swixml.SwingEngine;
+
+import java.awt.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.StringTokenizer;
+
+/**
+ * The ColorConverter class defines a Converter that turns the Strings into a Color object
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ *
+ * @see java.awt.Color
+
+ *
+ * Examples for Valid XML attribute notations:
+ * The following example show valid xml attributes to create Color objects:
+ *
+ * - background="3399CC"
+ * - background="red"
+ * - foreground="991144"
+ *
+ *
+ */
+public class ColorConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = Color.class;
+
+ /**
+ * Returns a java.awt.Color runtime object
+ * @param type Class not used
+ * @param attr Attribute value needs to provide a String
+ * @return runtime type is subclass of java.awt.Color
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ return ColorConverter.conv(type,attr);
+ }
+ /**
+ * Returns a java.awt.Color runtime object
+ * @param type Class not used
+ * @param attr Attribute value needs to provide a String
+ * @return runtime type is subclass of java.awt.Color
+ */
+ public static Object conv( final Class type, final Attribute attr ) {
+ if (attr != null) {
+ try {
+ Field field = Color.class.getField( attr.getValue() );
+ if (Color.class.equals( field.getType() ) && Modifier.isStatic( field.getModifiers() ))
+ return field.get( Color.class );
+ } catch (NoSuchFieldException e) {
+ } catch (SecurityException e) {
+ } catch (IllegalAccessException e) {
+ }
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
+ if (1 == st.countTokens()) {
+ try {
+ return new Color( Integer.parseInt( st.nextToken().trim(), 16 ) );
+ } catch (NumberFormatException e) {
+ if (SwingEngine.DEBUG_MODE) System.err.println( e );
+ return null;
+ }
+ }
+ int[] para = Util.ia( st );
+ if (4 <= para.length)
+ return new Color( para[0], para[1], para[2], para[3] );
+ if (3 <= para.length)
+ return new Color( para[0], para[1], para[2] );
+ if (1 <= para.length)
+ return new Color( para[0] );
+ }
+ return null;
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+
+}
diff --git a/src/main/java/org/swixml/converters/ComponentConverter.java b/swixml-core/src/main/java/org/swixml/converters/ComponentConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/ComponentConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/ComponentConverter.java
index 060a212..7ab56a7 100755
--- a/src/main/java/org/swixml/converters/ComponentConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/ComponentConverter.java
@@ -1,106 +1,106 @@
-/*--
- $Id: ComponentConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-
-/**
- * The ComponentConverter class defines a dummy converter
- * It's simply here to allow the registration of setter-methods excepting Components
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- */
-public class ComponentConverter implements Converter {
- /**
- * converter's return type
- */
- public static final Class TEMPLATE = Component.class;
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param attr Attribute the attribute, providing the value to be converted.
- */
- public static Component conv(Attribute attr) throws Exception {
- return null;
- }
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param type Class Data type to which the Attribute's value should be converted
- * @param attr Attribute the attribute, providing the value to be converted.
- */
- public Object convert(Class type, Attribute attr, Localizer localizer) throws Exception {
- return ComponentConverter.conv(attr);
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- *
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: ComponentConverter.java,v 1.1 2004/03/01 07:55:58 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+
+/**
+ * The ComponentConverter class defines a dummy converter
+ * It's simply here to allow the registration of setter-methods excepting Components
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ */
+public class ComponentConverter implements Converter {
+ /**
+ * converter's return type
+ */
+ public static final Class TEMPLATE = Component.class;
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param attr Attribute the attribute, providing the value to be converted.
+ */
+ public static Component conv(Attribute attr) throws Exception {
+ return null;
+ }
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param type Class Data type to which the Attribute's value should be converted
+ * @param attr Attribute the attribute, providing the value to be converted.
+ */
+ public Object convert(Class type, Attribute attr, Localizer localizer) throws Exception {
+ return ComponentConverter.conv(attr);
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ *
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/DimensionConverter.java b/swixml-core/src/main/java/org/swixml/converters/DimensionConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/DimensionConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/DimensionConverter.java
index 4f8f68d..6b39371 100755
--- a/src/main/java/org/swixml/converters/DimensionConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/DimensionConverter.java
@@ -1,113 +1,113 @@
-/*--
- $Id: DimensionConverter.java,v 1.1 2004/03/01 07:55:59 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-import java.util.StringTokenizer;
-
-/**
- * A Converter that turns a Strings in the form: width,height into Dimension objects.
- *
- * Examples for Valid XML attribute notations:
- *
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see java.awt.Dimension
- * @see org.swixml.ConverterLibrary
- */
-
-public final class DimensionConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = Dimension.class;
-
- /**
- * Converts a String into an Dimension object
- * @param type Class not used
- * @param attr Attribute value fields needs provides convertable String
- * @return Object - runtime type is Dimension
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- if (attr != null) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
- int width = 0;
- int height = 0;
- if (st.hasMoreTokens()) {
- width = Integer.parseInt( st.nextToken().trim() );
- }
- if (st.hasMoreTokens()) {
- height = Integer.parseInt( st.nextToken().trim() );
- }
- return new Dimension( width, height );
- }
- return null;
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
+/*--
+ $Id: DimensionConverter.java,v 1.1 2004/03/01 07:55:59 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+import java.util.StringTokenizer;
+
+/**
+ * A Converter that turns a Strings in the form: width,height into Dimension objects.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see java.awt.Dimension
+ * @see org.swixml.ConverterLibrary
+ */
+
+public final class DimensionConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = Dimension.class;
+
+ /**
+ * Converts a String into an Dimension object
+ * @param type Class not used
+ * @param attr Attribute value fields needs provides convertable String
+ * @return Object - runtime type is Dimension
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ if (attr != null) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
+ int width = 0;
+ int height = 0;
+ if (st.hasMoreTokens()) {
+ width = Integer.parseInt( st.nextToken().trim() );
+ }
+ if (st.hasMoreTokens()) {
+ height = Integer.parseInt( st.nextToken().trim() );
+ }
+ return new Dimension( width, height );
+ }
+ return null;
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/swixml/converters/FontConverter.java b/swixml-core/src/main/java/org/swixml/converters/FontConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/FontConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/FontConverter.java
index 697358b..e778e86 100755
--- a/src/main/java/org/swixml/converters/FontConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/FontConverter.java
@@ -1,130 +1,130 @@
-/*--
- $Id: FontConverter.java,v 1.1 2004/03/01 07:55:59 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-
-/**
- * The FontConverter class defines / describes
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @since swixml 1.0
- */
-public class FontConverter implements Converter {
- /**
- * converter's return type
- */
- public static final Class TEMPLATE = Font.class;
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- * Returns the Font that the str
- * argument describes.
- * To ensure that this method returns the desired Font,
- * format the str parameter in
- * one of two ways:
- *
- * "fontfamilyname-style-pointsize" or
- * "fontfamilyname style pointsize"
- * in which style is one of the three
- * case-insensitive strings:
- * "BOLD", "BOLDITALIC", or
- * "ITALIC", and pointsize is a decimal
- * representation of the point size.
- * For example, if you want a font that is Arial, bold, and
- * a point size of 18, you would call this method with:
- * "Arial-BOLD-18".
- *
- * The default size is 12 and the default style is PLAIN.
- * If you don't specify a valid size, the returned
- * Font has a size of 12. If you don't specify
- * a valid style, the returned Font has a style of PLAIN.
- * If you do not provide a valid font family name in
- * the str argument, this method still returns
- * a valid font with a family name of "dialog".
- * To determine what font family names are available on
- * your system, use the
- * {@link GraphicsEnvironment#getAvailableFontFamilyNames()} method.
- * If str is null, a new Font
- * is returned with the family name "dialog", a size of 12 and a
- * PLAIN style.
- * If str is null,
- * a new Font is returned with the name "dialog", a
- * size of 12 and a PLAIN style.
- *
- * @param type Class Data type to which the Attribute's value should be converted
- * @param attr Attribute the attribute, providing the value to be converted.
- * @return the Font object that str
- * describes, or a new default Font if
- * str is null.
- */
- public Object convert(Class type, Attribute attr, Localizer localizer) throws Exception {
- return attr != null ? Font.decode(attr.getValue()) : null;
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- *
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: FontConverter.java,v 1.1 2004/03/01 07:55:59 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+
+/**
+ * The FontConverter class defines / describes
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @since swixml 1.0
+ */
+public class FontConverter implements Converter {
+ /**
+ * converter's return type
+ */
+ public static final Class TEMPLATE = Font.class;
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ * Returns the Font that the str
+ * argument describes.
+ * To ensure that this method returns the desired Font,
+ * format the str parameter in
+ * one of two ways:
+ *
+ * "fontfamilyname-style-pointsize" or
+ * "fontfamilyname style pointsize"
+ * in which style is one of the three
+ * case-insensitive strings:
+ * "BOLD", "BOLDITALIC", or
+ * "ITALIC", and pointsize is a decimal
+ * representation of the point size.
+ * For example, if you want a font that is Arial, bold, and
+ * a point size of 18, you would call this method with:
+ * "Arial-BOLD-18".
+ *
+ * The default size is 12 and the default style is PLAIN.
+ * If you don't specify a valid size, the returned
+ * Font has a size of 12. If you don't specify
+ * a valid style, the returned Font has a style of PLAIN.
+ * If you do not provide a valid font family name in
+ * the str argument, this method still returns
+ * a valid font with a family name of "dialog".
+ * To determine what font family names are available on
+ * your system, use the
+ * {@link GraphicsEnvironment#getAvailableFontFamilyNames()} method.
+ * If str is null, a new Font
+ * is returned with the family name "dialog", a size of 12 and a
+ * PLAIN style.
+ * If str is null,
+ * a new Font is returned with the name "dialog", a
+ * size of 12 and a PLAIN style.
+ *
+ * @param type Class Data type to which the Attribute's value should be converted
+ * @param attr Attribute the attribute, providing the value to be converted.
+ * @return the Font object that str
+ * describes, or a new default Font if
+ * str is null.
+ */
+ public Object convert(Class type, Attribute attr, Localizer localizer) throws Exception {
+ return attr != null ? Font.decode(attr.getValue()) : null;
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ *
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/ImageConverter.java b/swixml-core/src/main/java/org/swixml/converters/ImageConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/ImageConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/ImageConverter.java
index 1f0ee6d..dffcd0f 100755
--- a/src/main/java/org/swixml/converters/ImageConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/ImageConverter.java
@@ -1,107 +1,107 @@
-/*--
- $Id: ImageConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * A Converter that turns a Strings in the form of a filename into an Image objects.
-
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see java.awt.Dimension
- * @see org.swixml.ConverterLibrary
- */
-public class ImageConverter implements Converter {
-
- /** converter's return type */
- public static final Class TEMPLATE = Image.class;
-
- /**
- * Converts a String into an ImageIcon through a Resource lookup
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - an ImageIcon
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- return ImageConverter.conv( type, attr, localizer );
- }
-
- /**
- * Converts a String into an ImageIcon through a Resource lookup
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - an ImageIcon
- */
- public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
- ImageIcon icon = (ImageIcon) ImageIconConverter.conv( type, attr, localizer );
- return icon != null ? icon.getImage() : null;
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: ImageConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * A Converter that turns a Strings in the form of a filename into an Image objects.
+
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see java.awt.Dimension
+ * @see org.swixml.ConverterLibrary
+ */
+public class ImageConverter implements Converter {
+
+ /** converter's return type */
+ public static final Class TEMPLATE = Image.class;
+
+ /**
+ * Converts a String into an ImageIcon through a Resource lookup
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - an ImageIcon
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ return ImageConverter.conv( type, attr, localizer );
+ }
+
+ /**
+ * Converts a String into an ImageIcon through a Resource lookup
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - an ImageIcon
+ */
+ public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
+ ImageIcon icon = (ImageIcon) ImageIconConverter.conv( type, attr, localizer );
+ return icon != null ? icon.getImage() : null;
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/ImageIconConverter.java b/swixml-core/src/main/java/org/swixml/converters/ImageIconConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/ImageIconConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/ImageIconConverter.java
index 6c7b282..ce8d559 100755
--- a/src/main/java/org/swixml/converters/ImageIconConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/ImageIconConverter.java
@@ -1,120 +1,120 @@
-/*--
- $Id: ImageIconConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-import org.swixml.Parser;
-
-import javax.swing.*;
-
-/**
- * A Converter that turns a Strings in the form of a filename into an ImageIcon objects.
-
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see java.awt.Dimension
- * @see org.swixml.ConverterLibrary
- */
-public class ImageIconConverter implements Converter {
-
- /** converter's return type */
- public static final Class TEMPLATE = ImageIcon.class;
- /** current classloader */
-
- /**
- * Converts a String into an ImageIcon through a Resource lookup
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - an ImageIcon
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- return ImageIconConverter.conv( type, attr, localizer );
- }
-
- /**
- * Converts a String into an ImageIcon through a Resource lookup
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - an ImageIcon
- */
- public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
- ImageIcon icon = null;
- if (attr != null) {
- if (Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() )) {
- attr.setValue( localizer.getString( attr.getValue() ) );
- }
- try {
- //java.net.URL imgURL = Converter.class.getResource( attr.getValue() );
- //icon = new ImageIcon( imgURL );
- icon = new ImageIcon( localizer.getClassLoader().getResource( attr.getValue() ) );
- } catch (Exception e) {
- // intentionally empty
- }
- }
- return icon;
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: ImageIconConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+import org.swixml.Parser;
+
+import javax.swing.*;
+
+/**
+ * A Converter that turns a Strings in the form of a filename into an ImageIcon objects.
+
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see java.awt.Dimension
+ * @see org.swixml.ConverterLibrary
+ */
+public class ImageIconConverter implements Converter {
+
+ /** converter's return type */
+ public static final Class TEMPLATE = ImageIcon.class;
+ /** current classloader */
+
+ /**
+ * Converts a String into an ImageIcon through a Resource lookup
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - an ImageIcon
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ return ImageIconConverter.conv( type, attr, localizer );
+ }
+
+ /**
+ * Converts a String into an ImageIcon through a Resource lookup
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - an ImageIcon
+ */
+ public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
+ ImageIcon icon = null;
+ if (attr != null) {
+ if (Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() )) {
+ attr.setValue( localizer.getString( attr.getValue() ) );
+ }
+ try {
+ //java.net.URL imgURL = Converter.class.getResource( attr.getValue() );
+ //icon = new ImageIcon( imgURL );
+ icon = new ImageIcon( localizer.getClassLoader().getResource( attr.getValue() ) );
+ } catch (Exception e) {
+ // intentionally empty
+ }
+ }
+ return icon;
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/InputEvent.java b/swixml-core/src/main/java/org/swixml/converters/InputEvent.java
similarity index 96%
rename from src/main/java/org/swixml/converters/InputEvent.java
rename to swixml-core/src/main/java/org/swixml/converters/InputEvent.java
index 7c786b4..f344cdb 100755
--- a/src/main/java/org/swixml/converters/InputEvent.java
+++ b/swixml-core/src/main/java/org/swixml/converters/InputEvent.java
@@ -1,160 +1,160 @@
-/*--
- $Id: InputEvent.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml.converters;
-
-import java.awt.*;
-
-
-public interface InputEvent {
-
- /**
- * The shift key modifier constant.
- * It is recommended that SHIFT_DOWN_MASK to be used instead.
- */
- public static final int SHIFT_MASK = Event.SHIFT_MASK;
-
- /**
- * The control key modifier constant.
- * It is recommended that CTRL_DOWN_MASK to be used instead.
- */
- public static final int CTRL_MASK = Event.CTRL_MASK;
-
- /**
- * The meta key modifier constant.
- * It is recommended that META_DOWN_MASK to be used instead.
- */
- public static final int META_MASK = Event.META_MASK;
-
- /**
- * The alt key modifier constant.
- * It is recommended that ALT_DOWN_MASK to be used instead.
- */
- public static final int ALT_MASK = Event.ALT_MASK;
-
- /**
- * The alt-graph key modifier constant.
- */
- public static final int ALT_GRAPH_MASK = 1 << 5;
-
- /**
- * The mouse button1 modifier constant.
- * It is recommended that BUTTON1_DOWN_MASK to be used instead.
- */
- public static final int BUTTON1_MASK = 1 << 4;
-
- /**
- * The mouse button2 modifier constant.
- * It is recommended that BUTTON2_DOWN_MASK to be used instead.
- */
- public static final int BUTTON2_MASK = Event.ALT_MASK;
-
- /**
- * The mouse button3 modifier constant.
- * It is recommended that BUTTON3_DOWN_MASK to be used instead.
- */
- public static final int BUTTON3_MASK = Event.META_MASK;
-
- /**
- * The SHIFT key extended modifier constant.
- * @since 1.4
- */
- public static final int SHIFT_DOWN_MASK = 1 << 6;
-
- /**
- * The CTRL key extended modifier constant.
- * @since 1.4
- */
- public static final int CTRL_DOWN_MASK = 1 << 7;
-
- /**
- * The META key extended modifier constant.
- * @since 1.4
- */
- public static final int META_DOWN_MASK = 1 << 8;
-
- /**
- * The ALT key extended modifier constant.
- * @since 1.4
- */
- public static final int ALT_DOWN_MASK = 1 << 9;
-
- /**
- * The mouse button1 extended modifier constant.
- * @since 1.4
- */
- public static final int BUTTON1_DOWN_MASK = 1 << 10;
-
- /**
- * The mouse button2 extended modifier constant.
- * @since 1.4
- */
- public static final int BUTTON2_DOWN_MASK = 1 << 11;
-
- /**
- * The mouse button3 extended modifier constant.
- * @since 1.4
- */
- public static final int BUTTON3_DOWN_MASK = 1 << 12;
-
- /**
- * The alt-graph key extended modifier constant.
- * @since 1.4
- */
- public static final int ALT_GRAPH_DOWN_MASK = 1 << 13;
-
-
- static final int JDK_1_3_MODIFIERS = SHIFT_DOWN_MASK - 1;
-
-}
-
-;
+/*--
+ $Id: InputEvent.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml.converters;
+
+import java.awt.*;
+
+
+public interface InputEvent {
+
+ /**
+ * The shift key modifier constant.
+ * It is recommended that SHIFT_DOWN_MASK to be used instead.
+ */
+ public static final int SHIFT_MASK = Event.SHIFT_MASK;
+
+ /**
+ * The control key modifier constant.
+ * It is recommended that CTRL_DOWN_MASK to be used instead.
+ */
+ public static final int CTRL_MASK = Event.CTRL_MASK;
+
+ /**
+ * The meta key modifier constant.
+ * It is recommended that META_DOWN_MASK to be used instead.
+ */
+ public static final int META_MASK = Event.META_MASK;
+
+ /**
+ * The alt key modifier constant.
+ * It is recommended that ALT_DOWN_MASK to be used instead.
+ */
+ public static final int ALT_MASK = Event.ALT_MASK;
+
+ /**
+ * The alt-graph key modifier constant.
+ */
+ public static final int ALT_GRAPH_MASK = 1 << 5;
+
+ /**
+ * The mouse button1 modifier constant.
+ * It is recommended that BUTTON1_DOWN_MASK to be used instead.
+ */
+ public static final int BUTTON1_MASK = 1 << 4;
+
+ /**
+ * The mouse button2 modifier constant.
+ * It is recommended that BUTTON2_DOWN_MASK to be used instead.
+ */
+ public static final int BUTTON2_MASK = Event.ALT_MASK;
+
+ /**
+ * The mouse button3 modifier constant.
+ * It is recommended that BUTTON3_DOWN_MASK to be used instead.
+ */
+ public static final int BUTTON3_MASK = Event.META_MASK;
+
+ /**
+ * The SHIFT key extended modifier constant.
+ * @since 1.4
+ */
+ public static final int SHIFT_DOWN_MASK = 1 << 6;
+
+ /**
+ * The CTRL key extended modifier constant.
+ * @since 1.4
+ */
+ public static final int CTRL_DOWN_MASK = 1 << 7;
+
+ /**
+ * The META key extended modifier constant.
+ * @since 1.4
+ */
+ public static final int META_DOWN_MASK = 1 << 8;
+
+ /**
+ * The ALT key extended modifier constant.
+ * @since 1.4
+ */
+ public static final int ALT_DOWN_MASK = 1 << 9;
+
+ /**
+ * The mouse button1 extended modifier constant.
+ * @since 1.4
+ */
+ public static final int BUTTON1_DOWN_MASK = 1 << 10;
+
+ /**
+ * The mouse button2 extended modifier constant.
+ * @since 1.4
+ */
+ public static final int BUTTON2_DOWN_MASK = 1 << 11;
+
+ /**
+ * The mouse button3 extended modifier constant.
+ * @since 1.4
+ */
+ public static final int BUTTON3_DOWN_MASK = 1 << 12;
+
+ /**
+ * The alt-graph key extended modifier constant.
+ * @since 1.4
+ */
+ public static final int ALT_GRAPH_DOWN_MASK = 1 << 13;
+
+
+ static final int JDK_1_3_MODIFIERS = SHIFT_DOWN_MASK - 1;
+
+}
+
+;
diff --git a/src/main/java/org/swixml/converters/InsetsConverter.java b/swixml-core/src/main/java/org/swixml/converters/InsetsConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/InsetsConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/InsetsConverter.java
index c7530a7..d3f83d1 100755
--- a/src/main/java/org/swixml/converters/InsetsConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/InsetsConverter.java
@@ -1,117 +1,117 @@
-/*--
- $Id: InsetsConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-import java.util.StringTokenizer;
-
-/**
- * The InsetsConverter class defines a converter that creates Insets objects based on a provided String.
- *
- * Examples for Valid XML attribute notations:
- *
- *
- * - border="MatteBorder(4,4,4,4,red)"
- * - insets="2,2,2,2"
- *
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- *
- * @see java.awt.Insets
- * @see org.swixml.ConverterLibrary
-
- */
-public class InsetsConverter implements Converter {
-
- /** converter's return type */
- public static final Class TEMPLATE = Insets.class;
-
-
- /**
- * Converts a Strings into an Insets object
- *
- * @param type Class not used
- * @param attr Attribute value needs to provide String containing comma sep. integers
- * @return Object runtime type is subclass of Insets
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- Insets insets = null;
- if (attr != null) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- if (5 == st.countTokens()) { // assume "insets(...)"
- st.nextToken().trim();
- }
- int[] param = Util.ia( st );
- if (4 <= param.length) {
- insets = new Insets( param[0], param[1], param[2], param[3] );
- }
- }
- return insets;
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: InsetsConverter.java,v 1.1 2004/03/01 07:56:00 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+import java.util.StringTokenizer;
+
+/**
+ * The InsetsConverter class defines a converter that creates Insets objects based on a provided String.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ *
+ * - border="MatteBorder(4,4,4,4,red)"
+ * - insets="2,2,2,2"
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ *
+ * @see java.awt.Insets
+ * @see org.swixml.ConverterLibrary
+
+ */
+public class InsetsConverter implements Converter {
+
+ /** converter's return type */
+ public static final Class TEMPLATE = Insets.class;
+
+
+ /**
+ * Converts a Strings into an Insets object
+ *
+ * @param type Class not used
+ * @param attr Attribute value needs to provide String containing comma sep. integers
+ * @return Object runtime type is subclass of Insets
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ Insets insets = null;
+ if (attr != null) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ if (5 == st.countTokens()) { // assume "insets(...)"
+ st.nextToken().trim();
+ }
+ int[] param = Util.ia( st );
+ if (4 <= param.length) {
+ insets = new Insets( param[0], param[1], param[2], param[3] );
+ }
+ }
+ return insets;
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/KeyEvent.java b/swixml-core/src/main/java/org/swixml/converters/KeyEvent.java
similarity index 96%
rename from src/main/java/org/swixml/converters/KeyEvent.java
rename to swixml-core/src/main/java/org/swixml/converters/KeyEvent.java
index 0be6bae..dd7d444 100755
--- a/src/main/java/org/swixml/converters/KeyEvent.java
+++ b/swixml-core/src/main/java/org/swixml/converters/KeyEvent.java
@@ -1,540 +1,540 @@
-/*--
- $Id: KeyEvent.java,v 1.2 2005/05/31 04:51:43 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-/**
- * The KeyEvent Interface makes the KeyEvents available to the converter objects
- * @author Wolf Paulus
- * @version $Revision: 1.2 $
- * @since
- */
-
-public interface KeyEvent {
- /**
- * The first number in the range of ids used for key events.
- */
- int KEY_FIRST = 400;
- /**
- * The last number in the range of ids used for key events.
- */
- int KEY_LAST = 402;
- /**
- * The "key typed" event. This event is generated when a character is
- * entered. In the simplest case, it is produced by a single key press.
- * Often, however, characters are produced by series of key presses, and
- * the mapping from key pressed events to key typed events may be
- * many-to-one or many-to-many.
- */
- int KEY_TYPED = KEY_FIRST;
- /**
- * The "key pressed" event. This event is generated when a key
- * is pushed down.
- */
- int KEY_PRESSED = 1 + KEY_FIRST; //Event.KEY_PRESS
- /**
- * The "key released" event. This event is generated when a key
- * is let up.
- */
- int KEY_RELEASED = 2 + KEY_FIRST; //Event.KEY_RELEASE
- int VK_ENTER = '\n';
- int VK_BACK_SPACE = '\b';
- int VK_TAB = '\t';
- int VK_CANCEL = 0x03;
- int VK_CLEAR = 0x0C;
- int VK_SHIFT = 0x10;
- int VK_CONTROL = 0x11;
- int VK_ALT = 0x12;
- int VK_PAUSE = 0x13;
- int VK_CAPS_LOCK = 0x14;
- int VK_ESCAPE = 0x1B;
- int VK_SPACE = 0x20;
- int VK_PAGE_UP = 0x21;
- int VK_PAGE_DOWN = 0x22;
- int VK_END = 0x23;
- int VK_HOME = 0x24;
- /**
- * Constant for the non-numpad left arrow key.
- * @see #VK_KP_LEFT
- */
- int VK_LEFT = 0x25;
- /**
- * Constant for the non-numpad up arrow key.
- * @see #VK_KP_UP
- */
- int VK_UP = 0x26;
- /**
- * Constant for the non-numpad right arrow key.
- * @see #VK_KP_RIGHT
- */
- int VK_RIGHT = 0x27;
- /**
- * Constant for the non-numpad down arrow key.
- * @see #VK_KP_DOWN
- */
- int VK_DOWN = 0x28;
- int VK_COMMA = 0x2C;
- /**
- * Constant for the "-" key.
- * @since 1.2
- */
- int VK_MINUS = 0x2D;
- int VK_PERIOD = 0x2E;
- int VK_SLASH = 0x2F;
- /** VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
- int VK_0 = 0x30;
- int VK_1 = 0x31;
- int VK_2 = 0x32;
- int VK_3 = 0x33;
- int VK_4 = 0x34;
- int VK_5 = 0x35;
- int VK_6 = 0x36;
- int VK_7 = 0x37;
- int VK_8 = 0x38;
- int VK_9 = 0x39;
- int VK_SEMICOLON = 0x3B;
- int VK_EQUALS = 0x3D;
- /** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
- int VK_A = 0x41;
- int VK_B = 0x42;
- int VK_C = 0x43;
- int VK_D = 0x44;
- int VK_E = 0x45;
- int VK_F = 0x46;
- int VK_G = 0x47;
- int VK_H = 0x48;
- int VK_I = 0x49;
- int VK_J = 0x4A;
- int VK_K = 0x4B;
- int VK_L = 0x4C;
- int VK_M = 0x4D;
- int VK_N = 0x4E;
- int VK_O = 0x4F;
- int VK_P = 0x50;
- int VK_Q = 0x51;
- int VK_R = 0x52;
- int VK_S = 0x53;
- int VK_T = 0x54;
- int VK_U = 0x55;
- int VK_V = 0x56;
- int VK_W = 0x57;
- int VK_X = 0x58;
- int VK_Y = 0x59;
- int VK_Z = 0x5A;
- int VK_OPEN_BRACKET = 0x5B;
- int VK_BACK_SLASH = 0x5C;
- int VK_CLOSE_BRACKET = 0x5D;
- int VK_NUMPAD0 = 0x60;
- int VK_NUMPAD1 = 0x61;
- int VK_NUMPAD2 = 0x62;
- int VK_NUMPAD3 = 0x63;
- int VK_NUMPAD4 = 0x64;
- int VK_NUMPAD5 = 0x65;
- int VK_NUMPAD6 = 0x66;
- int VK_NUMPAD7 = 0x67;
- int VK_NUMPAD8 = 0x68;
- int VK_NUMPAD9 = 0x69;
- int VK_MULTIPLY = 0x6A;
- int VK_ADD = 0x6B;
- /**
- * This constant is obsolete, and is included only for backwards compatibility.
- */
- int VK_SEPARATER = 0x6C;
- /**
- * Constant for the Numpad Separator key.
- * @since 1.4
- */
- int VK_SEPARATOR = VK_SEPARATER;
- int VK_SUBTRACT = 0x6D;
- int VK_DECIMAL = 0x6E;
- int VK_DIVIDE = 0x6F;
- int VK_DELETE = 0x7F; /* ASCII DEL */
- int VK_NUM_LOCK = 0x90;
- int VK_SCROLL_LOCK = 0x91;
- /** Constant for the F1 function key. */
- int VK_F1 = 0x70;
- /** Constant for the F2 function key. */
- int VK_F2 = 0x71;
- /** Constant for the F3 function key. */
- int VK_F3 = 0x72;
- /** Constant for the F4 function key. */
- int VK_F4 = 0x73;
- /** Constant for the F5 function key. */
- int VK_F5 = 0x74;
- /** Constant for the F6 function key. */
- int VK_F6 = 0x75;
- /** Constant for the F7 function key. */
- int VK_F7 = 0x76;
- /** Constant for the F8 function key. */
- int VK_F8 = 0x77;
- /** Constant for the F9 function key. */
- int VK_F9 = 0x78;
- /** Constant for the F10 function key. */
- int VK_F10 = 0x79;
- /** Constant for the F11 function key. */
- int VK_F11 = 0x7A;
- /** Constant for the F12 function key. */
- int VK_F12 = 0x7B;
- /* F13 - F24 are used on IBM 3270 keyboard; use random range for constants. */
- int VK_F13 = 0xF000;
- /**
- * Constant for the F14 function key.
- * @since 1.2
- */
- int VK_F14 = 0xF001;
- /**
- * Constant for the F15 function key.
- * @since 1.2
- */
- int VK_F15 = 0xF002;
- /**
- * Constant for the F16 function key.
- * @since 1.2
- */
- int VK_F16 = 0xF003;
- /**
- * Constant for the F17 function key.
- * @since 1.2
- */
- int VK_F17 = 0xF004;
- /**
- * Constant for the F18 function key.
- * @since 1.2
- */
- int VK_F18 = 0xF005;
- /**
- * Constant for the F19 function key.
- * @since 1.2
- */
- int VK_F19 = 0xF006;
- /**
- * Constant for the F20 function key.
- * @since 1.2
- */
- int VK_F20 = 0xF007;
- /**
- * Constant for the F21 function key.
- * @since 1.2
- */
- int VK_F21 = 0xF008;
- /**
- * Constant for the F22 function key.
- * @since 1.2
- */
- int VK_F22 = 0xF009;
- /**
- * Constant for the F23 function key.
- * @since 1.2
- */
- int VK_F23 = 0xF00A;
- /**
- * Constant for the F24 function key.
- * @since 1.2
- */
- int VK_F24 = 0xF00B;
- int VK_PRINTSCREEN = 0x9A;
- int VK_INSERT = 0x9B;
- int VK_HELP = 0x9C;
- int VK_META = 0x9D;
- int VK_BACK_QUOTE = 0xC0;
- int VK_QUOTE = 0xDE;
- /**
- * Constant for the numeric keypad up arrow key.
- * @see #VK_UP
- * @since 1.2
- */
- int VK_KP_UP = 0xE0;
- /**
- * Constant for the numeric keypad down arrow key.
- * @see #VK_DOWN
- * @since 1.2
- */
- int VK_KP_DOWN = 0xE1;
- /**
- * Constant for the numeric keypad left arrow key.
- * @see #VK_LEFT
- * @since 1.2
- */
- int VK_KP_LEFT = 0xE2;
- /**
- * Constant for the numeric keypad right arrow key.
- * @see #VK_RIGHT
- * @since 1.2
- */
- int VK_KP_RIGHT = 0xE3;
- /** @since 1.2 */
- int VK_DEAD_GRAVE = 0x80;
- /** @since 1.2 */
- int VK_DEAD_ACUTE = 0x81;
- /** @since 1.2 */
- int VK_DEAD_CIRCUMFLEX = 0x82;
- /** @since 1.2 */
- int VK_DEAD_TILDE = 0x83;
- /** @since 1.2 */
- int VK_DEAD_MACRON = 0x84;
- /** @since 1.2 */
- int VK_DEAD_BREVE = 0x85;
- /** @since 1.2 */
- int VK_DEAD_ABOVEDOT = 0x86;
- /** @since 1.2 */
- int VK_DEAD_DIAERESIS = 0x87;
- /** @since 1.2 */
- int VK_DEAD_ABOVERING = 0x88;
- /** @since 1.2 */
- int VK_DEAD_DOUBLEACUTE = 0x89;
- /** @since 1.2 */
- int VK_DEAD_CARON = 0x8a;
- /** @since 1.2 */
- int VK_DEAD_CEDILLA = 0x8b;
- /** @since 1.2 */
- int VK_DEAD_OGONEK = 0x8c;
- /** @since 1.2 */
- int VK_DEAD_IOTA = 0x8d;
- /** @since 1.2 */
- int VK_DEAD_VOICED_SOUND = 0x8e;
- /** @since 1.2 */
- int VK_DEAD_SEMIVOICED_SOUND = 0x8f;
- /** @since 1.2 */
- int VK_AMPERSAND = 0x96;
- /** @since 1.2 */
- int VK_ASTERISK = 0x97;
- /** @since 1.2 */
- int VK_QUOTEDBL = 0x98;
- /** @since 1.2 */
- int VK_LESS = 0x99;
- /** @since 1.2 */
- int VK_GREATER = 0xa0;
- /** @since 1.2 */
- int VK_BRACELEFT = 0xa1;
- /** @since 1.2 */
- int VK_BRACERIGHT = 0xa2;
- /**
- * Constant for the "@" key.
- * @since 1.2
- */
- int VK_AT = 0x0200;
- /**
- * Constant for the ":" key.
- * @since 1.2
- */
- int VK_COLON = 0x0201;
- /**
- * Constant for the "^" key.
- * @since 1.2
- */
- int VK_CIRCUMFLEX = 0x0202;
- /**
- * Constant for the "$" key.
- * @since 1.2
- */
- int VK_DOLLAR = 0x0203;
- /**
- * Constant for the Euro currency sign key.
- * @since 1.2
- */
- int VK_EURO_SIGN = 0x0204;
- /**
- * Constant for the "!" key.
- * @since 1.2
- */
- int VK_EXCLAMATION_MARK = 0x0205;
- /**
- * Constant for the inverted exclamation mark key.
- * @since 1.2
- */
- int VK_INVERTED_EXCLAMATION_MARK = 0x0206;
- /**
- * Constant for the "(" key.
- * @since 1.2
- */
- int VK_LEFT_PARENTHESIS = 0x0207;
- /**
- * Constant for the "#" key.
- * @since 1.2
- */
- int VK_NUMBER_SIGN = 0x0208;
- /**
- * Constant for the "+" key.
- * @since 1.2
- */
- int VK_PLUS = 0x0209;
- /**
- * Constant for the ")" key.
- * @since 1.2
- */
- int VK_RIGHT_PARENTHESIS = 0x020A;
- /**
- * Constant for the "_" key.
- * @since 1.2
- */
- int VK_UNDERSCORE = 0x020B;
- /* not clear what this means - listed in Microsoft Windows API */
- int VK_FINAL = 0x0018;
- /* Japanese PC 106 keyboard, Japanese Solaris keyboard: henkan */
- int VK_CONVERT = 0x001C;
- /* Japanese PC 106 keyboard: muhenkan */
- int VK_NONCONVERT = 0x001D;
- /* Japanese Solaris keyboard: kakutei */
- int VK_ACCEPT = 0x001E;
- /* not clear what this means - listed in Microsoft Windows API */
- int VK_MODECHANGE = 0x001F;
- /* replaced by VK_KANA_LOCK for Microsoft Windows and Solaris;
- might still be used on other platforms */
- int VK_KANA = 0x0015;
- /* replaced by VK_INPUT_METHOD_ON_OFF for Microsoft Windows and Solaris;
- might still be used for other platforms */
- int VK_KANJI = 0x0019;
- /* Japanese PC 106 keyboard: eisuu */
- int VK_ALPHANUMERIC = 0x00F0;
- /* Japanese PC 106 keyboard: katakana */
- int VK_KATAKANA = 0x00F1;
- /* Japanese PC 106 keyboard: hiragana */
- int VK_HIRAGANA = 0x00F2;
- /* Japanese PC 106 keyboard: zenkaku */
- int VK_FULL_WIDTH = 0x00F3;
- /* Japanese PC 106 keyboard: hankaku */
- int VK_HALF_WIDTH = 0x00F4;
- /* Japanese PC 106 keyboard: roumaji */
- int VK_ROMAN_CHARACTERS = 0x00F5;
- /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
- int VK_ALL_CANDIDATES = 0x0100;
- /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
- int VK_PREVIOUS_CANDIDATE = 0x0101;
- /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
- int VK_CODE_INPUT = 0x0102;
- /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
- int VK_JAPANESE_KATAKANA = 0x0103;
- /* Japanese Macintosh keyboard */
- int VK_JAPANESE_HIRAGANA = 0x0104;
- /* Japanese Macintosh keyboard */
- int VK_JAPANESE_ROMAN = 0x0105;
- /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */
- int VK_KANA_LOCK = 0x0106;
- /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
- int VK_INPUT_METHOD_ON_OFF = 0x0107;
- /** @since 1.2 */
- int VK_CUT = 0xFFD1;
- /** @since 1.2 */
- int VK_COPY = 0xFFCD;
- /** @since 1.2 */
- int VK_PASTE = 0xFFCF;
- /** @since 1.2 */
- int VK_UNDO = 0xFFCB;
- /** @since 1.2 */
- int VK_AGAIN = 0xFFC9;
- /** @since 1.2 */
- int VK_FIND = 0xFFD0;
- /** @since 1.2 */
- int VK_PROPS = 0xFFCA;
- /** @since 1.2 */
- int VK_STOP = 0xFFC8;
- /**
- * Constant for the Compose function key.
- * @since 1.2
- */
- int VK_COMPOSE = 0xFF20;
- /**
- * Constant for the AltGraph function key.
- * @since 1.2
- */
- int VK_ALT_GRAPH = 0xFF7E;
- /**
- * This value is used to indicate that the keyCode is unknown.
- * KEY_TYPED events do not have a keyCode value; this value
- * is used instead.
- */
- int VK_UNDEFINED = 0x0;
- /**
- * KEY_PRESSED and KEY_RELEASED events which do not map to a
- * valid Unicode character use this for the keyChar value.
- */
- char CHAR_UNDEFINED = 0xFFFF;
- /**
- * A constant indicating that the keyLocation is indeterminate
- * or not relevant.
- * KEY_TYPED events do not have a keyLocation; this value
- * is used instead.
- * @since 1.4
- */
- int KEY_LOCATION_UNKNOWN = 0;
- /**
- * A constant indicating that the key pressed or released
- * is not distinguished as the left or right version of a key,
- * and did not originate on the numeric keypad (or did not
- * originate with a virtual key corresponding to the numeric
- * keypad).
- * @since 1.4
- */
- int KEY_LOCATION_STANDARD = 1;
- /**
- * A constant indicating that the key pressed or released is in
- * the left key location (there is more than one possible location
- * for this key). Example: the left shift key.
- * @since 1.4
- */
- int KEY_LOCATION_LEFT = 2;
- /**
- * A constant indicating that the key pressed or released is in
- * the right key location (there is more than one possible location
- * for this key). Example: the right shift key.
- * @since 1.4
- */
- int KEY_LOCATION_RIGHT = 3;
- /**
- * A constant indicating that the key event originated on the
- * numeric keypad or with a virtual key corresponding to the
- * numeric keypad.
- * @since 1.4
- */
- int KEY_LOCATION_NUMPAD = 4;
-}
+/*--
+ $Id: KeyEvent.java,v 1.2 2005/05/31 04:51:43 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+/**
+ * The KeyEvent Interface makes the KeyEvents available to the converter objects
+ * @author Wolf Paulus
+ * @version $Revision: 1.2 $
+ * @since
+ */
+
+public interface KeyEvent {
+ /**
+ * The first number in the range of ids used for key events.
+ */
+ int KEY_FIRST = 400;
+ /**
+ * The last number in the range of ids used for key events.
+ */
+ int KEY_LAST = 402;
+ /**
+ * The "key typed" event. This event is generated when a character is
+ * entered. In the simplest case, it is produced by a single key press.
+ * Often, however, characters are produced by series of key presses, and
+ * the mapping from key pressed events to key typed events may be
+ * many-to-one or many-to-many.
+ */
+ int KEY_TYPED = KEY_FIRST;
+ /**
+ * The "key pressed" event. This event is generated when a key
+ * is pushed down.
+ */
+ int KEY_PRESSED = 1 + KEY_FIRST; //Event.KEY_PRESS
+ /**
+ * The "key released" event. This event is generated when a key
+ * is let up.
+ */
+ int KEY_RELEASED = 2 + KEY_FIRST; //Event.KEY_RELEASE
+ int VK_ENTER = '\n';
+ int VK_BACK_SPACE = '\b';
+ int VK_TAB = '\t';
+ int VK_CANCEL = 0x03;
+ int VK_CLEAR = 0x0C;
+ int VK_SHIFT = 0x10;
+ int VK_CONTROL = 0x11;
+ int VK_ALT = 0x12;
+ int VK_PAUSE = 0x13;
+ int VK_CAPS_LOCK = 0x14;
+ int VK_ESCAPE = 0x1B;
+ int VK_SPACE = 0x20;
+ int VK_PAGE_UP = 0x21;
+ int VK_PAGE_DOWN = 0x22;
+ int VK_END = 0x23;
+ int VK_HOME = 0x24;
+ /**
+ * Constant for the non-numpad left arrow key.
+ * @see #VK_KP_LEFT
+ */
+ int VK_LEFT = 0x25;
+ /**
+ * Constant for the non-numpad up arrow key.
+ * @see #VK_KP_UP
+ */
+ int VK_UP = 0x26;
+ /**
+ * Constant for the non-numpad right arrow key.
+ * @see #VK_KP_RIGHT
+ */
+ int VK_RIGHT = 0x27;
+ /**
+ * Constant for the non-numpad down arrow key.
+ * @see #VK_KP_DOWN
+ */
+ int VK_DOWN = 0x28;
+ int VK_COMMA = 0x2C;
+ /**
+ * Constant for the "-" key.
+ * @since 1.2
+ */
+ int VK_MINUS = 0x2D;
+ int VK_PERIOD = 0x2E;
+ int VK_SLASH = 0x2F;
+ /** VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
+ int VK_0 = 0x30;
+ int VK_1 = 0x31;
+ int VK_2 = 0x32;
+ int VK_3 = 0x33;
+ int VK_4 = 0x34;
+ int VK_5 = 0x35;
+ int VK_6 = 0x36;
+ int VK_7 = 0x37;
+ int VK_8 = 0x38;
+ int VK_9 = 0x39;
+ int VK_SEMICOLON = 0x3B;
+ int VK_EQUALS = 0x3D;
+ /** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
+ int VK_A = 0x41;
+ int VK_B = 0x42;
+ int VK_C = 0x43;
+ int VK_D = 0x44;
+ int VK_E = 0x45;
+ int VK_F = 0x46;
+ int VK_G = 0x47;
+ int VK_H = 0x48;
+ int VK_I = 0x49;
+ int VK_J = 0x4A;
+ int VK_K = 0x4B;
+ int VK_L = 0x4C;
+ int VK_M = 0x4D;
+ int VK_N = 0x4E;
+ int VK_O = 0x4F;
+ int VK_P = 0x50;
+ int VK_Q = 0x51;
+ int VK_R = 0x52;
+ int VK_S = 0x53;
+ int VK_T = 0x54;
+ int VK_U = 0x55;
+ int VK_V = 0x56;
+ int VK_W = 0x57;
+ int VK_X = 0x58;
+ int VK_Y = 0x59;
+ int VK_Z = 0x5A;
+ int VK_OPEN_BRACKET = 0x5B;
+ int VK_BACK_SLASH = 0x5C;
+ int VK_CLOSE_BRACKET = 0x5D;
+ int VK_NUMPAD0 = 0x60;
+ int VK_NUMPAD1 = 0x61;
+ int VK_NUMPAD2 = 0x62;
+ int VK_NUMPAD3 = 0x63;
+ int VK_NUMPAD4 = 0x64;
+ int VK_NUMPAD5 = 0x65;
+ int VK_NUMPAD6 = 0x66;
+ int VK_NUMPAD7 = 0x67;
+ int VK_NUMPAD8 = 0x68;
+ int VK_NUMPAD9 = 0x69;
+ int VK_MULTIPLY = 0x6A;
+ int VK_ADD = 0x6B;
+ /**
+ * This constant is obsolete, and is included only for backwards compatibility.
+ */
+ int VK_SEPARATER = 0x6C;
+ /**
+ * Constant for the Numpad Separator key.
+ * @since 1.4
+ */
+ int VK_SEPARATOR = VK_SEPARATER;
+ int VK_SUBTRACT = 0x6D;
+ int VK_DECIMAL = 0x6E;
+ int VK_DIVIDE = 0x6F;
+ int VK_DELETE = 0x7F; /* ASCII DEL */
+ int VK_NUM_LOCK = 0x90;
+ int VK_SCROLL_LOCK = 0x91;
+ /** Constant for the F1 function key. */
+ int VK_F1 = 0x70;
+ /** Constant for the F2 function key. */
+ int VK_F2 = 0x71;
+ /** Constant for the F3 function key. */
+ int VK_F3 = 0x72;
+ /** Constant for the F4 function key. */
+ int VK_F4 = 0x73;
+ /** Constant for the F5 function key. */
+ int VK_F5 = 0x74;
+ /** Constant for the F6 function key. */
+ int VK_F6 = 0x75;
+ /** Constant for the F7 function key. */
+ int VK_F7 = 0x76;
+ /** Constant for the F8 function key. */
+ int VK_F8 = 0x77;
+ /** Constant for the F9 function key. */
+ int VK_F9 = 0x78;
+ /** Constant for the F10 function key. */
+ int VK_F10 = 0x79;
+ /** Constant for the F11 function key. */
+ int VK_F11 = 0x7A;
+ /** Constant for the F12 function key. */
+ int VK_F12 = 0x7B;
+ /* F13 - F24 are used on IBM 3270 keyboard; use random range for constants. */
+ int VK_F13 = 0xF000;
+ /**
+ * Constant for the F14 function key.
+ * @since 1.2
+ */
+ int VK_F14 = 0xF001;
+ /**
+ * Constant for the F15 function key.
+ * @since 1.2
+ */
+ int VK_F15 = 0xF002;
+ /**
+ * Constant for the F16 function key.
+ * @since 1.2
+ */
+ int VK_F16 = 0xF003;
+ /**
+ * Constant for the F17 function key.
+ * @since 1.2
+ */
+ int VK_F17 = 0xF004;
+ /**
+ * Constant for the F18 function key.
+ * @since 1.2
+ */
+ int VK_F18 = 0xF005;
+ /**
+ * Constant for the F19 function key.
+ * @since 1.2
+ */
+ int VK_F19 = 0xF006;
+ /**
+ * Constant for the F20 function key.
+ * @since 1.2
+ */
+ int VK_F20 = 0xF007;
+ /**
+ * Constant for the F21 function key.
+ * @since 1.2
+ */
+ int VK_F21 = 0xF008;
+ /**
+ * Constant for the F22 function key.
+ * @since 1.2
+ */
+ int VK_F22 = 0xF009;
+ /**
+ * Constant for the F23 function key.
+ * @since 1.2
+ */
+ int VK_F23 = 0xF00A;
+ /**
+ * Constant for the F24 function key.
+ * @since 1.2
+ */
+ int VK_F24 = 0xF00B;
+ int VK_PRINTSCREEN = 0x9A;
+ int VK_INSERT = 0x9B;
+ int VK_HELP = 0x9C;
+ int VK_META = 0x9D;
+ int VK_BACK_QUOTE = 0xC0;
+ int VK_QUOTE = 0xDE;
+ /**
+ * Constant for the numeric keypad up arrow key.
+ * @see #VK_UP
+ * @since 1.2
+ */
+ int VK_KP_UP = 0xE0;
+ /**
+ * Constant for the numeric keypad down arrow key.
+ * @see #VK_DOWN
+ * @since 1.2
+ */
+ int VK_KP_DOWN = 0xE1;
+ /**
+ * Constant for the numeric keypad left arrow key.
+ * @see #VK_LEFT
+ * @since 1.2
+ */
+ int VK_KP_LEFT = 0xE2;
+ /**
+ * Constant for the numeric keypad right arrow key.
+ * @see #VK_RIGHT
+ * @since 1.2
+ */
+ int VK_KP_RIGHT = 0xE3;
+ /** @since 1.2 */
+ int VK_DEAD_GRAVE = 0x80;
+ /** @since 1.2 */
+ int VK_DEAD_ACUTE = 0x81;
+ /** @since 1.2 */
+ int VK_DEAD_CIRCUMFLEX = 0x82;
+ /** @since 1.2 */
+ int VK_DEAD_TILDE = 0x83;
+ /** @since 1.2 */
+ int VK_DEAD_MACRON = 0x84;
+ /** @since 1.2 */
+ int VK_DEAD_BREVE = 0x85;
+ /** @since 1.2 */
+ int VK_DEAD_ABOVEDOT = 0x86;
+ /** @since 1.2 */
+ int VK_DEAD_DIAERESIS = 0x87;
+ /** @since 1.2 */
+ int VK_DEAD_ABOVERING = 0x88;
+ /** @since 1.2 */
+ int VK_DEAD_DOUBLEACUTE = 0x89;
+ /** @since 1.2 */
+ int VK_DEAD_CARON = 0x8a;
+ /** @since 1.2 */
+ int VK_DEAD_CEDILLA = 0x8b;
+ /** @since 1.2 */
+ int VK_DEAD_OGONEK = 0x8c;
+ /** @since 1.2 */
+ int VK_DEAD_IOTA = 0x8d;
+ /** @since 1.2 */
+ int VK_DEAD_VOICED_SOUND = 0x8e;
+ /** @since 1.2 */
+ int VK_DEAD_SEMIVOICED_SOUND = 0x8f;
+ /** @since 1.2 */
+ int VK_AMPERSAND = 0x96;
+ /** @since 1.2 */
+ int VK_ASTERISK = 0x97;
+ /** @since 1.2 */
+ int VK_QUOTEDBL = 0x98;
+ /** @since 1.2 */
+ int VK_LESS = 0x99;
+ /** @since 1.2 */
+ int VK_GREATER = 0xa0;
+ /** @since 1.2 */
+ int VK_BRACELEFT = 0xa1;
+ /** @since 1.2 */
+ int VK_BRACERIGHT = 0xa2;
+ /**
+ * Constant for the "@" key.
+ * @since 1.2
+ */
+ int VK_AT = 0x0200;
+ /**
+ * Constant for the ":" key.
+ * @since 1.2
+ */
+ int VK_COLON = 0x0201;
+ /**
+ * Constant for the "^" key.
+ * @since 1.2
+ */
+ int VK_CIRCUMFLEX = 0x0202;
+ /**
+ * Constant for the "$" key.
+ * @since 1.2
+ */
+ int VK_DOLLAR = 0x0203;
+ /**
+ * Constant for the Euro currency sign key.
+ * @since 1.2
+ */
+ int VK_EURO_SIGN = 0x0204;
+ /**
+ * Constant for the "!" key.
+ * @since 1.2
+ */
+ int VK_EXCLAMATION_MARK = 0x0205;
+ /**
+ * Constant for the inverted exclamation mark key.
+ * @since 1.2
+ */
+ int VK_INVERTED_EXCLAMATION_MARK = 0x0206;
+ /**
+ * Constant for the "(" key.
+ * @since 1.2
+ */
+ int VK_LEFT_PARENTHESIS = 0x0207;
+ /**
+ * Constant for the "#" key.
+ * @since 1.2
+ */
+ int VK_NUMBER_SIGN = 0x0208;
+ /**
+ * Constant for the "+" key.
+ * @since 1.2
+ */
+ int VK_PLUS = 0x0209;
+ /**
+ * Constant for the ")" key.
+ * @since 1.2
+ */
+ int VK_RIGHT_PARENTHESIS = 0x020A;
+ /**
+ * Constant for the "_" key.
+ * @since 1.2
+ */
+ int VK_UNDERSCORE = 0x020B;
+ /* not clear what this means - listed in Microsoft Windows API */
+ int VK_FINAL = 0x0018;
+ /* Japanese PC 106 keyboard, Japanese Solaris keyboard: henkan */
+ int VK_CONVERT = 0x001C;
+ /* Japanese PC 106 keyboard: muhenkan */
+ int VK_NONCONVERT = 0x001D;
+ /* Japanese Solaris keyboard: kakutei */
+ int VK_ACCEPT = 0x001E;
+ /* not clear what this means - listed in Microsoft Windows API */
+ int VK_MODECHANGE = 0x001F;
+ /* replaced by VK_KANA_LOCK for Microsoft Windows and Solaris;
+ might still be used on other platforms */
+ int VK_KANA = 0x0015;
+ /* replaced by VK_INPUT_METHOD_ON_OFF for Microsoft Windows and Solaris;
+ might still be used for other platforms */
+ int VK_KANJI = 0x0019;
+ /* Japanese PC 106 keyboard: eisuu */
+ int VK_ALPHANUMERIC = 0x00F0;
+ /* Japanese PC 106 keyboard: katakana */
+ int VK_KATAKANA = 0x00F1;
+ /* Japanese PC 106 keyboard: hiragana */
+ int VK_HIRAGANA = 0x00F2;
+ /* Japanese PC 106 keyboard: zenkaku */
+ int VK_FULL_WIDTH = 0x00F3;
+ /* Japanese PC 106 keyboard: hankaku */
+ int VK_HALF_WIDTH = 0x00F4;
+ /* Japanese PC 106 keyboard: roumaji */
+ int VK_ROMAN_CHARACTERS = 0x00F5;
+ /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
+ int VK_ALL_CANDIDATES = 0x0100;
+ /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
+ int VK_PREVIOUS_CANDIDATE = 0x0101;
+ /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
+ int VK_CODE_INPUT = 0x0102;
+ /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
+ int VK_JAPANESE_KATAKANA = 0x0103;
+ /* Japanese Macintosh keyboard */
+ int VK_JAPANESE_HIRAGANA = 0x0104;
+ /* Japanese Macintosh keyboard */
+ int VK_JAPANESE_ROMAN = 0x0105;
+ /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */
+ int VK_KANA_LOCK = 0x0106;
+ /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
+ int VK_INPUT_METHOD_ON_OFF = 0x0107;
+ /** @since 1.2 */
+ int VK_CUT = 0xFFD1;
+ /** @since 1.2 */
+ int VK_COPY = 0xFFCD;
+ /** @since 1.2 */
+ int VK_PASTE = 0xFFCF;
+ /** @since 1.2 */
+ int VK_UNDO = 0xFFCB;
+ /** @since 1.2 */
+ int VK_AGAIN = 0xFFC9;
+ /** @since 1.2 */
+ int VK_FIND = 0xFFD0;
+ /** @since 1.2 */
+ int VK_PROPS = 0xFFCA;
+ /** @since 1.2 */
+ int VK_STOP = 0xFFC8;
+ /**
+ * Constant for the Compose function key.
+ * @since 1.2
+ */
+ int VK_COMPOSE = 0xFF20;
+ /**
+ * Constant for the AltGraph function key.
+ * @since 1.2
+ */
+ int VK_ALT_GRAPH = 0xFF7E;
+ /**
+ * This value is used to indicate that the keyCode is unknown.
+ * KEY_TYPED events do not have a keyCode value; this value
+ * is used instead.
+ */
+ int VK_UNDEFINED = 0x0;
+ /**
+ * KEY_PRESSED and KEY_RELEASED events which do not map to a
+ * valid Unicode character use this for the keyChar value.
+ */
+ char CHAR_UNDEFINED = 0xFFFF;
+ /**
+ * A constant indicating that the keyLocation is indeterminate
+ * or not relevant.
+ * KEY_TYPED events do not have a keyLocation; this value
+ * is used instead.
+ * @since 1.4
+ */
+ int KEY_LOCATION_UNKNOWN = 0;
+ /**
+ * A constant indicating that the key pressed or released
+ * is not distinguished as the left or right version of a key,
+ * and did not originate on the numeric keypad (or did not
+ * originate with a virtual key corresponding to the numeric
+ * keypad).
+ * @since 1.4
+ */
+ int KEY_LOCATION_STANDARD = 1;
+ /**
+ * A constant indicating that the key pressed or released is in
+ * the left key location (there is more than one possible location
+ * for this key). Example: the left shift key.
+ * @since 1.4
+ */
+ int KEY_LOCATION_LEFT = 2;
+ /**
+ * A constant indicating that the key pressed or released is in
+ * the right key location (there is more than one possible location
+ * for this key). Example: the right shift key.
+ * @since 1.4
+ */
+ int KEY_LOCATION_RIGHT = 3;
+ /**
+ * A constant indicating that the key event originated on the
+ * numeric keypad or with a virtual key corresponding to the
+ * numeric keypad.
+ * @since 1.4
+ */
+ int KEY_LOCATION_NUMPAD = 4;
+}
diff --git a/src/main/java/org/swixml/converters/KeyStrokeConverter.java b/swixml-core/src/main/java/org/swixml/converters/KeyStrokeConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/KeyStrokeConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/KeyStrokeConverter.java
index a8ec2a3..c1742c6 100755
--- a/src/main/java/org/swixml/converters/KeyStrokeConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/KeyStrokeConverter.java
@@ -1,148 +1,148 @@
-/*--
- $Id: KeyStrokeConverter.java,v 1.1 2004/03/01 07:56:01 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-import org.swixml.Parser;
-
-import javax.swing.*;
-
-/**
- * A Converter that turns a Strings in the form of a filename into an KeyStroke objects.
- *
- * Valild syntax includes:
- *
- * - accelerator="F7"
- *
- accelerator="control N"
- *
- accelerator="alt A"
- *
- *
- *
- * @author Wolf Paulus
- * @author Eric Lafargue
- * @version $Revision: 1.1 $
- * @see javax.swing.KeyStroke#getKeyStroke(java.lang.String)
- * @see org.swixml.ConverterLibrary
- */
-public class KeyStrokeConverter implements Converter {
-
- /** converter's return type */
- public static final Class TEMPLATE = KeyStroke.class;
-
- /**
- * Converts a String into an KeyStroke through a Resource lookup
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - a KeyStroke
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- return KeyStrokeConverter.conv( type, attr, localizer );
- }
-
- /**
- * Converts a String into an KeyStroke.
- *
- * Parses a string and returns a KeyStroke.
- * The string must have the following syntax:
- *
- * <modifiers>* (<typedID> | <pressedReleasedID>)
- *
- * modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3
- * typedID := typed <typedKey>
- * typedKey := string of length 1 giving Unicode character.
- * pressedReleasedID := (pressed | released) key
- * key := KeyEvent key code name, i.e. the name following "VK_".
- *
- * If typed, pressed or released is not specified, pressed is assumed. Here
- * are some examples:
- *
- * "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
- * "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
- * "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
- * "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
- * "typed a" => getKeyStroke('a');
- *
- *
- * In order to maintain backward-compatibility, specifying a null String,
- * or a String which is formatted incorrectly, returns null.
- *
- * @param type Class not used
- * @param attr Attribute attribute provides the value to be converted
- * @param localizer Localizer allow the use of resource lookups
- * @return Object - a KeyStroke object for that String,
- * or null if the specified String is null, or is formatted incorrectly
- */
- public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
- KeyStroke keyStroke = null;
- if (attr != null) {
- if (Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() )) {
- attr.setValue( localizer.getString( attr.getValue() ) );
- }
- keyStroke = KeyStroke.getKeyStroke( attr.getValue() );
- }
- return keyStroke;
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: KeyStrokeConverter.java,v 1.1 2004/03/01 07:56:01 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+import org.swixml.Parser;
+
+import javax.swing.*;
+
+/**
+ * A Converter that turns a Strings in the form of a filename into an KeyStroke objects.
+ *
+ * Valild syntax includes:
+ *
+ * - accelerator="F7"
+ *
- accelerator="control N"
+ *
- accelerator="alt A"
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @author Eric Lafargue
+ * @version $Revision: 1.1 $
+ * @see javax.swing.KeyStroke#getKeyStroke(java.lang.String)
+ * @see org.swixml.ConverterLibrary
+ */
+public class KeyStrokeConverter implements Converter {
+
+ /** converter's return type */
+ public static final Class TEMPLATE = KeyStroke.class;
+
+ /**
+ * Converts a String into an KeyStroke through a Resource lookup
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - a KeyStroke
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ return KeyStrokeConverter.conv( type, attr, localizer );
+ }
+
+ /**
+ * Converts a String into an KeyStroke.
+ *
+ * Parses a string and returns a KeyStroke.
+ * The string must have the following syntax:
+ *
+ * <modifiers>* (<typedID> | <pressedReleasedID>)
+ *
+ * modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3
+ * typedID := typed <typedKey>
+ * typedKey := string of length 1 giving Unicode character.
+ * pressedReleasedID := (pressed | released) key
+ * key := KeyEvent key code name, i.e. the name following "VK_".
+ *
+ * If typed, pressed or released is not specified, pressed is assumed. Here
+ * are some examples:
+ *
+ * "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
+ * "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
+ * "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
+ * "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
+ * "typed a" => getKeyStroke('a');
+ *
+ *
+ * In order to maintain backward-compatibility, specifying a null String,
+ * or a String which is formatted incorrectly, returns null.
+ *
+ * @param type Class not used
+ * @param attr Attribute attribute provides the value to be converted
+ * @param localizer Localizer allow the use of resource lookups
+ * @return Object - a KeyStroke object for that String,
+ * or null if the specified String is null, or is formatted incorrectly
+ */
+ public static Object conv( final Class type, final Attribute attr, Localizer localizer ) {
+ KeyStroke keyStroke = null;
+ if (attr != null) {
+ if (Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() )) {
+ attr.setValue( localizer.getString( attr.getValue() ) );
+ }
+ keyStroke = KeyStroke.getKeyStroke( attr.getValue() );
+ }
+ return keyStroke;
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/LocaleConverter.java b/swixml-core/src/main/java/org/swixml/converters/LocaleConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/LocaleConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/LocaleConverter.java
index 2eaac18..c984305 100755
--- a/src/main/java/org/swixml/converters/LocaleConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/LocaleConverter.java
@@ -1,121 +1,121 @@
-/*--
- $Id: LocaleConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.util.Locale;
-import java.util.StringTokenizer;
-
-/**
- * The LocaleConverter class defines / describes
- *
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- *
- */
-public class LocaleConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = Locale.class;
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param attr Attribute the attribute, providing the value to be converted.
- *
- */
- public static Locale conv( String attrValue ) throws Exception {
- Locale locale = null; // Locale.getDefault();
- if (attrValue != null) {
- StringTokenizer st = new StringTokenizer( attrValue, "," );
- int n = st.countTokens();
- if (1 == n) {
- locale = new Locale( st.nextToken() );
- } else if (2 == n) {
- locale = new Locale( st.nextToken(), st.nextToken() );
- } else if (3 <= n) {
- locale = new Locale( st.nextToken(), st.nextToken(), st.nextToken() );
- }
- }
- return locale;
- }
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param type Class Data type to which the Attribute's value should be converted
- * @param attr Attribute the attribute, providing the value to be converted.
- *
- */
- public Object convert( Class type, Attribute attr, Localizer localizer ) throws Exception {
- return LocaleConverter.conv( attr.getValue() );
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-
-}
+/*--
+ $Id: LocaleConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+/**
+ * The LocaleConverter class defines / describes
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ *
+ */
+public class LocaleConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = Locale.class;
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param attr Attribute the attribute, providing the value to be converted.
+ *
+ */
+ public static Locale conv( String attrValue ) throws Exception {
+ Locale locale = null; // Locale.getDefault();
+ if (attrValue != null) {
+ StringTokenizer st = new StringTokenizer( attrValue, "," );
+ int n = st.countTokens();
+ if (1 == n) {
+ locale = new Locale( st.nextToken() );
+ } else if (2 == n) {
+ locale = new Locale( st.nextToken(), st.nextToken() );
+ } else if (3 <= n) {
+ locale = new Locale( st.nextToken(), st.nextToken(), st.nextToken() );
+ }
+ }
+ return locale;
+ }
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param type Class Data type to which the Attribute's value should be converted
+ * @param attr Attribute the attribute, providing the value to be converted.
+ *
+ */
+ public Object convert( Class type, Attribute attr, Localizer localizer ) throws Exception {
+ return LocaleConverter.conv( attr.getValue() );
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+
+}
diff --git a/src/main/java/org/swixml/converters/PointConverter.java b/swixml-core/src/main/java/org/swixml/converters/PointConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/PointConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/PointConverter.java
index edf3ba6..3953c37 100755
--- a/src/main/java/org/swixml/converters/PointConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/PointConverter.java
@@ -1,105 +1,105 @@
-/*--
- $Id: PointConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-import java.util.StringTokenizer;
-
-/**
- * A Converter that turns a Strings into Point objects
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see java.awt.Point
- * @see org.swixml.ConverterLibrary
- */
-public class PointConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = Point.class;
-
- /**
- * Converts a String into an Point object
- * @param type Class not used
- * @param attr Attribute value fields needs provides convertable String
- * @return Object - runtime type is Point
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- if (attr != null) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
- int x = 0;
- int y = 0;
- if (st.hasMoreTokens()) {
- x = Integer.parseInt( st.nextToken().trim() );
- }
- if (st.hasMoreTokens()) {
- y = Integer.parseInt( st.nextToken().trim() );
- }
- return new Point( x, y );
- }
- return null;
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
+/*--
+ $Id: PointConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+import java.util.StringTokenizer;
+
+/**
+ * A Converter that turns a Strings into Point objects
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see java.awt.Point
+ * @see org.swixml.ConverterLibrary
+ */
+public class PointConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = Point.class;
+
+ /**
+ * Converts a String into an Point object
+ * @param type Class not used
+ * @param attr Attribute value fields needs provides convertable String
+ * @return Object - runtime type is Point
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ if (attr != null) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
+ int x = 0;
+ int y = 0;
+ if (st.hasMoreTokens()) {
+ x = Integer.parseInt( st.nextToken().trim() );
+ }
+ if (st.hasMoreTokens()) {
+ y = Integer.parseInt( st.nextToken().trim() );
+ }
+ return new Point( x, y );
+ }
+ return null;
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/swixml/converters/PrimitiveConverter.java b/swixml-core/src/main/java/org/swixml/converters/PrimitiveConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/PrimitiveConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/PrimitiveConverter.java
index 4a496de..3acb106 100755
--- a/src/main/java/org/swixml/converters/PrimitiveConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/PrimitiveConverter.java
@@ -1,172 +1,172 @@
-/*--
- $Id: PrimitiveConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-import org.swixml.Parser;
-
-import javax.swing.*;
-import javax.swing.border.TitledBorder;
-import javax.swing.tree.TreeSelectionModel;
-import java.awt.*;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The PrimitiveConverter class defines a converter that creates primitive objects (wrapper),
- * based on a provided input Class and String.
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see org.swixml.ConverterLibrary
- */
-
-public class PrimitiveConverter implements Converter, SwingConstants, ScrollPaneConstants, KeyEvent, InputEvent {
-
- /** converter's return type */
- public static final Class TEMPLATE = Object.class;
- /** map contains all constant provider types */
- private static Map dictionaries = new HashMap();
- /**
- * Static Initializer, setting up the initial constant providers
- */
- static {
- PrimitiveConverter.addConstantProvider( JTabbedPane.class );
- PrimitiveConverter.addConstantProvider( JScrollPane.class );
- PrimitiveConverter.addConstantProvider( JSplitPane.class );
- PrimitiveConverter.addConstantProvider( GridBagConstraints.class );
- PrimitiveConverter.addConstantProvider( FlowLayout.class );
- PrimitiveConverter.addConstantProvider( ListSelectionModel.class );
- PrimitiveConverter.addConstantProvider( TreeSelectionModel.class );
- PrimitiveConverter.addConstantProvider( JDialog.class );
- PrimitiveConverter.addConstantProvider( JFrame.class );
- PrimitiveConverter.addConstantProvider( TitledBorder.class );
- }
- /**
- * Converts String into java primitive type
- * @param type Class target type
- * @param attr Attribute value field needs to provide convertable String
- * @param localizer Localizer
- * @return Object primitive wrapped into wrapper object
- * @throws NoSuchFieldException in case no class a field matching field name had been regsitered with this converter
- * @throws IllegalAccessException if a matching field can not be accessed
- */
- public static Object conv( final Class type, final Attribute attr, final Localizer localizer ) throws NoSuchFieldException, IllegalAccessException {
- Object obj = null;
- if ( Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() ))
- attr.setValue( localizer.getString( attr.getValue() ));
-
- try {
- if (boolean.class.equals( type )) {
- obj = Boolean.valueOf(attr.getValue());
- } else if (int.class.equals( type )) {
- obj = Integer.valueOf( attr.getValue() );
- } else if (long.class.equals( type )) {
- obj = Long.valueOf( attr.getValue() );
- } else if (float.class.equals( type )) {
- obj = Float.valueOf( attr.getValue() );
- } else if (double.class.equals( type )) {
- obj = Double.valueOf( attr.getValue() );
- }
- } catch (Exception e) {
- // intent. empty
- } finally {
- if (obj==null) {
- try {
- String s = attr.getValue();
- int k = s.indexOf( '.' );
- Class pp = dictionaries.get( s.substring( 0, k ) );
- obj = pp.getField( s.substring( k + 1 ) ).get( pp );
- } catch (Exception ex) {
- //
- // Try to find the given value as a Constant in SwingConstants
- //
- obj = PrimitiveConverter.class.getField( attr.getValue() ).get( PrimitiveConverter.class );
- }
- }
- }
-
- return obj;
- }
-
- /**
- * Converts String into java primitive type
- * @param type Class target type
- * @param attr Attribute value field needs to provide convertable String
- * @return Object primitive wrapped into wrapper object
- * @throws Exception
- */
- public Object convert( final Class type, final Attribute attr, final Localizer localizer ) throws Exception {
- return PrimitiveConverter.conv( type, attr, localizer );
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-
- /**
- * Adds a new class or interface to the dictionary of primitive providers.
- * @param clazz Class providing primitive constants / public (final) fields
- */
- public static void addConstantProvider(final Class clazz) {
- dictionaries.put( clazz.getSimpleName(), clazz );
- }
-}
+/*--
+ $Id: PrimitiveConverter.java,v 1.1 2004/03/01 07:56:02 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+import org.swixml.Parser;
+
+import javax.swing.*;
+import javax.swing.border.TitledBorder;
+import javax.swing.tree.TreeSelectionModel;
+import java.awt.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The PrimitiveConverter class defines a converter that creates primitive objects (wrapper),
+ * based on a provided input Class and String.
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see org.swixml.ConverterLibrary
+ */
+
+public class PrimitiveConverter implements Converter, SwingConstants, ScrollPaneConstants, KeyEvent, InputEvent {
+
+ /** converter's return type */
+ public static final Class TEMPLATE = Object.class;
+ /** map contains all constant provider types */
+ private static Map dictionaries = new HashMap();
+ /**
+ * Static Initializer, setting up the initial constant providers
+ */
+ static {
+ PrimitiveConverter.addConstantProvider( JTabbedPane.class );
+ PrimitiveConverter.addConstantProvider( JScrollPane.class );
+ PrimitiveConverter.addConstantProvider( JSplitPane.class );
+ PrimitiveConverter.addConstantProvider( GridBagConstraints.class );
+ PrimitiveConverter.addConstantProvider( FlowLayout.class );
+ PrimitiveConverter.addConstantProvider( ListSelectionModel.class );
+ PrimitiveConverter.addConstantProvider( TreeSelectionModel.class );
+ PrimitiveConverter.addConstantProvider( JDialog.class );
+ PrimitiveConverter.addConstantProvider( JFrame.class );
+ PrimitiveConverter.addConstantProvider( TitledBorder.class );
+ }
+ /**
+ * Converts String into java primitive type
+ * @param type Class target type
+ * @param attr Attribute value field needs to provide convertable String
+ * @param localizer Localizer
+ * @return Object primitive wrapped into wrapper object
+ * @throws NoSuchFieldException in case no class a field matching field name had been regsitered with this converter
+ * @throws IllegalAccessException if a matching field can not be accessed
+ */
+ public static Object conv( final Class type, final Attribute attr, final Localizer localizer ) throws NoSuchFieldException, IllegalAccessException {
+ Object obj = null;
+ if ( Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() ))
+ attr.setValue( localizer.getString( attr.getValue() ));
+
+ try {
+ if (boolean.class.equals( type )) {
+ obj = Boolean.valueOf(attr.getValue());
+ } else if (int.class.equals( type )) {
+ obj = Integer.valueOf( attr.getValue() );
+ } else if (long.class.equals( type )) {
+ obj = Long.valueOf( attr.getValue() );
+ } else if (float.class.equals( type )) {
+ obj = Float.valueOf( attr.getValue() );
+ } else if (double.class.equals( type )) {
+ obj = Double.valueOf( attr.getValue() );
+ }
+ } catch (Exception e) {
+ // intent. empty
+ } finally {
+ if (obj==null) {
+ try {
+ String s = attr.getValue();
+ int k = s.indexOf( '.' );
+ Class pp = dictionaries.get( s.substring( 0, k ) );
+ obj = pp.getField( s.substring( k + 1 ) ).get( pp );
+ } catch (Exception ex) {
+ //
+ // Try to find the given value as a Constant in SwingConstants
+ //
+ obj = PrimitiveConverter.class.getField( attr.getValue() ).get( PrimitiveConverter.class );
+ }
+ }
+ }
+
+ return obj;
+ }
+
+ /**
+ * Converts String into java primitive type
+ * @param type Class target type
+ * @param attr Attribute value field needs to provide convertable String
+ * @return Object primitive wrapped into wrapper object
+ * @throws Exception
+ */
+ public Object convert( final Class type, final Attribute attr, final Localizer localizer ) throws Exception {
+ return PrimitiveConverter.conv( type, attr, localizer );
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+
+ /**
+ * Adds a new class or interface to the dictionary of primitive providers.
+ * @param clazz Class providing primitive constants / public (final) fields
+ */
+ public static void addConstantProvider(final Class clazz) {
+ dictionaries.put( clazz.getSimpleName(), clazz );
+ }
+}
diff --git a/src/main/java/org/swixml/converters/RectangleConverter.java b/swixml-core/src/main/java/org/swixml/converters/RectangleConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/RectangleConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/RectangleConverter.java
index 10f1805..24d03ec 100755
--- a/src/main/java/org/swixml/converters/RectangleConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/RectangleConverter.java
@@ -1,121 +1,121 @@
-/*--
- $Id: RectangleConverter.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Localizer;
-
-import java.awt.*;
-import java.util.StringTokenizer;
-
-/**
- * A Converter that turns a Strings in the form: width,height into Rectangle objects.
- *
- * Examples for Valid XML attribute notations:
- *
- *
- * - bounds="10,10,250,200"
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- * @see java.awt.Rectangle
- * @see org.swixml.ConverterLibrary
- */
-
-public final class RectangleConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = Rectangle.class;
-
- /**
- * Converts a String into a Rectangle object
- * @param type Class not used
- * @param attr Attribute value fields needs provides convertable String
- * @return Object - runtime type is Dimension
- */
- public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
- if (attr != null) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
- int x = 0;
- int y = 0;
- int width = 0;
- int height = 0;
- if (st.hasMoreTokens()) {
- x = Integer.parseInt( st.nextToken().trim() );
- }
- if (st.hasMoreTokens()) {
- y = Integer.parseInt( st.nextToken().trim() );
- }
- if (st.hasMoreTokens()) {
- width = Integer.parseInt( st.nextToken().trim() );
- }
- if (st.hasMoreTokens()) {
- height = Integer.parseInt( st.nextToken().trim() );
- }
- return new Rectangle( x, y, width, height );
- }
- return null;
- }
-
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
+/*--
+ $Id: RectangleConverter.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Localizer;
+
+import java.awt.*;
+import java.util.StringTokenizer;
+
+/**
+ * A Converter that turns a Strings in the form: width,height into Rectangle objects.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ *
+ * - bounds="10,10,250,200"
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ * @see java.awt.Rectangle
+ * @see org.swixml.ConverterLibrary
+ */
+
+public final class RectangleConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = Rectangle.class;
+
+ /**
+ * Converts a String into a Rectangle object
+ * @param type Class not used
+ * @param attr Attribute value fields needs provides convertable String
+ * @return Object - runtime type is Dimension
+ */
+ public Object convert( final Class type, final Attribute attr, Localizer localizer ) {
+ if (attr != null) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "," );
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+ if (st.hasMoreTokens()) {
+ x = Integer.parseInt( st.nextToken().trim() );
+ }
+ if (st.hasMoreTokens()) {
+ y = Integer.parseInt( st.nextToken().trim() );
+ }
+ if (st.hasMoreTokens()) {
+ width = Integer.parseInt( st.nextToken().trim() );
+ }
+ if (st.hasMoreTokens()) {
+ height = Integer.parseInt( st.nextToken().trim() );
+ }
+ return new Rectangle( x, y, width, height );
+ }
+ return null;
+ }
+
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/swixml/converters/StringConverter.java b/swixml-core/src/main/java/org/swixml/converters/StringConverter.java
similarity index 97%
rename from src/main/java/org/swixml/converters/StringConverter.java
rename to swixml-core/src/main/java/org/swixml/converters/StringConverter.java
index bacdaec..0d812f7 100755
--- a/src/main/java/org/swixml/converters/StringConverter.java
+++ b/swixml-core/src/main/java/org/swixml/converters/StringConverter.java
@@ -1,99 +1,99 @@
-/*--
- $Id: StringConverter.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml.converters;
-
-import org.swixml.Attribute;
-import org.swixml.Converter;
-import org.swixml.Parser;
-import org.swixml.Localizer;
-
-
-/**
- * The StringConverter class defines / describes
- *
- *
- *
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
- *
- */
-public class StringConverter implements Converter {
- /** converter's return type */
- public static final Class TEMPLATE = String.class;
-
- /**
- * Convert the value of the given Attribute object into an output object of the
- * specified type.
- *
- * @param type Class Data type to which the Attribute's value should be converted
- * @param attr Attribute the attribute, providing the value to be converted.
- *
- */
- public Object convert( Class type, final Attribute attr, Localizer localizer ) throws Exception {
- //
- // Localize Strings but only if Attribute calls for localization.
- //
- if ( Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() ))
- return localizer.getString( attr.getValue() );
- return attr.getValue();
- }
-
- /**
- * A Converters conversTo method informs about the Class type the converter
- * is returning when its convert method is called
- * @return Class - the Class the converter is returning when its convert method is called
- */
- public Class convertsTo() {
- return TEMPLATE;
- }
-}
+/*--
+ $Id: StringConverter.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml.converters;
+
+import org.swixml.Attribute;
+import org.swixml.Converter;
+import org.swixml.Parser;
+import org.swixml.Localizer;
+
+
+/**
+ * The StringConverter class defines / describes
+ *
+ *
+ *
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+ *
+ */
+public class StringConverter implements Converter {
+ /** converter's return type */
+ public static final Class TEMPLATE = String.class;
+
+ /**
+ * Convert the value of the given Attribute object into an output object of the
+ * specified type.
+ *
+ * @param type Class Data type to which the Attribute's value should be converted
+ * @param attr Attribute the attribute, providing the value to be converted.
+ *
+ */
+ public Object convert( Class type, final Attribute attr, Localizer localizer ) throws Exception {
+ //
+ // Localize Strings but only if Attribute calls for localization.
+ //
+ if ( Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() ))
+ return localizer.getString( attr.getValue() );
+ return attr.getValue();
+ }
+
+ /**
+ * A Converters conversTo method informs about the Class type the converter
+ * is returning when its convert method is called
+ * @return Class - the Class the converter is returning when its convert method is called
+ */
+ public Class convertsTo() {
+ return TEMPLATE;
+ }
+}
diff --git a/src/main/java/org/swixml/converters/Util.java b/swixml-core/src/main/java/org/swixml/converters/Util.java
similarity index 97%
rename from src/main/java/org/swixml/converters/Util.java
rename to swixml-core/src/main/java/org/swixml/converters/Util.java
index a8cd5c9..df42299 100755
--- a/src/main/java/org/swixml/converters/Util.java
+++ b/swixml-core/src/main/java/org/swixml/converters/Util.java
@@ -1,142 +1,142 @@
-/*--
- $Id: Util.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.converters;
-
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.w3c.dom.Element;
-
-/**
- * Util. Class with static helper methods
- * @author Wolf Paulus
- * @version $Revision: 1.1 $
-
- */
-public final class Util {
- /**
- * Returns the remaining tokens of a StringTokenizer in an int-Array
- * @param st StringTokenizer
- * @return int[] array containing the remaining tokens converted into int(s)
- */
- public static int[] ia( StringTokenizer st ) {
- int size = st != null ? st.countTokens() : 0;
- int[] a = new int[size];
- int i = 0;
- while (st != null && st.hasMoreTokens()) {
- try {
- a[i] = Integer.parseInt( st.nextToken().trim() );
- i++;
- } catch (NumberFormatException e) {
- // no exceptiion handling required
- }
- }
- int[] b = new int[i];
- System.arraycopy( a, 0, b, 0, i );
- return b;
- }
-
- /**
- * Returns the remaining tokens of a StringTokenizer in a double-Array
- * @param st StringTokenizer
- * @return double[] array containing the remaining tokens converted into double(s)
- */
- public static double[] da( StringTokenizer st ) {
- int size = st != null ? st.countTokens() : 0;
- double[] a = new double[size];
- int i = 0;
- while (st != null && st.hasMoreTokens()) {
- try {
- a[i] = Double.parseDouble( st.nextToken().trim() );
- i++;
- } catch (NumberFormatException e) {
- // no exceptiion handling required
- }
- }
- double[] b = new double[i];
- System.arraycopy( a, 0, b, 0, i );
- return b;
- }
- /**
- * Return a capitalized version of the specified property name.
- *
- * @param s String The property name
- * @return String given String with 1st letter capitalized
- */
- public static final String capitalize( final String s ) {
- String cs = null;
- if (s != null && 0 < s.length()) {
- final char[] chars = s.toCharArray();
- chars[0] = Character.toUpperCase( chars[0] );
- cs = new String( chars );
- }
- return cs;
- }
-
- /**
- * Returns the integer value of the given XML attribute; or the default value.
- */
- public static final int getInteger( final Element element, final String attr, int def ) {
- String value = Attribute.getAttributeValue(element,attr);
- if (value == null)
- return def;
-
- try {
- return Integer.parseInt( value.trim() );
- } catch (NumberFormatException e) {
- // no exceptiion handling required
- return def;
- }
- }
-}
+/*--
+ $Id: Util.java,v 1.1 2004/03/01 07:56:03 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.converters;
+
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.w3c.dom.Element;
+
+/**
+ * Util. Class with static helper methods
+ * @author Wolf Paulus
+ * @version $Revision: 1.1 $
+
+ */
+public final class Util {
+ /**
+ * Returns the remaining tokens of a StringTokenizer in an int-Array
+ * @param st StringTokenizer
+ * @return int[] array containing the remaining tokens converted into int(s)
+ */
+ public static int[] ia( StringTokenizer st ) {
+ int size = st != null ? st.countTokens() : 0;
+ int[] a = new int[size];
+ int i = 0;
+ while (st != null && st.hasMoreTokens()) {
+ try {
+ a[i] = Integer.parseInt( st.nextToken().trim() );
+ i++;
+ } catch (NumberFormatException e) {
+ // no exceptiion handling required
+ }
+ }
+ int[] b = new int[i];
+ System.arraycopy( a, 0, b, 0, i );
+ return b;
+ }
+
+ /**
+ * Returns the remaining tokens of a StringTokenizer in a double-Array
+ * @param st StringTokenizer
+ * @return double[] array containing the remaining tokens converted into double(s)
+ */
+ public static double[] da( StringTokenizer st ) {
+ int size = st != null ? st.countTokens() : 0;
+ double[] a = new double[size];
+ int i = 0;
+ while (st != null && st.hasMoreTokens()) {
+ try {
+ a[i] = Double.parseDouble( st.nextToken().trim() );
+ i++;
+ } catch (NumberFormatException e) {
+ // no exceptiion handling required
+ }
+ }
+ double[] b = new double[i];
+ System.arraycopy( a, 0, b, 0, i );
+ return b;
+ }
+ /**
+ * Return a capitalized version of the specified property name.
+ *
+ * @param s String The property name
+ * @return String given String with 1st letter capitalized
+ */
+ public static final String capitalize( final String s ) {
+ String cs = null;
+ if (s != null && 0 < s.length()) {
+ final char[] chars = s.toCharArray();
+ chars[0] = Character.toUpperCase( chars[0] );
+ cs = new String( chars );
+ }
+ return cs;
+ }
+
+ /**
+ * Returns the integer value of the given XML attribute; or the default value.
+ */
+ public static final int getInteger( final Element element, final String attr, int def ) {
+ String value = Attribute.getAttributeValue(element,attr);
+ if (value == null)
+ return def;
+
+ try {
+ return Integer.parseInt( value.trim() );
+ } catch (NumberFormatException e) {
+ // no exceptiion handling required
+ return def;
+ }
+ }
+}
diff --git a/swixml-core/src/main/java/org/swixml/doc-files/.gitignore b/swixml-core/src/main/java/org/swixml/doc-files/.gitignore
new file mode 100644
index 0000000..fdb381f
--- /dev/null
+++ b/swixml-core/src/main/java/org/swixml/doc-files/.gitignore
@@ -0,0 +1 @@
+/*.DS_Store
diff --git a/src/main/java/org/swixml/doc-files/swixml_1_0.png b/swixml-core/src/main/java/org/swixml/doc-files/swixml_1_0.png
similarity index 100%
rename from src/main/java/org/swixml/doc-files/swixml_1_0.png
rename to swixml-core/src/main/java/org/swixml/doc-files/swixml_1_0.png
diff --git a/swixml-core/src/main/java/org/swixml/layoutconverters/.gitignore b/swixml-core/src/main/java/org/swixml/layoutconverters/.gitignore
new file mode 100644
index 0000000..fdb381f
--- /dev/null
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/.gitignore
@@ -0,0 +1 @@
+/*.DS_Store
diff --git a/src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java
index 12d5f52..68f8594 100644
--- a/src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/BorderLayoutConverter.java
@@ -1,174 +1,174 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.BorderLayout;
-import java.awt.LayoutManager;
-import java.lang.reflect.Field;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-/**
- * A layout converter for java.awt.BorderLayout.
- *
- * Examples:
- *
- * <panel layout="BorderLayout">
- * <panel constraints="BorderLayout.NORTH" />
- * <panel constraints="BorderLayout.CENTER" />
- * </panel>
- *
- *
- *
- * <panel layout="BorderLayout(10,20)">
- * <panel constraints="NORTH" />
- * <panel constraints="CENTER" />
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="BorderLayout" hgap="10" vgap="20"/>
- * <panel constraints="NORTH" />
- * <panel constraints="CENTER" />
- * </panel>
- *
- *
- * @author Karl Tauber
- * @author Wolf Paulus
- */
-public class BorderLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "borderlayout".
- */
- public String getID() {
- return "borderlayout";
- }
-
- /**
- * Creates a BorderLayout instance.
- *
- * Examples for Valid XML attribute notations:
- *
- * layout="BorderLayout"
- * layout="BorderLayout(int hgap, int vgap)"
- *
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- st.nextToken(); // skip layout type
-
- int[] para = Util.ia( st );
- if (para.length < 2)
- return new BorderLayout();
- else
- return new BorderLayout( para[ 0 ], para[ 1 ] );
- }
-
- /**
- * Creates a BorderLayout instance.
- *
- * Attributes:
- *
- * hgap (optional): The horizontal gap.
- * vgap (optional): The vertical gap.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="BorderLayout"/>
- * <layout type="BorderLayout" hgap="10" vgap="20"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- int hgap = Util.getInteger(element, "hgap", 0);
- int vgap = Util.getInteger(element, "vgap", 0);
- return new BorderLayout(hgap, vgap);
- }
-
- /**
- * Converts BorderLayout constraints.
- *
- * Examples for Valid XML attribute notations:
- *
- * constraints="BorderLayout.CENTER"
- * constraints="BorderLayout.NORTH"
- * constraints="EAST"
- *
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- String value = attr.getValue();
- Field[] fields = BorderLayout.class.getFields();
- for (int i = 0; i < fields.length; i++) {
- if (value.endsWith( fields[i].getName() )) {
- try {
- return fields[i].get( BorderLayout.class );
- } catch (Exception e) {
- }
- break;
- }
- }
- return null;
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.BorderLayout;
+import java.awt.LayoutManager;
+import java.lang.reflect.Field;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+/**
+ * A layout converter for java.awt.BorderLayout.
+ *
+ * Examples:
+ *
+ * <panel layout="BorderLayout">
+ * <panel constraints="BorderLayout.NORTH" />
+ * <panel constraints="BorderLayout.CENTER" />
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="BorderLayout(10,20)">
+ * <panel constraints="NORTH" />
+ * <panel constraints="CENTER" />
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="BorderLayout" hgap="10" vgap="20"/>
+ * <panel constraints="NORTH" />
+ * <panel constraints="CENTER" />
+ * </panel>
+ *
+ *
+ * @author Karl Tauber
+ * @author Wolf Paulus
+ */
+public class BorderLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "borderlayout".
+ */
+ public String getID() {
+ return "borderlayout";
+ }
+
+ /**
+ * Creates a BorderLayout instance.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * layout="BorderLayout"
+ * layout="BorderLayout(int hgap, int vgap)"
+ *
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ st.nextToken(); // skip layout type
+
+ int[] para = Util.ia( st );
+ if (para.length < 2)
+ return new BorderLayout();
+ else
+ return new BorderLayout( para[ 0 ], para[ 1 ] );
+ }
+
+ /**
+ * Creates a BorderLayout instance.
+ *
+ * Attributes:
+ *
+ * hgap (optional): The horizontal gap.
+ * vgap (optional): The vertical gap.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="BorderLayout"/>
+ * <layout type="BorderLayout" hgap="10" vgap="20"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ int hgap = Util.getInteger(element, "hgap", 0);
+ int vgap = Util.getInteger(element, "vgap", 0);
+ return new BorderLayout(hgap, vgap);
+ }
+
+ /**
+ * Converts BorderLayout constraints.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * constraints="BorderLayout.CENTER"
+ * constraints="BorderLayout.NORTH"
+ * constraints="EAST"
+ *
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ String value = attr.getValue();
+ Field[] fields = BorderLayout.class.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ if (value.endsWith( fields[i].getName() )) {
+ try {
+ return fields[i].get( BorderLayout.class );
+ } catch (Exception e) {
+ }
+ break;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java
index a2785e2..34b5429 100644
--- a/src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/CardLayoutConverter.java
@@ -1,167 +1,167 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.CardLayout;
-import java.awt.LayoutManager;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-/**
- * A layout converter for java.awt.CardLayout.
- *
- * Examples:
- *
- * <panel layout="CardLayout">
- * <panel constraints="card1" />
- * <panel constraints="card2" />
- * </panel>
- *
- *
- *
- * <panel layout="CardLayout(10,20)">
- * <panel constraints="firstCard" />
- * <panel constraints="secondCard" />
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="CardLayout" hgap="10" vgap="20"/>
- * <panel constraints="firstCard" />
- * <panel constraints="secondCard" />
- * </panel>
- *
- *
- * Here is how to access the card layout manager of a component installed by SwixML
- * (CardLayout)((Container)swingEngine.find("id_of_my_CLed_comp")).getLayout()
- *
- * @author Karl Tauber
- * @author Wolf Paulus
- */
-public class CardLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "cardlayout".
- */
- public String getID() {
- return "cardlayout";
- }
-
- /**
- * Creates a CardLayout instance.
- *
- * Examples for Valid XML attribute notations:
- *
- * layout="CardLayout"
- * layout="CardLayout(int hgap, int vgap)"
- *
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- st.nextToken(); // skip layout type
-
- int[] para = Util.ia( st );
- if (para.length < 2)
- return new CardLayout();
- else
- return new CardLayout( para[ 0 ], para[ 1 ] );
- }
-
- /**
- * Creates a CardLayout instance.
- *
- * Attributes:
- *
- * hgap (optional): The horizontal gap.
- * vgap (optional): The vertical gap.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="CardLayout"/>
- * <layout type="CardLayout" hgap="10" vgap="20"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- int hgap = Util.getInteger(element, "hgap", 0);
- int vgap = Util.getInteger(element, "vgap", 0);
- return new CardLayout(hgap, vgap);
- }
-
- /**
- * Converts CardLayout constraints.
- * The attribute value is used as card name.
- *
- * Examples for Valid XML attribute notations:
- *
- * constraints="cardname"
- *
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- //
- // CardLayout accepts only constraints of type String
- //
- return attr.getValue();
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.CardLayout;
+import java.awt.LayoutManager;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+/**
+ * A layout converter for java.awt.CardLayout.
+ *
+ * Examples:
+ *
+ * <panel layout="CardLayout">
+ * <panel constraints="card1" />
+ * <panel constraints="card2" />
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="CardLayout(10,20)">
+ * <panel constraints="firstCard" />
+ * <panel constraints="secondCard" />
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="CardLayout" hgap="10" vgap="20"/>
+ * <panel constraints="firstCard" />
+ * <panel constraints="secondCard" />
+ * </panel>
+ *
+ *
+ * Here is how to access the card layout manager of a component installed by SwixML
+ * (CardLayout)((Container)swingEngine.find("id_of_my_CLed_comp")).getLayout()
+ *
+ * @author Karl Tauber
+ * @author Wolf Paulus
+ */
+public class CardLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "cardlayout".
+ */
+ public String getID() {
+ return "cardlayout";
+ }
+
+ /**
+ * Creates a CardLayout instance.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * layout="CardLayout"
+ * layout="CardLayout(int hgap, int vgap)"
+ *
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ st.nextToken(); // skip layout type
+
+ int[] para = Util.ia( st );
+ if (para.length < 2)
+ return new CardLayout();
+ else
+ return new CardLayout( para[ 0 ], para[ 1 ] );
+ }
+
+ /**
+ * Creates a CardLayout instance.
+ *
+ * Attributes:
+ *
+ * hgap (optional): The horizontal gap.
+ * vgap (optional): The vertical gap.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="CardLayout"/>
+ * <layout type="CardLayout" hgap="10" vgap="20"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ int hgap = Util.getInteger(element, "hgap", 0);
+ int vgap = Util.getInteger(element, "vgap", 0);
+ return new CardLayout(hgap, vgap);
+ }
+
+ /**
+ * Converts CardLayout constraints.
+ * The attribute value is used as card name.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * constraints="cardname"
+ *
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ //
+ // CardLayout accepts only constraints of type String
+ //
+ return attr.getValue();
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java
index 75e1a96..5e7dfba 100644
--- a/src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/FlowLayoutConverter.java
@@ -1,192 +1,192 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.FlowLayout;
-import java.awt.LayoutManager;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.converters.PrimitiveConverter;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-/**
- * A layout converter for java.awt.FlowLayout.
- *
- * Examples:
- *
- * <panel layout="FlowLayout">
- * <panel ... />
- * <panel ... />
- * </panel>
- *
- *
- *
- * <panel layout="FlowLayout(FlowLayout.RIGHT)">
- * ...
- * </panel>
- *
- *
- *
- * <panel layout="FlowLayout(FlowLayout.LEFT, 1, 2)">
- * ...
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="FlowLayout" alignment="FlowLayout.RIGHT"/>
- * ...
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="FlowLayout" alignment="FlowLayout.LEFT" hgap="10" vgap="20"/>
- * ...
- * </panel>
- *
- *
- * @author Karl Tauber
- * @author Wolf Paulus
- */
-public class FlowLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "flowlayout".
- */
- public String getID() {
- return "flowlayout";
- }
-
- /**
- * Creates a FlowLayout instance.
- *
- * Examples for Valid XML attribute notations:
- *
- * layout="FlowLayout"
- * layout="FlowLayout(int align)"
- * layout="FlowLayout(int align, int hgap, int vgap)"
- *
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- st.nextToken(); // skip layout type
-
- try {
- if (st.hasMoreTokens()) {
- //
- // First FlowLayout parameter might be a pre-defined constant's name
- //
- Object o = PrimitiveConverter.conv( null, new Attribute( "NA", st.nextToken() ), null );
- int[] para = Util.ia( st );
- //
- // Remaining paramters should be integer values
- //
- if (para.length < 2)
- return new FlowLayout( Integer.valueOf( o.toString() ).intValue() );
- else
- return new FlowLayout( Integer.valueOf( o.toString() ).intValue(), para[ 0 ], para[ 1 ] );
- }
- } catch (Exception e) {
- }
- return new FlowLayout();
- }
-
- /**
- * Creates a FlowLayout instance.
- *
- * Attributes:
- *
- * alignment (optional): The horizontal alignment.
- * hgap (optional): The horizontal gap.
- * vgap (optional): The vertical gap.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="FlowLayout"/>
- * <layout type="FlowLayout" alignment="FlowLayout.LEFT"/>
- * <layout type="FlowLayout" alignment="FlowLayout.LEFT" hgap="10" vgap="20"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- int align = FlowLayout.CENTER;
- String value = Attribute.getAttributeValue(element,"alignment");
- if (value != null) {
- try {
- Object o = PrimitiveConverter.conv( null, new Attribute( "NA", value ), null );
- align = Integer.valueOf( o.toString() ).intValue();
- } catch (Exception ex) {
- }
- }
- int hgap = Util.getInteger(element, "hgap", 5);
- int vgap = Util.getInteger(element, "vgap", 5);
- return new FlowLayout(align, hgap, vgap);
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- return null;
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.FlowLayout;
+import java.awt.LayoutManager;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.converters.PrimitiveConverter;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+/**
+ * A layout converter for java.awt.FlowLayout.
+ *
+ * Examples:
+ *
+ * <panel layout="FlowLayout">
+ * <panel ... />
+ * <panel ... />
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="FlowLayout(FlowLayout.RIGHT)">
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="FlowLayout(FlowLayout.LEFT, 1, 2)">
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="FlowLayout" alignment="FlowLayout.RIGHT"/>
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="FlowLayout" alignment="FlowLayout.LEFT" hgap="10" vgap="20"/>
+ * ...
+ * </panel>
+ *
+ *
+ * @author Karl Tauber
+ * @author Wolf Paulus
+ */
+public class FlowLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "flowlayout".
+ */
+ public String getID() {
+ return "flowlayout";
+ }
+
+ /**
+ * Creates a FlowLayout instance.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * layout="FlowLayout"
+ * layout="FlowLayout(int align)"
+ * layout="FlowLayout(int align, int hgap, int vgap)"
+ *
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ st.nextToken(); // skip layout type
+
+ try {
+ if (st.hasMoreTokens()) {
+ //
+ // First FlowLayout parameter might be a pre-defined constant's name
+ //
+ Object o = PrimitiveConverter.conv( null, new Attribute( "NA", st.nextToken() ), null );
+ int[] para = Util.ia( st );
+ //
+ // Remaining paramters should be integer values
+ //
+ if (para.length < 2)
+ return new FlowLayout( Integer.valueOf( o.toString() ).intValue() );
+ else
+ return new FlowLayout( Integer.valueOf( o.toString() ).intValue(), para[ 0 ], para[ 1 ] );
+ }
+ } catch (Exception e) {
+ }
+ return new FlowLayout();
+ }
+
+ /**
+ * Creates a FlowLayout instance.
+ *
+ * Attributes:
+ *
+ * alignment (optional): The horizontal alignment.
+ * hgap (optional): The horizontal gap.
+ * vgap (optional): The vertical gap.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="FlowLayout"/>
+ * <layout type="FlowLayout" alignment="FlowLayout.LEFT"/>
+ * <layout type="FlowLayout" alignment="FlowLayout.LEFT" hgap="10" vgap="20"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ int align = FlowLayout.CENTER;
+ String value = Attribute.getAttributeValue(element,"alignment");
+ if (value != null) {
+ try {
+ Object o = PrimitiveConverter.conv( null, new Attribute( "NA", value ), null );
+ align = Integer.valueOf( o.toString() ).intValue();
+ } catch (Exception ex) {
+ }
+ }
+ int hgap = Util.getInteger(element, "hgap", 5);
+ int vgap = Util.getInteger(element, "vgap", 5);
+ return new FlowLayout(align, hgap, vgap);
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ return null;
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java
index 035c485..5b05b0a 100644
--- a/src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/FormLayoutConverter.java
@@ -1,207 +1,207 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.LayoutManager;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-import com.jgoodies.forms.layout.CellConstraints;
-import com.jgoodies.forms.layout.FormLayout;
-
-/**
- * A layout converter for com.jgoodies.forms.layout.FormLayout.
- *
- * Examples:
- *
- * <panel>
- * <layout type="FormLayout"
- * columns="p, 3dlu, p:grow"
- * rows="p, 3dlu, p"/>
- *
- * <label constraints="1,1" text="Company"/>
- * <textfield constraints="3,1"/>
- * <label constraints="1,3" text="Contact"/>
- * <textfield constraints="3,3"/>
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="FormLayout"
- * columns="right:max(40dlu;pref), 3dlu, d:grow, 7dlu, right:pref, 3dlu, d:grow"
- * rows="p, 3dlu, p, 9dlu, p, 3dlu, p"
- * columnGroups="1,5; 3,7"/>
- *
- * <label constraints="1,1" text="Company"/>
- * <textfield constraints="3,1,5,1"/>
- * <label constraints="1,3" text="Contact"/>
- * <textfield constraints="3,3,5,1"/>
- *
- * <label constraints="1,5" text="PTI [kW]"/>
- * <textfield constraints="3,5"/>
- * <label constraints="5,5" text="Power [kW]"/>
- * <textfield constraints="7,5"/>
- * <label constraints="1,7" text="R [mm]"/>
- * <textfield constraints="3,7"/>
- * <label constraints="5,7" text="D [mm]"/>
- * <textfield constraints="7,7"/>
- * </panel>
- *
- *
- * @author Karl Tauber
- */
-public class FormLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "formlayout".
- */
- public String getID() {
- return "formlayout";
- }
-
- /**
- * Returns always null.
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- return null;
- }
-
- /**
- * Creates a FormLayout instance.
- *
- * Attributes:
- *
- * columns (required): The column specifications as documented in JGoodies FormLayout.
- * row (required): The row specifications as documented in JGoodies FormLayout.
- * columnGroups (optional): The column groups, where each column
- * in a group gets the same group wide width. Groups are separated by semicolons,
- * column indices in a group are separated by colons. E.g. "1,5; 3,7,9" defines
- * two groups, where first group contains columns 1 and 5; and second group
- * contains columns 3, 7 and 9. Note that column indices are 1-based.
- * rowGroups (optional): The row groups, where each row
- * in a group gets the same group wide height. Groups are separated by semicolons,
- * row indices in a group are separated by colons. E.g. "1,5; 3,7,9" defines
- * two groups, where first group contains rows 1 and 5; and second group
- * contains rows 3, 7 and 9. Note that row indices are 1-based.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="FormLayout" columns="p, 3dlu, p" rows="p, 3dlu, p"/>
- * <layout type="FormLayout" columns="p, 3dlu, p, 3dlu, p, 3dlu, p" rows="p, 3dlu, p"
- * columnGroups="1,5; 3,7" rowGroups="1,3"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- String encodedColumnSpecs = Attribute.getAttributeValue(element,"columns");
- String encodedRowSpecs = Attribute.getAttributeValue(element,"rows");
- int[][] columnGroupIndices = convertGroupIndices(Attribute.getAttributeValue(element,"columnGroups"));
- int[][] rowGroupIndices = convertGroupIndices(Attribute.getAttributeValue(element,"rowGroups"));
-
- FormLayout lm = new FormLayout( encodedColumnSpecs, encodedRowSpecs );
- if (columnGroupIndices != null)
- lm.setColumnGroups(columnGroupIndices);
- if (rowGroupIndices != null)
- lm.setRowGroups(rowGroupIndices);
-
- return lm;
- }
-
- /**
- * Creates a CellConstraints instance.
- *
- * Allowed syntaxes of attribute value:
- *
- * "x, y"
- * "x, y, w, h"
- * "x, y, hAlign, vAlign"
- * "x, y, w, h, hAlign, vAlign"
- *
- * See JGoodies FormLayout for details.
- *
- * Examples for Valid XML attribute notations:
- *
- * constraints="1, 3"
- * constraints="1, 3, 2, 1"
- * constraints="1, 3, left, bottom"
- * constraints="1, 3, 2, 1, l, b"
- *
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- return new CellConstraints( attr.getValue() );
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-
- private int[][] convertGroupIndices( final String groups ) {
- if (groups == null)
- return null;
- StringTokenizer st = new StringTokenizer( groups, ";" );
- int[][] groupIndices = new int[st.countTokens()][];
- int i = 0;
- while (st.hasMoreTokens() ) {
- String group = st.nextToken();
- groupIndices[i++] = Util.ia(new StringTokenizer( group, "," ));
- }
- return groupIndices;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.LayoutManager;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+import com.jgoodies.forms.layout.CellConstraints;
+import com.jgoodies.forms.layout.FormLayout;
+
+/**
+ * A layout converter for com.jgoodies.forms.layout.FormLayout.
+ *
+ * Examples:
+ *
+ * <panel>
+ * <layout type="FormLayout"
+ * columns="p, 3dlu, p:grow"
+ * rows="p, 3dlu, p"/>
+ *
+ * <label constraints="1,1" text="Company"/>
+ * <textfield constraints="3,1"/>
+ * <label constraints="1,3" text="Contact"/>
+ * <textfield constraints="3,3"/>
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="FormLayout"
+ * columns="right:max(40dlu;pref), 3dlu, d:grow, 7dlu, right:pref, 3dlu, d:grow"
+ * rows="p, 3dlu, p, 9dlu, p, 3dlu, p"
+ * columnGroups="1,5; 3,7"/>
+ *
+ * <label constraints="1,1" text="Company"/>
+ * <textfield constraints="3,1,5,1"/>
+ * <label constraints="1,3" text="Contact"/>
+ * <textfield constraints="3,3,5,1"/>
+ *
+ * <label constraints="1,5" text="PTI [kW]"/>
+ * <textfield constraints="3,5"/>
+ * <label constraints="5,5" text="Power [kW]"/>
+ * <textfield constraints="7,5"/>
+ * <label constraints="1,7" text="R [mm]"/>
+ * <textfield constraints="3,7"/>
+ * <label constraints="5,7" text="D [mm]"/>
+ * <textfield constraints="7,7"/>
+ * </panel>
+ *
+ *
+ * @author Karl Tauber
+ */
+public class FormLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "formlayout".
+ */
+ public String getID() {
+ return "formlayout";
+ }
+
+ /**
+ * Returns always null.
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ return null;
+ }
+
+ /**
+ * Creates a FormLayout instance.
+ *
+ * Attributes:
+ *
+ * columns (required): The column specifications as documented in JGoodies FormLayout.
+ * row (required): The row specifications as documented in JGoodies FormLayout.
+ * columnGroups (optional): The column groups, where each column
+ * in a group gets the same group wide width. Groups are separated by semicolons,
+ * column indices in a group are separated by colons. E.g. "1,5; 3,7,9" defines
+ * two groups, where first group contains columns 1 and 5; and second group
+ * contains columns 3, 7 and 9. Note that column indices are 1-based.
+ * rowGroups (optional): The row groups, where each row
+ * in a group gets the same group wide height. Groups are separated by semicolons,
+ * row indices in a group are separated by colons. E.g. "1,5; 3,7,9" defines
+ * two groups, where first group contains rows 1 and 5; and second group
+ * contains rows 3, 7 and 9. Note that row indices are 1-based.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="FormLayout" columns="p, 3dlu, p" rows="p, 3dlu, p"/>
+ * <layout type="FormLayout" columns="p, 3dlu, p, 3dlu, p, 3dlu, p" rows="p, 3dlu, p"
+ * columnGroups="1,5; 3,7" rowGroups="1,3"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ String encodedColumnSpecs = Attribute.getAttributeValue(element,"columns");
+ String encodedRowSpecs = Attribute.getAttributeValue(element,"rows");
+ int[][] columnGroupIndices = convertGroupIndices(Attribute.getAttributeValue(element,"columnGroups"));
+ int[][] rowGroupIndices = convertGroupIndices(Attribute.getAttributeValue(element,"rowGroups"));
+
+ FormLayout lm = new FormLayout( encodedColumnSpecs, encodedRowSpecs );
+ if (columnGroupIndices != null)
+ lm.setColumnGroups(columnGroupIndices);
+ if (rowGroupIndices != null)
+ lm.setRowGroups(rowGroupIndices);
+
+ return lm;
+ }
+
+ /**
+ * Creates a CellConstraints instance.
+ *
+ * Allowed syntaxes of attribute value:
+ *
+ * "x, y"
+ * "x, y, w, h"
+ * "x, y, hAlign, vAlign"
+ * "x, y, w, h, hAlign, vAlign"
+ *
+ * See JGoodies FormLayout for details.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * constraints="1, 3"
+ * constraints="1, 3, 2, 1"
+ * constraints="1, 3, left, bottom"
+ * constraints="1, 3, 2, 1, l, b"
+ *
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ return new CellConstraints( attr.getValue() );
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+
+ private int[][] convertGroupIndices( final String groups ) {
+ if (groups == null)
+ return null;
+ StringTokenizer st = new StringTokenizer( groups, ";" );
+ int[][] groupIndices = new int[st.countTokens()][];
+ int i = 0;
+ while (st.hasMoreTokens() ) {
+ String group = st.nextToken();
+ groupIndices[i++] = Util.ia(new StringTokenizer( group, "," ));
+ }
+ return groupIndices;
+ }
+}
diff --git a/src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java
index 26a3bab..2b45b83 100644
--- a/src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/GridBagLayoutConverter.java
@@ -1,211 +1,211 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.GridBagLayout;
-import java.awt.LayoutManager;
-import java.lang.reflect.Field;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.SwingEngine;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-/**
- * A layout converter for java.awt.GridBagLayout.
- *
- * Examples:
- *
- * <panel layout="GridBagLayout">
- * <button>
- * <gridbagconstraints
- * gridx="1" gridy="2" gridwidth="3" gridheight="4" weightx="0.1" weighty="1"
- * anchor="GridBagConstraints.NORTH" fill="GridBagConstraints.HORIZONTAL"
- * insets="1,2,3,4" ipadx="5" ipady="6"/>
- * </button>
- * <button>
- * <gridbagconstraints gridx="2" gridy="3"/>
- * </button>
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="GridBagLayout" columnWidths="200, 400, 150">
- * <button>
- * <gridbagconstraints gridx="1" gridy="2"/>
- * </button>
- * <button>
- * <gridbagconstraints gridx="2" gridy="3"/>
- * </button>
- * </panel>
- *
- *
- * @author Karl Tauber
- * @author Wolf Paulus
- */
-public class GridBagLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "gridbaglayout".
- */
- public String getID() {
- return "gridbaglayout";
- }
-
- /**
- * Creates a GridBagLayout instance.
- *
- * Examples for Valid XML attribute notations:
- *
- * layout="GridBagLayout"
- * layout="GridBagLayout(rowWeights(0,0,1.0,0))"
- * layout="GridBagLayout(columnWeights(0.5, 0.5, 1.0, 99.9))"
- * layout="GridBagLayout(columnWidths(5, 5, 10, 33))"
- * layout="GridBagLayout(rowHeights(5, 5, 10, 33))"
- *
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- st.nextToken(); // skip layout type
-
- //
- // Gridbag Layouts have some public arrays, accept one but only one.
- // public double[] rowWeights
- // public double[] colWeights
- //
- GridBagLayout lm = new GridBagLayout();
-
- if (st.hasMoreTokens()) {
- try {
- String fieldname = st.nextToken();
- Field field = GridBagLayout.class.getField( fieldname );
- if (field != null) {
- Class fieldtype = field.getType();
-
- if (int[].class.equals( fieldtype )) {
- field.set( lm, Util.ia( st ) );
- } else if (double[].class.equals( fieldtype )) {
- field.set( lm, Util.da( st ) );
- }
-
- }
- } catch (NoSuchFieldException e) {
- if (SwingEngine.DEBUG_MODE)
- System.err.println( e.getMessage() );
- } catch (SecurityException e) {
- if (SwingEngine.DEBUG_MODE)
- System.err.println( e.getMessage() );
- } catch (IllegalArgumentException e) {
- if (SwingEngine.DEBUG_MODE)
- System.err.println( e.getMessage() );
- } catch (IllegalAccessException e) {
- if (SwingEngine.DEBUG_MODE)
- System.err.println( e.getMessage() );
- }
- }
- return lm;
- }
-
- /**
- * Creates a GridBagLayout instance.
- *
- * Attributes:
- *
- * columnWidths (optional): The minimum column widths.
- * rowHeights (optional): The minimum row heights.
- * columnWeights (optional): The column weights.
- * rowWeights (optional): The row weights.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="GridBagLayout"/>
- * <layout type="GridBagLayout" columnWidths="5, 5, 10, 33" rowWeights="0,0,1.0,0"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- String columnWidths = Attribute.getAttributeValue(element,"columnWidths");
- String rowHeights = Attribute.getAttributeValue(element,"rowHeights");
- String columnWeights = Attribute.getAttributeValue(element,"columnWeights");
- String rowWeights = Attribute.getAttributeValue(element,"rowWeights");
-
- GridBagLayout lm = new GridBagLayout();
-
- if (columnWidths != null)
- lm.columnWidths = Util.ia(new StringTokenizer(columnWidths,","));
- if (rowHeights != null)
- lm.rowHeights = Util.ia(new StringTokenizer(rowHeights,","));
- if (columnWeights != null)
- lm.columnWeights = Util.da(new StringTokenizer(columnWeights,","));
- if (rowWeights != null)
- lm.rowWeights = Util.da(new StringTokenizer(rowWeights,","));
-
- return lm;
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- return null;
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.GridBagLayout;
+import java.awt.LayoutManager;
+import java.lang.reflect.Field;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.SwingEngine;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+/**
+ * A layout converter for java.awt.GridBagLayout.
+ *
+ * Examples:
+ *
+ * <panel layout="GridBagLayout">
+ * <button>
+ * <gridbagconstraints
+ * gridx="1" gridy="2" gridwidth="3" gridheight="4" weightx="0.1" weighty="1"
+ * anchor="GridBagConstraints.NORTH" fill="GridBagConstraints.HORIZONTAL"
+ * insets="1,2,3,4" ipadx="5" ipady="6"/>
+ * </button>
+ * <button>
+ * <gridbagconstraints gridx="2" gridy="3"/>
+ * </button>
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="GridBagLayout" columnWidths="200, 400, 150">
+ * <button>
+ * <gridbagconstraints gridx="1" gridy="2"/>
+ * </button>
+ * <button>
+ * <gridbagconstraints gridx="2" gridy="3"/>
+ * </button>
+ * </panel>
+ *
+ *
+ * @author Karl Tauber
+ * @author Wolf Paulus
+ */
+public class GridBagLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "gridbaglayout".
+ */
+ public String getID() {
+ return "gridbaglayout";
+ }
+
+ /**
+ * Creates a GridBagLayout instance.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * layout="GridBagLayout"
+ * layout="GridBagLayout(rowWeights(0,0,1.0,0))"
+ * layout="GridBagLayout(columnWeights(0.5, 0.5, 1.0, 99.9))"
+ * layout="GridBagLayout(columnWidths(5, 5, 10, 33))"
+ * layout="GridBagLayout(rowHeights(5, 5, 10, 33))"
+ *
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ st.nextToken(); // skip layout type
+
+ //
+ // Gridbag Layouts have some public arrays, accept one but only one.
+ // public double[] rowWeights
+ // public double[] colWeights
+ //
+ GridBagLayout lm = new GridBagLayout();
+
+ if (st.hasMoreTokens()) {
+ try {
+ String fieldname = st.nextToken();
+ Field field = GridBagLayout.class.getField( fieldname );
+ if (field != null) {
+ Class fieldtype = field.getType();
+
+ if (int[].class.equals( fieldtype )) {
+ field.set( lm, Util.ia( st ) );
+ } else if (double[].class.equals( fieldtype )) {
+ field.set( lm, Util.da( st ) );
+ }
+
+ }
+ } catch (NoSuchFieldException e) {
+ if (SwingEngine.DEBUG_MODE)
+ System.err.println( e.getMessage() );
+ } catch (SecurityException e) {
+ if (SwingEngine.DEBUG_MODE)
+ System.err.println( e.getMessage() );
+ } catch (IllegalArgumentException e) {
+ if (SwingEngine.DEBUG_MODE)
+ System.err.println( e.getMessage() );
+ } catch (IllegalAccessException e) {
+ if (SwingEngine.DEBUG_MODE)
+ System.err.println( e.getMessage() );
+ }
+ }
+ return lm;
+ }
+
+ /**
+ * Creates a GridBagLayout instance.
+ *
+ * Attributes:
+ *
+ * columnWidths (optional): The minimum column widths.
+ * rowHeights (optional): The minimum row heights.
+ * columnWeights (optional): The column weights.
+ * rowWeights (optional): The row weights.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="GridBagLayout"/>
+ * <layout type="GridBagLayout" columnWidths="5, 5, 10, 33" rowWeights="0,0,1.0,0"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ String columnWidths = Attribute.getAttributeValue(element,"columnWidths");
+ String rowHeights = Attribute.getAttributeValue(element,"rowHeights");
+ String columnWeights = Attribute.getAttributeValue(element,"columnWeights");
+ String rowWeights = Attribute.getAttributeValue(element,"rowWeights");
+
+ GridBagLayout lm = new GridBagLayout();
+
+ if (columnWidths != null)
+ lm.columnWidths = Util.ia(new StringTokenizer(columnWidths,","));
+ if (rowHeights != null)
+ lm.rowHeights = Util.ia(new StringTokenizer(rowHeights,","));
+ if (columnWeights != null)
+ lm.columnWeights = Util.da(new StringTokenizer(columnWeights,","));
+ if (rowWeights != null)
+ lm.rowWeights = Util.da(new StringTokenizer(rowWeights,","));
+
+ return lm;
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ return null;
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java b/swixml-core/src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java
similarity index 97%
rename from src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java
rename to swixml-core/src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java
index 7f880bc..7652df6 100644
--- a/src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java
+++ b/swixml-core/src/main/java/org/swixml/layoutconverters/GridLayoutConverter.java
@@ -1,174 +1,174 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml.layoutconverters;
-
-import java.awt.GridLayout;
-import java.awt.LayoutManager;
-import java.util.StringTokenizer;
-
-import org.swixml.Attribute;
-import org.swixml.LayoutConverter;
-import org.swixml.converters.Util;
-import org.w3c.dom.Element;
-
-/**
- * A layout converter for java.awt.GridLayout.
- *
- * Examples:
- *
- * <panel layout="GridLayout">
- * <panel ... />
- * <panel ... />
- * </panel>
- *
- *
- *
- * <panel layout="GridLayout(2,4)">
- * ...
- * </panel>
- *
- *
- *
- * <panel layout="GridLayout(2,4,10,20)">
- * ...
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="GridLayout" rows="2" columns="4"/>
- * ...
- * </panel>
- *
- *
- *
- * <panel>
- * <layout type="GridLayout" rows="2" columns="4" hgap="10" vgap="20"/>
- * ...
- * </panel>
- *
- *
- * @author Karl Tauber
- * @author Wolf Paulus
- */
-public class GridLayoutConverter implements LayoutConverter {
-
- /**
- * Returns "gridlayout".
- */
- public String getID() {
- return "gridlayout";
- }
-
- /**
- * Creates a GridLayout instance.
- *
- * Examples for Valid XML attribute notations:
- *
- * layout="GridLayout"
- * layout="GridLayout(int rows, int cols)"
- * layout="GridLayout(int rows, int cols, int hgap, int vgap)"
- *
- */
- public LayoutManager convertLayoutAttribute( final Attribute attr ) {
- StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
- st.nextToken(); // skip layout type
-
- int[] para = Util.ia( st );
- if (4 <= para.length)
- return new GridLayout( para[ 0 ], para[ 1 ], para[ 2 ], para[ 3 ] );
- else if (2 <= para.length)
- return new GridLayout( para[ 0 ], para[ 1 ] );
- else
- return new GridLayout();
- }
-
- /**
- * Creates a GridLayout instance.
- *
- * Attributes:
- *
- * rows (optional): The number of rows.
- * columns (optional): The number of columns.
- * hgap (optional): The horizontal gap.
- * vgap (optional): The vertical gap.
- *
- *
- * Examples for Valid XML element notations:
- *
- * <layout type="GridLayout"/>
- * <layout type="GridLayout" rows="4" columns="5"/>
- * <layout type="GridLayout" rows="2" columns="4" hgap="10" vgap="20"/>
- *
- */
- public LayoutManager convertLayoutElement( final Element element ) {
- int rows = Util.getInteger(element, "rows", 1);
- int cols = Util.getInteger(element, "columns", 0);
- int hgap = Util.getInteger(element, "hgap", 0);
- int vgap = Util.getInteger(element, "vgap", 0);
- return new GridLayout(rows, cols, hgap, vgap);
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsAttribute( final Attribute attr ) {
- return null;
- }
-
- /**
- * Returns always null.
- */
- public Object convertConstraintsElement( final Element element ) {
- return null;
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml.layoutconverters;
+
+import java.awt.GridLayout;
+import java.awt.LayoutManager;
+import java.util.StringTokenizer;
+
+import org.swixml.Attribute;
+import org.swixml.LayoutConverter;
+import org.swixml.converters.Util;
+import org.w3c.dom.Element;
+
+/**
+ * A layout converter for java.awt.GridLayout.
+ *
+ * Examples:
+ *
+ * <panel layout="GridLayout">
+ * <panel ... />
+ * <panel ... />
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="GridLayout(2,4)">
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel layout="GridLayout(2,4,10,20)">
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="GridLayout" rows="2" columns="4"/>
+ * ...
+ * </panel>
+ *
+ *
+ *
+ * <panel>
+ * <layout type="GridLayout" rows="2" columns="4" hgap="10" vgap="20"/>
+ * ...
+ * </panel>
+ *
+ *
+ * @author Karl Tauber
+ * @author Wolf Paulus
+ */
+public class GridLayoutConverter implements LayoutConverter {
+
+ /**
+ * Returns "gridlayout".
+ */
+ public String getID() {
+ return "gridlayout";
+ }
+
+ /**
+ * Creates a GridLayout instance.
+ *
+ * Examples for Valid XML attribute notations:
+ *
+ * layout="GridLayout"
+ * layout="GridLayout(int rows, int cols)"
+ * layout="GridLayout(int rows, int cols, int hgap, int vgap)"
+ *
+ */
+ public LayoutManager convertLayoutAttribute( final Attribute attr ) {
+ StringTokenizer st = new StringTokenizer( attr.getValue(), "(,)" );
+ st.nextToken(); // skip layout type
+
+ int[] para = Util.ia( st );
+ if (4 <= para.length)
+ return new GridLayout( para[ 0 ], para[ 1 ], para[ 2 ], para[ 3 ] );
+ else if (2 <= para.length)
+ return new GridLayout( para[ 0 ], para[ 1 ] );
+ else
+ return new GridLayout();
+ }
+
+ /**
+ * Creates a GridLayout instance.
+ *
+ * Attributes:
+ *
+ * rows (optional): The number of rows.
+ * columns (optional): The number of columns.
+ * hgap (optional): The horizontal gap.
+ * vgap (optional): The vertical gap.
+ *
+ *
+ * Examples for Valid XML element notations:
+ *
+ * <layout type="GridLayout"/>
+ * <layout type="GridLayout" rows="4" columns="5"/>
+ * <layout type="GridLayout" rows="2" columns="4" hgap="10" vgap="20"/>
+ *
+ */
+ public LayoutManager convertLayoutElement( final Element element ) {
+ int rows = Util.getInteger(element, "rows", 1);
+ int cols = Util.getInteger(element, "columns", 0);
+ int hgap = Util.getInteger(element, "hgap", 0);
+ int vgap = Util.getInteger(element, "vgap", 0);
+ return new GridLayout(rows, cols, hgap, vgap);
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsAttribute( final Attribute attr ) {
+ return null;
+ }
+
+ /**
+ * Returns always null.
+ */
+ public Object convertConstraintsElement( final Element element ) {
+ return null;
+ }
+}
diff --git a/swixml-core/src/test/java/org/.gitignore b/swixml-core/src/test/java/org/.gitignore
new file mode 100644
index 0000000..fdb381f
--- /dev/null
+++ b/swixml-core/src/test/java/org/.gitignore
@@ -0,0 +1 @@
+/*.DS_Store
diff --git a/swixml-core/src/test/java/org/swixml/.gitignore b/swixml-core/src/test/java/org/swixml/.gitignore
new file mode 100644
index 0000000..fdb381f
--- /dev/null
+++ b/swixml-core/src/test/java/org/swixml/.gitignore
@@ -0,0 +1 @@
+/*.DS_Store
diff --git a/src/test/java/org/swixml/ActionGeneratorTest.java b/swixml-core/src/test/java/org/swixml/ActionGeneratorTest.java
similarity index 96%
rename from src/test/java/org/swixml/ActionGeneratorTest.java
rename to swixml-core/src/test/java/org/swixml/ActionGeneratorTest.java
index 9c8a0f5..a9023d4 100644
--- a/src/test/java/org/swixml/ActionGeneratorTest.java
+++ b/swixml-core/src/test/java/org/swixml/ActionGeneratorTest.java
@@ -1,70 +1,70 @@
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-
-
-public class ActionGeneratorTest extends TestCase {
-
- public static final String DESCRIPTOR = "xml/action.xml";
- private Container container;
- private JButton btn1, btn2;
- private int counter;
-
- public Action submitAction = new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- ActionGeneratorTest.this.submit();
- }
- };
-
- public ActionGeneratorTest() {
- super("Test auto generation of Action wrappers");
- }
-
- public ActionGeneratorTest(String s) {
- super(s);
- }
-
- public void submit() {
- counter++;
- }
-
- /**
- * Renders the test GUI into the container field.
- * Note: Like with every testcase, the setup method is going to be performed before
- * the execution of every test..() method.
- *
- * @throws Exception
- */
- public void setUp() throws Exception {
- SwingEngine se = new SwingEngine(this);
- container = se.render(DESCRIPTOR);
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- container.removeAll();
- container = null;
- }
-
- /**
- * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
- */
- public void testMapping() {
- TestCase.assertNotNull("JButton should have been mapped to private fields.", btn1);
- TestCase.assertNotNull("JButton should have been mapped to private fields.", btn2);
- TestCase.assertNotNull("Action should have been mapped to the JButton.", btn1.getAction());
- TestCase.assertNotNull("Action should have been generated and mapped to the JButton.", btn2.getAction());
-
- int i = counter;
- btn1.getAction().actionPerformed(null);
- TestCase.assertEquals("Action should have been called and exec. correnctly", ++i, counter);
- btn2.getAction().actionPerformed(null);
- TestCase.assertEquals("Action should have been generated and wrap a client method", ++i, counter);
- }
-}
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+
+
+public class ActionGeneratorTest extends TestCase {
+
+ public static final String DESCRIPTOR = "xml/action.xml";
+ private Container container;
+ private JButton btn1, btn2;
+ private int counter;
+
+ public Action submitAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ ActionGeneratorTest.this.submit();
+ }
+ };
+
+ public ActionGeneratorTest() {
+ super("Test auto generation of Action wrappers");
+ }
+
+ public ActionGeneratorTest(String s) {
+ super(s);
+ }
+
+ public void submit() {
+ counter++;
+ }
+
+ /**
+ * Renders the test GUI into the container field.
+ * Note: Like with every testcase, the setup method is going to be performed before
+ * the execution of every test..() method.
+ *
+ * @throws Exception
+ */
+ public void setUp() throws Exception {
+ SwingEngine se = new SwingEngine(this);
+ container = se.render(DESCRIPTOR);
+ }
+
+ /**
+ * Clears the container
+ */
+ public void teardown() {
+ container.removeAll();
+ container = null;
+ }
+
+ /**
+ * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
+ */
+ public void testMapping() {
+ TestCase.assertNotNull("JButton should have been mapped to private fields.", btn1);
+ TestCase.assertNotNull("JButton should have been mapped to private fields.", btn2);
+ TestCase.assertNotNull("Action should have been mapped to the JButton.", btn1.getAction());
+ TestCase.assertNotNull("Action should have been generated and mapped to the JButton.", btn2.getAction());
+
+ int i = counter;
+ btn1.getAction().actionPerformed(null);
+ TestCase.assertEquals("Action should have been called and exec. correnctly", ++i, counter);
+ btn2.getAction().actionPerformed(null);
+ TestCase.assertEquals("Action should have been generated and wrap a client method", ++i, counter);
+ }
+}
diff --git a/src/test/java/org/swixml/ButtonGroupTest.java b/swixml-core/src/test/java/org/swixml/ButtonGroupTest.java
similarity index 97%
rename from src/test/java/org/swixml/ButtonGroupTest.java
rename to swixml-core/src/test/java/org/swixml/ButtonGroupTest.java
index 0ffb455..0debfad 100755
--- a/src/test/java/org/swixml/ButtonGroupTest.java
+++ b/swixml-core/src/test/java/org/swixml/ButtonGroupTest.java
@@ -1,131 +1,131 @@
-/*--
- $Id: ButtonGroupTest.java,v 1.2 2005/06/01 00:04:36 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.Enumeration;
-/**
- * The somewhat odd ButtonGroup class doesn't really fit into the way Swixml deals with
- * objects it has instatiated. It therefore deserves its very own test class.
- */
-public class ButtonGroupTest extends TestCase {
-
- public static final String DESCRIPTOR = "xml/mappings.xml";
- private Container container;
- private SwingEngine se;
-
- private JRadioButton am, fm;
- private ButtonGroup radio;
-
- public ButtonGroupTest() {
- super("Test the Mapping and behavior of a ButtonGroup.");
- }
-
- /**
- * Renders the test GUI into the container field.
- * Note: Like with every testcase, the setup method is going to be performed before
- * the execution of every test..() method.
- *
- * @throws Exception
- */
- public void setUp() throws Exception {
- se = new SwingEngine(this);
- container = se.render(MappingTest.DESCRIPTOR);
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- se = null;
- container.removeAll();
- container = null;
- }
-
- /**
- * Tests if the Fields were correctly initialized/mapped by the SwingEngine.
- */
- public void testMapping() {
- TestCase.assertTrue("IDMap's EntrySet needs to contain the ButtonGroup's ID", se.getIdMap().containsKey("radio"));
- TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", radio);
- TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", am);
- TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", fm);
- }
-
- /**
- * Test that one and only one of the buttons in the group can be selected
- */
- public void testXOR() {
- am.setSelected(true);
- TestCase.assertTrue(am.isSelected());
- TestCase.assertFalse("Only one RadioButton in the group should be flagged selected.", fm.isSelected());
- fm.setSelected(true);
- TestCase.assertFalse("Only one RadioButton in the group should be flagged selected.", am.isSelected());
- TestCase.assertTrue(fm.isSelected());
- }
-
- /**
- * Test that the buttons are actually being added into the button group
- */
- public void testStructure() {
- Enumeration e = radio.getElements();
- while (e.hasMoreElements()) {
- Object obj = e.nextElement();
- TestCase.assertTrue (am.equals(obj) ^ fm.equals(obj));
- }
- TestCase.assertEquals("There should be two buttons in this group",radio.getButtonCount(),2);
- }
-}
+/*--
+ $Id: ButtonGroupTest.java,v 1.2 2005/06/01 00:04:36 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Enumeration;
+/**
+ * The somewhat odd ButtonGroup class doesn't really fit into the way Swixml deals with
+ * objects it has instatiated. It therefore deserves its very own test class.
+ */
+public class ButtonGroupTest extends TestCase {
+
+ public static final String DESCRIPTOR = "xml/mappings.xml";
+ private Container container;
+ private SwingEngine se;
+
+ private JRadioButton am, fm;
+ private ButtonGroup radio;
+
+ public ButtonGroupTest() {
+ super("Test the Mapping and behavior of a ButtonGroup.");
+ }
+
+ /**
+ * Renders the test GUI into the container field.
+ * Note: Like with every testcase, the setup method is going to be performed before
+ * the execution of every test..() method.
+ *
+ * @throws Exception
+ */
+ public void setUp() throws Exception {
+ se = new SwingEngine(this);
+ container = se.render(MappingTest.DESCRIPTOR);
+ }
+
+ /**
+ * Clears the container
+ */
+ public void teardown() {
+ se = null;
+ container.removeAll();
+ container = null;
+ }
+
+ /**
+ * Tests if the Fields were correctly initialized/mapped by the SwingEngine.
+ */
+ public void testMapping() {
+ TestCase.assertTrue("IDMap's EntrySet needs to contain the ButtonGroup's ID", se.getIdMap().containsKey("radio"));
+ TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", radio);
+ TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", am);
+ TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", fm);
+ }
+
+ /**
+ * Test that one and only one of the buttons in the group can be selected
+ */
+ public void testXOR() {
+ am.setSelected(true);
+ TestCase.assertTrue(am.isSelected());
+ TestCase.assertFalse("Only one RadioButton in the group should be flagged selected.", fm.isSelected());
+ fm.setSelected(true);
+ TestCase.assertFalse("Only one RadioButton in the group should be flagged selected.", am.isSelected());
+ TestCase.assertTrue(fm.isSelected());
+ }
+
+ /**
+ * Test that the buttons are actually being added into the button group
+ */
+ public void testStructure() {
+ Enumeration e = radio.getElements();
+ while (e.hasMoreElements()) {
+ Object obj = e.nextElement();
+ TestCase.assertTrue (am.equals(obj) ^ fm.equals(obj));
+ }
+ TestCase.assertEquals("There should be two buttons in this group",radio.getButtonCount(),2);
+ }
+}
diff --git a/src/test/java/org/swixml/ConverterTest.java b/swixml-core/src/test/java/org/swixml/ConverterTest.java
similarity index 97%
rename from src/test/java/org/swixml/ConverterTest.java
rename to swixml-core/src/test/java/org/swixml/ConverterTest.java
index 2637036..8739ec7 100644
--- a/src/test/java/org/swixml/ConverterTest.java
+++ b/swixml-core/src/test/java/org/swixml/ConverterTest.java
@@ -1,118 +1,118 @@
-/*--
- $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import javax.swing.border.Border;
-import javax.swing.border.TitledBorder;
-import java.awt.*;
-
-/**
- * Test class running converter related tests.
- *
- * @author Wolf Paulus
- */
-public class ConverterTest extends TestCase {
-
- private static final String DESCRIPTOR = "xml/converter.xml";
- private Container container;
- private JPanel pnl; // auto bound through Swixml
-
-
- public ConverterTest() {
- super("Test converter related things");
- }
-
- public ConverterTest(String s) {
- super(s);
- }
-
- /**
- * Renders the test GUI into the container field.
- * Note: Like with every testcase, the setup method is going to be performed before
- * the execution of every test..() method.
- *
- * @throws Exception
- */
- public void setUp() throws Exception {
- SwingEngine.DEBUG_MODE = true;
- SwingEngine se = new SwingEngine(this);
- container = se.render(ConverterTest.DESCRIPTOR);
-
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- container.removeAll();
- container = null;
- }
-
- /**
- * Tests the BorderConverter
- */
- public void testBorderConverter() {
- TestCase.assertNotNull("JPanel pnl auto bound through Swixml", pnl);
- Border border = pnl.getBorder();
- TestCase.assertNotNull("panel elem. has a border attribute def. in the XML Descriptor", border);
- TestCase.assertTrue("XML Descriptor declared a TitledBorder for this Panel", border.getClass().isAssignableFrom(TitledBorder.class));
- TitledBorder tb = (TitledBorder) border;
- TestCase.assertEquals("Title like set in XML", "myTitle", tb.getTitle());
- TestCase.assertEquals("Title Font like set in XML", Font.decode("VERDANA-BOLD-18"), tb.getTitleFont());
- TestCase.assertEquals("Title Justification like set in XML", TitledBorder.CENTER, tb.getTitleJustification());
- TestCase.assertEquals("Title Position like set in XML", TitledBorder.BELOW_BOTTOM, tb.getTitlePosition());
- }
-}
+/*--
+ $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+import java.awt.*;
+
+/**
+ * Test class running converter related tests.
+ *
+ * @author Wolf Paulus
+ */
+public class ConverterTest extends TestCase {
+
+ private static final String DESCRIPTOR = "xml/converter.xml";
+ private Container container;
+ private JPanel pnl; // auto bound through Swixml
+
+
+ public ConverterTest() {
+ super("Test converter related things");
+ }
+
+ public ConverterTest(String s) {
+ super(s);
+ }
+
+ /**
+ * Renders the test GUI into the container field.
+ * Note: Like with every testcase, the setup method is going to be performed before
+ * the execution of every test..() method.
+ *
+ * @throws Exception
+ */
+ public void setUp() throws Exception {
+ SwingEngine.DEBUG_MODE = true;
+ SwingEngine se = new SwingEngine(this);
+ container = se.render(ConverterTest.DESCRIPTOR);
+
+ }
+
+ /**
+ * Clears the container
+ */
+ public void teardown() {
+ container.removeAll();
+ container = null;
+ }
+
+ /**
+ * Tests the BorderConverter
+ */
+ public void testBorderConverter() {
+ TestCase.assertNotNull("JPanel pnl auto bound through Swixml", pnl);
+ Border border = pnl.getBorder();
+ TestCase.assertNotNull("panel elem. has a border attribute def. in the XML Descriptor", border);
+ TestCase.assertTrue("XML Descriptor declared a TitledBorder for this Panel", border.getClass().isAssignableFrom(TitledBorder.class));
+ TitledBorder tb = (TitledBorder) border;
+ TestCase.assertEquals("Title like set in XML", "myTitle", tb.getTitle());
+ TestCase.assertEquals("Title Font like set in XML", Font.decode("VERDANA-BOLD-18"), tb.getTitleFont());
+ TestCase.assertEquals("Title Justification like set in XML", TitledBorder.CENTER, tb.getTitleJustification());
+ TestCase.assertEquals("Title Position like set in XML", TitledBorder.BELOW_BOTTOM, tb.getTitlePosition());
+ }
+}
diff --git a/src/test/java/org/swixml/ExtMappingTest.java b/swixml-core/src/test/java/org/swixml/ExtMappingTest.java
similarity index 97%
rename from src/test/java/org/swixml/ExtMappingTest.java
rename to swixml-core/src/test/java/org/swixml/ExtMappingTest.java
index 822b20f..d814d0d 100755
--- a/src/test/java/org/swixml/ExtMappingTest.java
+++ b/swixml-core/src/test/java/org/swixml/ExtMappingTest.java
@@ -1,95 +1,95 @@
-/*--
- $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-
-/**
- * Automatic mapping may have to deal with class hierarchies as well.
- * This Test class extends the MappingTest, which already defines some members that need to be mapped.
- * @author Wolf Paulus
- */
-public class ExtMappingTest extends MappingTest {
-
- public JButton b1;
- private JButton b2;
- private JButton b5;
-
- public ExtMappingTest() {
- }
-
- public ExtMappingTest(String s) {
- super(s);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- }
-
- public void teardown() {
- super.teardown();
- }
-
-
- /**
- * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
- */
- public void testMappingPublicFields() {
- TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", b1);
- TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", super.b1);
- TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b2);
- TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b5);
- }
-}
+/*--
+ $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+
+/**
+ * Automatic mapping may have to deal with class hierarchies as well.
+ * This Test class extends the MappingTest, which already defines some members that need to be mapped.
+ * @author Wolf Paulus
+ */
+public class ExtMappingTest extends MappingTest {
+
+ public JButton b1;
+ private JButton b2;
+ private JButton b5;
+
+ public ExtMappingTest() {
+ }
+
+ public ExtMappingTest(String s) {
+ super(s);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void teardown() {
+ super.teardown();
+ }
+
+
+ /**
+ * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
+ */
+ public void testMappingPublicFields() {
+ TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", b1);
+ TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", super.b1);
+ TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b2);
+ TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b5);
+ }
+}
diff --git a/src/test/java/org/swixml/GlobalActions.java b/swixml-core/src/test/java/org/swixml/GlobalActions.java
similarity index 97%
rename from src/test/java/org/swixml/GlobalActions.java
rename to swixml-core/src/test/java/org/swixml/GlobalActions.java
index 192445c..1554297 100644
--- a/src/test/java/org/swixml/GlobalActions.java
+++ b/swixml-core/src/test/java/org/swixml/GlobalActions.java
@@ -1,76 +1,76 @@
-/*--
- $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-
-/**
- * Interface containg action implementation for broader use, e.g. in multiple frames, dialog.
- * @author Wolf Paulus
- */
-public interface GlobalActions {
- Action quitAction = new AbstractAction() {
- public void actionPerformed(ActionEvent arg0) {
- // Quit the program...
- System.exit(0);
- }
- };
-
- Action aboutAction = new AbstractAction() {
- public void actionPerformed(ActionEvent arg0) {
- //show 'About Application' dialog
- JOptionPane.showMessageDialog(null, "Test Case");
- }
- };
-}
+/*--
+ $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * Interface containg action implementation for broader use, e.g. in multiple frames, dialog.
+ * @author Wolf Paulus
+ */
+public interface GlobalActions {
+ Action quitAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent arg0) {
+ // Quit the program...
+ System.exit(0);
+ }
+ };
+
+ Action aboutAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent arg0) {
+ //show 'About Application' dialog
+ JOptionPane.showMessageDialog(null, "Test Case");
+ }
+ };
+}
diff --git a/src/test/java/org/swixml/IdTest.java b/swixml-core/src/test/java/org/swixml/IdTest.java
similarity index 97%
rename from src/test/java/org/swixml/IdTest.java
rename to swixml-core/src/test/java/org/swixml/IdTest.java
index 84db55d..1f198b0 100644
--- a/src/test/java/org/swixml/IdTest.java
+++ b/swixml-core/src/test/java/org/swixml/IdTest.java
@@ -1,113 +1,113 @@
-/*--
- $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-
-/**
- * Test class running id and refid related tests.
- * @author Wolf Paulus
- */
-public class IdTest extends TestCase {
- public static final String DESCRIPTOR = "xml/id.xml";
- private Container container;
- private JPanel pnl1, pnl11, pnl2;
- private JButton btn1, btn2,btn3;
- private boolean b1, b2;
- public Action a1 = new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- b1 = true;
- }
- };
-
- public void m1() {
- b2 = true;
- }
-
-
- public IdTest() throws Exception {
- super("ID Tests");
- SwingEngine.DEBUG_MODE = true;
- container = new SwingEngine(this).render(DESCRIPTOR);
- }
-
- public void testRefId() {
- TestCase.assertNotNull(pnl1);
- TestCase.assertNotNull(pnl11);
- TestCase.assertNotNull(pnl2);
-
- TestCase.assertEquals(Color.red, pnl1.getBackground());
- TestCase.assertEquals(pnl1.getBackground(), pnl2.getBackground());
- TestCase.assertNotSame(pnl1.getBackground(), pnl11.getBackground());
- TestCase.assertEquals(pnl1.getFont(), pnl11.getFont());
- TestCase.assertNotSame(pnl1.getFont(), pnl2.getFont());
-
- TestCase.assertNotNull(btn1.getAction());
- TestCase.assertNotNull(btn2.getAction());
- TestCase.assertNotNull(btn3.getAction());
-
- TestCase.assertEquals(btn1.getAction(), btn3.getAction());
- TestCase.assertNotSame(btn1.getAction(), btn2.getAction());
- TestCase.assertFalse(b2);
- btn2.doClick();
- TestCase.assertTrue(b2);
- TestCase.assertFalse(b1);
- btn3.doClick();
- TestCase.assertTrue(b1);
- }
-}
-
+/*--
+ $Id: ExtMappingTest.java,v 1.1 2005/06/01 00:02:43 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * Test class running id and refid related tests.
+ * @author Wolf Paulus
+ */
+public class IdTest extends TestCase {
+ public static final String DESCRIPTOR = "xml/id.xml";
+ private Container container;
+ private JPanel pnl1, pnl11, pnl2;
+ private JButton btn1, btn2,btn3;
+ private boolean b1, b2;
+ public Action a1 = new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ b1 = true;
+ }
+ };
+
+ public void m1() {
+ b2 = true;
+ }
+
+
+ public IdTest() throws Exception {
+ super("ID Tests");
+ SwingEngine.DEBUG_MODE = true;
+ container = new SwingEngine(this).render(DESCRIPTOR);
+ }
+
+ public void testRefId() {
+ TestCase.assertNotNull(pnl1);
+ TestCase.assertNotNull(pnl11);
+ TestCase.assertNotNull(pnl2);
+
+ TestCase.assertEquals(Color.red, pnl1.getBackground());
+ TestCase.assertEquals(pnl1.getBackground(), pnl2.getBackground());
+ TestCase.assertNotSame(pnl1.getBackground(), pnl11.getBackground());
+ TestCase.assertEquals(pnl1.getFont(), pnl11.getFont());
+ TestCase.assertNotSame(pnl1.getFont(), pnl2.getFont());
+
+ TestCase.assertNotNull(btn1.getAction());
+ TestCase.assertNotNull(btn2.getAction());
+ TestCase.assertNotNull(btn3.getAction());
+
+ TestCase.assertEquals(btn1.getAction(), btn3.getAction());
+ TestCase.assertNotSame(btn1.getAction(), btn2.getAction());
+ TestCase.assertFalse(b2);
+ btn2.doClick();
+ TestCase.assertTrue(b2);
+ TestCase.assertFalse(b1);
+ btn3.doClick();
+ TestCase.assertTrue(b1);
+ }
+}
+
diff --git a/src/test/java/org/swixml/IncludeTest.java b/swixml-core/src/test/java/org/swixml/IncludeTest.java
similarity index 100%
rename from src/test/java/org/swixml/IncludeTest.java
rename to swixml-core/src/test/java/org/swixml/IncludeTest.java
diff --git a/src/test/java/org/swixml/LayoutTest.java b/swixml-core/src/test/java/org/swixml/LayoutTest.java
similarity index 97%
rename from src/test/java/org/swixml/LayoutTest.java
rename to swixml-core/src/test/java/org/swixml/LayoutTest.java
index f782aad..b65268c 100644
--- a/src/test/java/org/swixml/LayoutTest.java
+++ b/swixml-core/src/test/java/org/swixml/LayoutTest.java
@@ -1,437 +1,437 @@
-/*--
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-
-package org.swixml;
-
-import java.awt.*;
-import java.lang.reflect.Field;
-import javax.swing.JPanel;
-
-import com.jgoodies.forms.layout.*;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
-/**
- * Test class running layout related tests.
- *
- * @author Karl Tauber
- */
-public class LayoutTest extends TestCase {
-
- private static final String DESCRIPTOR = "xml/layout.xml";
- private Container container;
-
- // auto bound through Swixml
- private JPanel borderPanel1;
- private JPanel borderPanel2;
- private JPanel borderPanel3;
- private JPanel borderPanel10;
- private JPanel cardPanel1;
- private JPanel cardPanel2;
- private JPanel cardPanel3;
- private JPanel cardPanel10;
- private JPanel flowPanel1;
- private JPanel flowPanel2;
- private JPanel flowPanel3;
- private JPanel flowPanel4;
- private JPanel gridPanel1;
- private JPanel gridPanel2;
- private JPanel gridPanel3;
- private JPanel gridPanel4;
- private JPanel gridPanel5;
- private JPanel gridBagPanel1;
- private JPanel gridBagPanel2;
- private JPanel gridBagPanel3;
- private JPanel gridBagPanel4;
- private JPanel gridBagPanel5;
- private JPanel gridBagPanel6;
- private JPanel gridBagPanel10;
- private JPanel formPanel1;
- private JPanel formPanel2;
-
-
- public LayoutTest() {
- super("Test layout related things");
- }
-
- /**
- * Renders the test GUI into the container field.
- * Note: Like with every testcase, the setup method is going to be performed before
- * the execution of every test..() method.
- *
- * @throws Exception
- */
- public void setUp() throws Exception {
- SwingEngine.DEBUG_MODE = true;
- SwingEngine se = new SwingEngine(this);
- container = se.render(DESCRIPTOR);
-
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- container.removeAll();
- container = null;
- }
-
- /**
- * Tests the BorderLayoutConverter
- */
- public void testBorderLayout() {
- TestCase.assertNotNull("JPanel borderPanel1 auto bound through Swixml", borderPanel1);
- TestCase.assertNotNull("JPanel borderPanel2 auto bound through Swixml", borderPanel2);
- TestCase.assertNotNull("JPanel borderPanel3 auto bound through Swixml", borderPanel3);
- TestCase.assertNotNull("JPanel borderPanel10 auto bound through Swixml", borderPanel10);
-
- checkBorderLayout("borderPanel1", borderPanel1, 0, 0);
- checkBorderLayout("borderPanel2", borderPanel2, 1, 2);
- checkBorderLayout("borderPanel3", borderPanel3, 1, 2);
-
- // check constraints
- BorderLayout borderLayout10 = (BorderLayout) borderPanel10.getLayout();
- assertEquals(BorderLayout.NORTH, borderLayout10.getConstraints(borderPanel10.getComponent(0)));
- assertEquals(BorderLayout.EAST, borderLayout10.getConstraints(borderPanel10.getComponent(1)));
- assertEquals(BorderLayout.SOUTH, borderLayout10.getConstraints(borderPanel10.getComponent(2)));
- assertEquals(BorderLayout.WEST, borderLayout10.getConstraints(borderPanel10.getComponent(3)));
- assertEquals(BorderLayout.CENTER, borderLayout10.getConstraints(borderPanel10.getComponent(4)));
- }
-
- private static void checkBorderLayout(String message, JPanel borderPanel, int hgap, int vgap) {
- LayoutManager layout = borderPanel.getLayout();
- assertTrue(message, layout instanceof BorderLayout);
-
- BorderLayout borderLayout = (BorderLayout) layout;
- assertEquals(message + ": hgap ", hgap, borderLayout.getHgap());
- assertEquals(message + ": vgap ", vgap, borderLayout.getVgap());
- }
-
- /**
- * Tests the CardLayoutConverter
- */
- public void testCardLayout() {
- TestCase.assertNotNull("JPanel cardPanel1 auto bound through Swixml", cardPanel1);
- TestCase.assertNotNull("JPanel cardPanel2 auto bound through Swixml", cardPanel2);
- TestCase.assertNotNull("JPanel cardPanel3 auto bound through Swixml", cardPanel3);
- TestCase.assertNotNull("JPanel cardPanel10 auto bound through Swixml", cardPanel10);
-
- checkCardLayout("cardPanel1", cardPanel1, 0, 0);
- checkCardLayout("cardPanel2", cardPanel2, 1, 2);
- checkCardLayout("cardPanel3", cardPanel3, 1, 2);
-
- // check card names
- CardLayout cardLayout10 = (CardLayout) cardPanel10.getLayout();
- try {
- // Because CardLayout has no API to access card names,
- // use reflection to access private field.
- Field currentCardField = cardLayout10.getClass().getDeclaredField("currentCard");
- currentCardField.setAccessible(true);
-
- cardLayout10.show(cardPanel10, "card2");
- assertEquals(1, currentCardField.getInt(cardLayout10));
-
- cardLayout10.show(cardPanel10, "card1");
- assertEquals(0, currentCardField.getInt(cardLayout10));
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new AssertionFailedError(ex.getMessage());
- }
- }
-
- private static void checkCardLayout(String message, JPanel cardPanel, int hgap, int vgap) {
- LayoutManager layout = cardPanel.getLayout();
- assertTrue(message, layout instanceof CardLayout);
-
- CardLayout cardLayout = (CardLayout) layout;
- assertEquals(message + ": hgap ", hgap, cardLayout.getHgap());
- assertEquals(message + ": vgap ", vgap, cardLayout.getVgap());
- }
-
- /**
- * Tests the FlowLayoutConverter
- */
- public void testFlowLayout() {
- TestCase.assertNotNull("JPanel flowPanel1 auto bound through Swixml", flowPanel1);
- TestCase.assertNotNull("JPanel flowPanel2 auto bound through Swixml", flowPanel2);
- TestCase.assertNotNull("JPanel flowPanel3 auto bound through Swixml", flowPanel3);
- TestCase.assertNotNull("JPanel flowPanel4 auto bound through Swixml", flowPanel4);
-
- checkFlowLayout("flowPanel1", flowPanel1, FlowLayout.CENTER, 5, 5);
- checkFlowLayout("flowPanel2", flowPanel2, FlowLayout.RIGHT, 5, 5);
- checkFlowLayout("flowPanel3", flowPanel3, FlowLayout.LEFT, 1, 2);
- checkFlowLayout("flowPanel4", flowPanel4, FlowLayout.LEFT, 1, 2);
- }
-
- private static void checkFlowLayout(String message, JPanel flowPanel, int align, int hgap, int vgap) {
- LayoutManager layout = flowPanel.getLayout();
- assertTrue(message, layout instanceof FlowLayout);
-
- FlowLayout flowLayout = (FlowLayout) layout;
- assertEquals(message + ": alignment ", align, flowLayout.getAlignment());
- assertEquals(message + ": hgap ", hgap, flowLayout.getHgap());
- assertEquals(message + ": vgap ", vgap, flowLayout.getVgap());
- }
-
- /**
- * Tests the GridLayoutConverter
- */
- public void testGridLayout() {
- TestCase.assertNotNull("JPanel gridPanel1 auto bound through Swixml", gridPanel1);
- TestCase.assertNotNull("JPanel gridPanel2 auto bound through Swixml", gridPanel2);
- TestCase.assertNotNull("JPanel gridPanel3 auto bound through Swixml", gridPanel3);
- TestCase.assertNotNull("JPanel gridPanel4 auto bound through Swixml", gridPanel4);
- TestCase.assertNotNull("JPanel gridPanel5 auto bound through Swixml", gridPanel5);
-
- checkGridLayout("gridPanel1", gridPanel1, 1, 0, 0, 0);
- checkGridLayout("gridPanel2", gridPanel2, 2, 3, 0, 0);
- checkGridLayout("gridPanel3", gridPanel3, 4, 5, 6, 7);
- checkGridLayout("gridPanel4", gridPanel4, 2, 3, 0, 0);
- checkGridLayout("gridPanel5", gridPanel5, 4, 5, 6, 7);
- }
-
- private static void checkGridLayout(String message, JPanel gridPanel, int rows, int cols, int hgap, int vgap) {
- LayoutManager layout = gridPanel.getLayout();
- assertTrue(message, layout instanceof GridLayout);
-
- GridLayout gridLayout = (GridLayout) layout;
- assertEquals(message + ": rows ", rows, gridLayout.getRows());
- assertEquals(message + ": cols ", cols, gridLayout.getColumns());
- assertEquals(message + ": hgap ", hgap, gridLayout.getHgap());
- assertEquals(message + ": vgap ", vgap, gridLayout.getVgap());
- }
-
- /**
- * Tests the GridBagLayoutConverter
- */
- public void testGridBagLayout() {
- TestCase.assertNotNull("JPanel gridBagPanel1 auto bound through Swixml", gridBagPanel1);
- TestCase.assertNotNull("JPanel gridBagPanel2 auto bound through Swixml", gridBagPanel2);
- TestCase.assertNotNull("JPanel gridBagPanel3 auto bound through Swixml", gridBagPanel3);
- TestCase.assertNotNull("JPanel gridBagPanel4 auto bound through Swixml", gridBagPanel4);
- TestCase.assertNotNull("JPanel gridBagPanel5 auto bound through Swixml", gridBagPanel5);
- TestCase.assertNotNull("JPanel gridBagPanel6 auto bound through Swixml", gridBagPanel6);
- TestCase.assertNotNull("JPanel gridBagPanel10 auto bound through Swixml", gridBagPanel10);
-
- checkGridBagLayout("gridBagPanel1", gridBagPanel1, null, null, null, null);
- checkGridBagLayout("gridBagPanel2", gridBagPanel2, new int[] {1, 2, 3}, null, null, null);
- checkGridBagLayout("gridBagPanel3", gridBagPanel3, null, new int[] {4, 5, 6}, null, null);
- checkGridBagLayout("gridBagPanel4", gridBagPanel4, null, null, new double[] {0.1, 0.2, 1.0}, null);
- checkGridBagLayout("gridBagPanel5", gridBagPanel5, null, null, null, new double[] {0.3, 0.4});
- checkGridBagLayout("gridBagPanel6", gridBagPanel6, new int[] {1, 2, 3},
- new int[] {4, 5, 6}, new double[] {0.1, 0.2, 1.0}, new double[] {0.3, 0.4});
-
- GridBagLayout gridBagLayout10 = (GridBagLayout) gridBagPanel10.getLayout();
- checkGridBagConstraints("gridBagPanel10 [0]",
- new GridBagConstraints(),
- gridBagLayout10.getConstraints(gridBagPanel10.getComponent(0)));
- checkGridBagConstraints("gridBagPanel10 [1]",
- new GridBagConstraints(1, 2, 3, 4, 0.1, 1.0,
- GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
- new Insets(1,2,3,4), 5, 6),
- gridBagLayout10.getConstraints(gridBagPanel10.getComponent(1)));
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 2;
- gbc.gridy = 4;
- checkGridBagConstraints("gridBagPanel10 [2]",
- gbc,
- gridBagLayout10.getConstraints(gridBagPanel10.getComponent(2)));
- }
-
- private static void checkGridBagLayout(String message, JPanel gridBagPanel,
- int columnWidths[], int rowHeights[], double columnWeights[], double rowWeights[])
- {
- LayoutManager layout = gridBagPanel.getLayout();
- assertTrue(message, layout instanceof GridBagLayout);
-
- GridBagLayout gridBagLayout = (GridBagLayout) layout;
- assertEquals(message + ": columnWidths ", columnWidths, gridBagLayout.columnWidths);
- assertEquals(message + ": rowHeights ", rowHeights, gridBagLayout.rowHeights);
- assertEquals(message + ": columnWeights ", columnWeights, gridBagLayout.columnWeights);
- assertEquals(message + ": rowWeights ", rowWeights, gridBagLayout.rowWeights);
- }
-
- private static void checkGridBagConstraints(String message,
- GridBagConstraints expected, GridBagConstraints actual)
- {
- assertEquals(message + ": gridx ", expected.gridx, actual.gridx);
- assertEquals(message + ": gridy ", expected.gridy, actual.gridy);
- assertEquals(message + ": gridwidth ", expected.gridwidth, actual.gridwidth);
- assertEquals(message + ": gridheight ", expected.gridheight, actual.gridheight);
- assertEquals(message + ": weightx ", expected.weightx, actual.weightx);
- assertEquals(message + ": weighty ", expected.weighty, actual.weighty);
- assertEquals(message + ": anchor ", expected.anchor, actual.anchor);
- assertEquals(message + ": fill ", expected.fill, actual.fill);
- assertEquals(message + ": insets.top ", expected.insets.top, actual.insets.top);
- assertEquals(message + ": insets.left ", expected.insets.left, actual.insets.left);
- assertEquals(message + ": insets.bottom ", expected.insets.bottom, actual.insets.bottom);
- assertEquals(message + ": insets.right ", expected.insets.right, actual.insets.right);
- assertEquals(message + ": ipadx ", expected.ipadx, actual.ipadx);
- assertEquals(message + ": ipady ", expected.ipady, actual.ipady);
- }
-
- public void testFormLayout() {
- TestCase.assertNotNull("JPanel formPanel1 auto bound through Swixml", formPanel1);
- TestCase.assertNotNull("JPanel formPanel2 auto bound through Swixml", formPanel2);
-
- checkFormLayout("formPanel1", formPanel1,
- "p, 3dlu, p, 3dlu, p",
- "p, 3dlu, p, 3dlu, p",
- new int[0][],
- new int[0][],
- "1,3",
- "3,3,3,1");
-
- checkFormLayout("formPanel2", formPanel2,
- "p, p, p, p, p, p, p, p, p, p",
- "p, p, p, p, p, p, p, p, p, p",
- new int[][] {{ 1,3,5,7 }, { 9,2,4 }, { 6,8,10 }},
- new int[][] {{ 6,8,10 }, { 2,4,9 }, { 1,3,5,7 }});
- }
-
- private static void checkFormLayout(String message, JPanel formPanel,
- String encodedColumnSpecs, String encodedRowSpecs,
- int[][] columnGroupIndices, int[][] rowGroupIndices,
- String... expectedConstraints)
- {
- LayoutManager layout = formPanel.getLayout();
- assertTrue(message, layout instanceof FormLayout);
-
- ColumnSpec[] expectedColumnSpecs = ColumnSpec.decodeSpecs(encodedColumnSpecs);
- RowSpec[] expectedRowSpecs = RowSpec.decodeSpecs(encodedRowSpecs);
-
- FormLayout formLayout = (FormLayout) layout;
- int columnCount = formLayout.getColumnCount();
- int rowCount = formLayout.getRowCount();
- int componentCount = formPanel.getComponentCount();
-
- assertEquals(message + ": columnCount ", expectedColumnSpecs.length, columnCount);
- assertEquals(message + ": rowCount ", expectedRowSpecs.length, rowCount);
- assertEquals(message + ": componentCount ", expectedConstraints.length, componentCount);
-
- // check column specs
- for (int i = 0; i < columnCount; i++) {
- ColumnSpec spec = formLayout.getColumnSpec(i + 1);
- assertEquals(message + ": column[" + i + "] ",
- expectedColumnSpecs[i].toString(), spec.toString() );
- }
-
- // check row specs
- for (int i = 0; i < rowCount; i++) {
- RowSpec spec = formLayout.getRowSpec(i + 1);
- assertEquals(message + ": row[" + i + "] ",
- expectedRowSpecs[i].toString(), spec.toString() );
- }
-
- // check column and row groups
- assertEquals(message + ": columnGroups ", columnGroupIndices, formLayout.getColumnGroups());
- assertEquals(message + ": rowGroups ", rowGroupIndices, formLayout.getRowGroups());
-
- // check component constraints
- for (int i = 0; i < componentCount; i++) {
- CellConstraints cc = formLayout.getConstraints(formPanel.getComponent(i));
- assertEquals(message + ": cc[" + i + "] ",
- new CellConstraints(expectedConstraints[i]).toString(), cc.toString() );
- }
- }
-
- /**
- * Asserts that two int[] are equal.
- */
- private static void assertEquals(String message, int[] expected, int[] actual) {
- if (expected == null)
- assertNull(message, actual);
- else
- assertNotNull(message, actual);
-
- if (expected != null) {
- assertEquals(message + ": length ", expected.length, actual.length);
- for (int i = 0; i < expected.length; i++) {
- assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
- }
- }
- }
-
- /**
- * Asserts that two double[] are equal.
- */
- private static void assertEquals(String message, double[] expected, double[] actual) {
- if (expected == null)
- assertNull(message, actual);
- else
- assertNotNull(message, actual);
-
- if (expected != null) {
- assertEquals(message + ": length ", expected.length, actual.length);
- for (int i = 0; i < expected.length; i++) {
- assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
- }
- }
- }
-
- /**
- * Asserts that two int[][] are equal.
- */
- private static void assertEquals(String message, int[][] expected, int[][] actual) {
- if (expected == null)
- assertNull(message, actual);
- else
- assertNotNull(message, actual);
-
- if (expected != null) {
- assertEquals(message + ": length ", expected.length, actual.length);
- for (int i = 0; i < expected.length; i++) {
- assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
- }
- }
- }
-}
+/*--
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+
+package org.swixml;
+
+import java.awt.*;
+import java.lang.reflect.Field;
+import javax.swing.JPanel;
+
+import com.jgoodies.forms.layout.*;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+/**
+ * Test class running layout related tests.
+ *
+ * @author Karl Tauber
+ */
+public class LayoutTest extends TestCase {
+
+ private static final String DESCRIPTOR = "xml/layout.xml";
+ private Container container;
+
+ // auto bound through Swixml
+ private JPanel borderPanel1;
+ private JPanel borderPanel2;
+ private JPanel borderPanel3;
+ private JPanel borderPanel10;
+ private JPanel cardPanel1;
+ private JPanel cardPanel2;
+ private JPanel cardPanel3;
+ private JPanel cardPanel10;
+ private JPanel flowPanel1;
+ private JPanel flowPanel2;
+ private JPanel flowPanel3;
+ private JPanel flowPanel4;
+ private JPanel gridPanel1;
+ private JPanel gridPanel2;
+ private JPanel gridPanel3;
+ private JPanel gridPanel4;
+ private JPanel gridPanel5;
+ private JPanel gridBagPanel1;
+ private JPanel gridBagPanel2;
+ private JPanel gridBagPanel3;
+ private JPanel gridBagPanel4;
+ private JPanel gridBagPanel5;
+ private JPanel gridBagPanel6;
+ private JPanel gridBagPanel10;
+ private JPanel formPanel1;
+ private JPanel formPanel2;
+
+
+ public LayoutTest() {
+ super("Test layout related things");
+ }
+
+ /**
+ * Renders the test GUI into the container field.
+ * Note: Like with every testcase, the setup method is going to be performed before
+ * the execution of every test..() method.
+ *
+ * @throws Exception
+ */
+ public void setUp() throws Exception {
+ SwingEngine.DEBUG_MODE = true;
+ SwingEngine se = new SwingEngine(this);
+ container = se.render(DESCRIPTOR);
+
+ }
+
+ /**
+ * Clears the container
+ */
+ public void teardown() {
+ container.removeAll();
+ container = null;
+ }
+
+ /**
+ * Tests the BorderLayoutConverter
+ */
+ public void testBorderLayout() {
+ TestCase.assertNotNull("JPanel borderPanel1 auto bound through Swixml", borderPanel1);
+ TestCase.assertNotNull("JPanel borderPanel2 auto bound through Swixml", borderPanel2);
+ TestCase.assertNotNull("JPanel borderPanel3 auto bound through Swixml", borderPanel3);
+ TestCase.assertNotNull("JPanel borderPanel10 auto bound through Swixml", borderPanel10);
+
+ checkBorderLayout("borderPanel1", borderPanel1, 0, 0);
+ checkBorderLayout("borderPanel2", borderPanel2, 1, 2);
+ checkBorderLayout("borderPanel3", borderPanel3, 1, 2);
+
+ // check constraints
+ BorderLayout borderLayout10 = (BorderLayout) borderPanel10.getLayout();
+ assertEquals(BorderLayout.NORTH, borderLayout10.getConstraints(borderPanel10.getComponent(0)));
+ assertEquals(BorderLayout.EAST, borderLayout10.getConstraints(borderPanel10.getComponent(1)));
+ assertEquals(BorderLayout.SOUTH, borderLayout10.getConstraints(borderPanel10.getComponent(2)));
+ assertEquals(BorderLayout.WEST, borderLayout10.getConstraints(borderPanel10.getComponent(3)));
+ assertEquals(BorderLayout.CENTER, borderLayout10.getConstraints(borderPanel10.getComponent(4)));
+ }
+
+ private static void checkBorderLayout(String message, JPanel borderPanel, int hgap, int vgap) {
+ LayoutManager layout = borderPanel.getLayout();
+ assertTrue(message, layout instanceof BorderLayout);
+
+ BorderLayout borderLayout = (BorderLayout) layout;
+ assertEquals(message + ": hgap ", hgap, borderLayout.getHgap());
+ assertEquals(message + ": vgap ", vgap, borderLayout.getVgap());
+ }
+
+ /**
+ * Tests the CardLayoutConverter
+ */
+ public void testCardLayout() {
+ TestCase.assertNotNull("JPanel cardPanel1 auto bound through Swixml", cardPanel1);
+ TestCase.assertNotNull("JPanel cardPanel2 auto bound through Swixml", cardPanel2);
+ TestCase.assertNotNull("JPanel cardPanel3 auto bound through Swixml", cardPanel3);
+ TestCase.assertNotNull("JPanel cardPanel10 auto bound through Swixml", cardPanel10);
+
+ checkCardLayout("cardPanel1", cardPanel1, 0, 0);
+ checkCardLayout("cardPanel2", cardPanel2, 1, 2);
+ checkCardLayout("cardPanel3", cardPanel3, 1, 2);
+
+ // check card names
+ CardLayout cardLayout10 = (CardLayout) cardPanel10.getLayout();
+ try {
+ // Because CardLayout has no API to access card names,
+ // use reflection to access private field.
+ Field currentCardField = cardLayout10.getClass().getDeclaredField("currentCard");
+ currentCardField.setAccessible(true);
+
+ cardLayout10.show(cardPanel10, "card2");
+ assertEquals(1, currentCardField.getInt(cardLayout10));
+
+ cardLayout10.show(cardPanel10, "card1");
+ assertEquals(0, currentCardField.getInt(cardLayout10));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new AssertionFailedError(ex.getMessage());
+ }
+ }
+
+ private static void checkCardLayout(String message, JPanel cardPanel, int hgap, int vgap) {
+ LayoutManager layout = cardPanel.getLayout();
+ assertTrue(message, layout instanceof CardLayout);
+
+ CardLayout cardLayout = (CardLayout) layout;
+ assertEquals(message + ": hgap ", hgap, cardLayout.getHgap());
+ assertEquals(message + ": vgap ", vgap, cardLayout.getVgap());
+ }
+
+ /**
+ * Tests the FlowLayoutConverter
+ */
+ public void testFlowLayout() {
+ TestCase.assertNotNull("JPanel flowPanel1 auto bound through Swixml", flowPanel1);
+ TestCase.assertNotNull("JPanel flowPanel2 auto bound through Swixml", flowPanel2);
+ TestCase.assertNotNull("JPanel flowPanel3 auto bound through Swixml", flowPanel3);
+ TestCase.assertNotNull("JPanel flowPanel4 auto bound through Swixml", flowPanel4);
+
+ checkFlowLayout("flowPanel1", flowPanel1, FlowLayout.CENTER, 5, 5);
+ checkFlowLayout("flowPanel2", flowPanel2, FlowLayout.RIGHT, 5, 5);
+ checkFlowLayout("flowPanel3", flowPanel3, FlowLayout.LEFT, 1, 2);
+ checkFlowLayout("flowPanel4", flowPanel4, FlowLayout.LEFT, 1, 2);
+ }
+
+ private static void checkFlowLayout(String message, JPanel flowPanel, int align, int hgap, int vgap) {
+ LayoutManager layout = flowPanel.getLayout();
+ assertTrue(message, layout instanceof FlowLayout);
+
+ FlowLayout flowLayout = (FlowLayout) layout;
+ assertEquals(message + ": alignment ", align, flowLayout.getAlignment());
+ assertEquals(message + ": hgap ", hgap, flowLayout.getHgap());
+ assertEquals(message + ": vgap ", vgap, flowLayout.getVgap());
+ }
+
+ /**
+ * Tests the GridLayoutConverter
+ */
+ public void testGridLayout() {
+ TestCase.assertNotNull("JPanel gridPanel1 auto bound through Swixml", gridPanel1);
+ TestCase.assertNotNull("JPanel gridPanel2 auto bound through Swixml", gridPanel2);
+ TestCase.assertNotNull("JPanel gridPanel3 auto bound through Swixml", gridPanel3);
+ TestCase.assertNotNull("JPanel gridPanel4 auto bound through Swixml", gridPanel4);
+ TestCase.assertNotNull("JPanel gridPanel5 auto bound through Swixml", gridPanel5);
+
+ checkGridLayout("gridPanel1", gridPanel1, 1, 0, 0, 0);
+ checkGridLayout("gridPanel2", gridPanel2, 2, 3, 0, 0);
+ checkGridLayout("gridPanel3", gridPanel3, 4, 5, 6, 7);
+ checkGridLayout("gridPanel4", gridPanel4, 2, 3, 0, 0);
+ checkGridLayout("gridPanel5", gridPanel5, 4, 5, 6, 7);
+ }
+
+ private static void checkGridLayout(String message, JPanel gridPanel, int rows, int cols, int hgap, int vgap) {
+ LayoutManager layout = gridPanel.getLayout();
+ assertTrue(message, layout instanceof GridLayout);
+
+ GridLayout gridLayout = (GridLayout) layout;
+ assertEquals(message + ": rows ", rows, gridLayout.getRows());
+ assertEquals(message + ": cols ", cols, gridLayout.getColumns());
+ assertEquals(message + ": hgap ", hgap, gridLayout.getHgap());
+ assertEquals(message + ": vgap ", vgap, gridLayout.getVgap());
+ }
+
+ /**
+ * Tests the GridBagLayoutConverter
+ */
+ public void testGridBagLayout() {
+ TestCase.assertNotNull("JPanel gridBagPanel1 auto bound through Swixml", gridBagPanel1);
+ TestCase.assertNotNull("JPanel gridBagPanel2 auto bound through Swixml", gridBagPanel2);
+ TestCase.assertNotNull("JPanel gridBagPanel3 auto bound through Swixml", gridBagPanel3);
+ TestCase.assertNotNull("JPanel gridBagPanel4 auto bound through Swixml", gridBagPanel4);
+ TestCase.assertNotNull("JPanel gridBagPanel5 auto bound through Swixml", gridBagPanel5);
+ TestCase.assertNotNull("JPanel gridBagPanel6 auto bound through Swixml", gridBagPanel6);
+ TestCase.assertNotNull("JPanel gridBagPanel10 auto bound through Swixml", gridBagPanel10);
+
+ checkGridBagLayout("gridBagPanel1", gridBagPanel1, null, null, null, null);
+ checkGridBagLayout("gridBagPanel2", gridBagPanel2, new int[] {1, 2, 3}, null, null, null);
+ checkGridBagLayout("gridBagPanel3", gridBagPanel3, null, new int[] {4, 5, 6}, null, null);
+ checkGridBagLayout("gridBagPanel4", gridBagPanel4, null, null, new double[] {0.1, 0.2, 1.0}, null);
+ checkGridBagLayout("gridBagPanel5", gridBagPanel5, null, null, null, new double[] {0.3, 0.4});
+ checkGridBagLayout("gridBagPanel6", gridBagPanel6, new int[] {1, 2, 3},
+ new int[] {4, 5, 6}, new double[] {0.1, 0.2, 1.0}, new double[] {0.3, 0.4});
+
+ GridBagLayout gridBagLayout10 = (GridBagLayout) gridBagPanel10.getLayout();
+ checkGridBagConstraints("gridBagPanel10 [0]",
+ new GridBagConstraints(),
+ gridBagLayout10.getConstraints(gridBagPanel10.getComponent(0)));
+ checkGridBagConstraints("gridBagPanel10 [1]",
+ new GridBagConstraints(1, 2, 3, 4, 0.1, 1.0,
+ GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
+ new Insets(1,2,3,4), 5, 6),
+ gridBagLayout10.getConstraints(gridBagPanel10.getComponent(1)));
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 2;
+ gbc.gridy = 4;
+ checkGridBagConstraints("gridBagPanel10 [2]",
+ gbc,
+ gridBagLayout10.getConstraints(gridBagPanel10.getComponent(2)));
+ }
+
+ private static void checkGridBagLayout(String message, JPanel gridBagPanel,
+ int columnWidths[], int rowHeights[], double columnWeights[], double rowWeights[])
+ {
+ LayoutManager layout = gridBagPanel.getLayout();
+ assertTrue(message, layout instanceof GridBagLayout);
+
+ GridBagLayout gridBagLayout = (GridBagLayout) layout;
+ assertEquals(message + ": columnWidths ", columnWidths, gridBagLayout.columnWidths);
+ assertEquals(message + ": rowHeights ", rowHeights, gridBagLayout.rowHeights);
+ assertEquals(message + ": columnWeights ", columnWeights, gridBagLayout.columnWeights);
+ assertEquals(message + ": rowWeights ", rowWeights, gridBagLayout.rowWeights);
+ }
+
+ private static void checkGridBagConstraints(String message,
+ GridBagConstraints expected, GridBagConstraints actual)
+ {
+ assertEquals(message + ": gridx ", expected.gridx, actual.gridx);
+ assertEquals(message + ": gridy ", expected.gridy, actual.gridy);
+ assertEquals(message + ": gridwidth ", expected.gridwidth, actual.gridwidth);
+ assertEquals(message + ": gridheight ", expected.gridheight, actual.gridheight);
+ assertEquals(message + ": weightx ", expected.weightx, actual.weightx);
+ assertEquals(message + ": weighty ", expected.weighty, actual.weighty);
+ assertEquals(message + ": anchor ", expected.anchor, actual.anchor);
+ assertEquals(message + ": fill ", expected.fill, actual.fill);
+ assertEquals(message + ": insets.top ", expected.insets.top, actual.insets.top);
+ assertEquals(message + ": insets.left ", expected.insets.left, actual.insets.left);
+ assertEquals(message + ": insets.bottom ", expected.insets.bottom, actual.insets.bottom);
+ assertEquals(message + ": insets.right ", expected.insets.right, actual.insets.right);
+ assertEquals(message + ": ipadx ", expected.ipadx, actual.ipadx);
+ assertEquals(message + ": ipady ", expected.ipady, actual.ipady);
+ }
+
+ public void testFormLayout() {
+ TestCase.assertNotNull("JPanel formPanel1 auto bound through Swixml", formPanel1);
+ TestCase.assertNotNull("JPanel formPanel2 auto bound through Swixml", formPanel2);
+
+ checkFormLayout("formPanel1", formPanel1,
+ "p, 3dlu, p, 3dlu, p",
+ "p, 3dlu, p, 3dlu, p",
+ new int[0][],
+ new int[0][],
+ "1,3",
+ "3,3,3,1");
+
+ checkFormLayout("formPanel2", formPanel2,
+ "p, p, p, p, p, p, p, p, p, p",
+ "p, p, p, p, p, p, p, p, p, p",
+ new int[][] {{ 1,3,5,7 }, { 9,2,4 }, { 6,8,10 }},
+ new int[][] {{ 6,8,10 }, { 2,4,9 }, { 1,3,5,7 }});
+ }
+
+ private static void checkFormLayout(String message, JPanel formPanel,
+ String encodedColumnSpecs, String encodedRowSpecs,
+ int[][] columnGroupIndices, int[][] rowGroupIndices,
+ String... expectedConstraints)
+ {
+ LayoutManager layout = formPanel.getLayout();
+ assertTrue(message, layout instanceof FormLayout);
+
+ ColumnSpec[] expectedColumnSpecs = ColumnSpec.decodeSpecs(encodedColumnSpecs);
+ RowSpec[] expectedRowSpecs = RowSpec.decodeSpecs(encodedRowSpecs);
+
+ FormLayout formLayout = (FormLayout) layout;
+ int columnCount = formLayout.getColumnCount();
+ int rowCount = formLayout.getRowCount();
+ int componentCount = formPanel.getComponentCount();
+
+ assertEquals(message + ": columnCount ", expectedColumnSpecs.length, columnCount);
+ assertEquals(message + ": rowCount ", expectedRowSpecs.length, rowCount);
+ assertEquals(message + ": componentCount ", expectedConstraints.length, componentCount);
+
+ // check column specs
+ for (int i = 0; i < columnCount; i++) {
+ ColumnSpec spec = formLayout.getColumnSpec(i + 1);
+ assertEquals(message + ": column[" + i + "] ",
+ expectedColumnSpecs[i].toString(), spec.toString() );
+ }
+
+ // check row specs
+ for (int i = 0; i < rowCount; i++) {
+ RowSpec spec = formLayout.getRowSpec(i + 1);
+ assertEquals(message + ": row[" + i + "] ",
+ expectedRowSpecs[i].toString(), spec.toString() );
+ }
+
+ // check column and row groups
+ assertEquals(message + ": columnGroups ", columnGroupIndices, formLayout.getColumnGroups());
+ assertEquals(message + ": rowGroups ", rowGroupIndices, formLayout.getRowGroups());
+
+ // check component constraints
+ for (int i = 0; i < componentCount; i++) {
+ CellConstraints cc = formLayout.getConstraints(formPanel.getComponent(i));
+ assertEquals(message + ": cc[" + i + "] ",
+ new CellConstraints(expectedConstraints[i]).toString(), cc.toString() );
+ }
+ }
+
+ /**
+ * Asserts that two int[] are equal.
+ */
+ private static void assertEquals(String message, int[] expected, int[] actual) {
+ if (expected == null)
+ assertNull(message, actual);
+ else
+ assertNotNull(message, actual);
+
+ if (expected != null) {
+ assertEquals(message + ": length ", expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
+ }
+ }
+ }
+
+ /**
+ * Asserts that two double[] are equal.
+ */
+ private static void assertEquals(String message, double[] expected, double[] actual) {
+ if (expected == null)
+ assertNull(message, actual);
+ else
+ assertNotNull(message, actual);
+
+ if (expected != null) {
+ assertEquals(message + ": length ", expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
+ }
+ }
+ }
+
+ /**
+ * Asserts that two int[][] are equal.
+ */
+ private static void assertEquals(String message, int[][] expected, int[][] actual) {
+ if (expected == null)
+ assertNull(message, actual);
+ else
+ assertNotNull(message, actual);
+
+ if (expected != null) {
+ assertEquals(message + ": length ", expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(message + "[" + i + "] ", expected[i], actual[i]);
+ }
+ }
+ }
+}
diff --git a/src/test/java/org/swixml/LocalizationTest.java b/swixml-core/src/test/java/org/swixml/LocalizationTest.java
similarity index 97%
rename from src/test/java/org/swixml/LocalizationTest.java
rename to swixml-core/src/test/java/org/swixml/LocalizationTest.java
index 6924c63..6384bc1 100644
--- a/src/test/java/org/swixml/LocalizationTest.java
+++ b/swixml-core/src/test/java/org/swixml/LocalizationTest.java
@@ -1,95 +1,95 @@
-/*--
- $Id: LocalizationTest.java,v 1.2 2007/07/16 00:04:15 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * Testcase for localization of Strings and comma separated lists of strings.
- */
-public class LocalizationTest extends TestCase {
- public static final String DESCRIPTOR = "xml/local.xml";
-
- private JButton btn1, btn2, btn3, btn4, btn5; // set through Swixml
- private JTabbedPane tpane; // set Through Swixml
- private Container container;
-
- public LocalizationTest() throws Exception {
- this("Test Localization of for key strings and comma separated keys");
- }
-
- public LocalizationTest(String s) throws Exception {
- super(s);
- container = new SwingEngine(this).render(DESCRIPTOR);
- }
-
- public void testLocalization() {
- TestCase.assertNotNull("UI needs to be instantiated", container);
- TestCase.assertEquals("Simple String Lookup should match", "Hello World", btn1.getText());
- TestCase.assertEquals("Simple String Lookup should match", "Hello, World", btn2.getText());
- TestCase.assertEquals("Simple String Lookup should match", "Alpha", btn3.getText());
- TestCase.assertEquals("Key without matching Value should return key", "abcdef0123456", btn4.getText());
- TestCase.assertEquals("Key without matching Value should return key", "abcdef,0123456", btn5.getText());
- }
-
- public void testStringListLocalization() {
- TestCase.assertEquals("TabbedPane with 3 tabs expected", 3, tpane.getTabCount());
- TestCase.assertEquals("Tab Title was set through Swixml", "Alpha", tpane.getTitleAt(0));
- TestCase.assertEquals("Tab Title was set through Swixml", "Bravo", tpane.getTitleAt(1));
- TestCase.assertEquals("Tab Title was set through Swixml", "Charlie", tpane.getTitleAt(2));
- }
-
-}
+/*--
+ $Id: LocalizationTest.java,v 1.2 2007/07/16 00:04:15 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Testcase for localization of Strings and comma separated lists of strings.
+ */
+public class LocalizationTest extends TestCase {
+ public static final String DESCRIPTOR = "xml/local.xml";
+
+ private JButton btn1, btn2, btn3, btn4, btn5; // set through Swixml
+ private JTabbedPane tpane; // set Through Swixml
+ private Container container;
+
+ public LocalizationTest() throws Exception {
+ this("Test Localization of for key strings and comma separated keys");
+ }
+
+ public LocalizationTest(String s) throws Exception {
+ super(s);
+ container = new SwingEngine(this).render(DESCRIPTOR);
+ }
+
+ public void testLocalization() {
+ TestCase.assertNotNull("UI needs to be instantiated", container);
+ TestCase.assertEquals("Simple String Lookup should match", "Hello World", btn1.getText());
+ TestCase.assertEquals("Simple String Lookup should match", "Hello, World", btn2.getText());
+ TestCase.assertEquals("Simple String Lookup should match", "Alpha", btn3.getText());
+ TestCase.assertEquals("Key without matching Value should return key", "abcdef0123456", btn4.getText());
+ TestCase.assertEquals("Key without matching Value should return key", "abcdef,0123456", btn5.getText());
+ }
+
+ public void testStringListLocalization() {
+ TestCase.assertEquals("TabbedPane with 3 tabs expected", 3, tpane.getTabCount());
+ TestCase.assertEquals("Tab Title was set through Swixml", "Alpha", tpane.getTitleAt(0));
+ TestCase.assertEquals("Tab Title was set through Swixml", "Bravo", tpane.getTitleAt(1));
+ TestCase.assertEquals("Tab Title was set through Swixml", "Charlie", tpane.getTitleAt(2));
+ }
+
+}
diff --git a/src/test/java/org/swixml/MappingTest.java b/swixml-core/src/test/java/org/swixml/MappingTest.java
similarity index 97%
rename from src/test/java/org/swixml/MappingTest.java
rename to swixml-core/src/test/java/org/swixml/MappingTest.java
index 6610d80..da4bab2 100755
--- a/src/test/java/org/swixml/MappingTest.java
+++ b/swixml-core/src/test/java/org/swixml/MappingTest.java
@@ -1,114 +1,114 @@
-/*--
- $Id: MappingTest.java,v 1.2 2005/06/01 00:04:15 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * Test class running auto-mapping related tests.
- * @author Wolf Paulus
- */
-public class MappingTest extends TestCase implements GlobalActions {
- public static final String DESCRIPTOR = "xml/mappings.xml";
- private Container container;
- private JMenuItem miAbout;
-
- public JButton b1;
- public transient JButton b2;
- private JButton b3;
- private transient JButton b4;
-
- public MappingTest() {
- super("Test Mapping og XML Tags to JComponent Objects in the SwingEngine's Client" );
- }
- public MappingTest(String s) {
- super(s);
- }
-
- /**
- * Renders the test GUI into the container field.
- * Note: Like with every testcase, the setup method is going to be performed before
- * the execution of every test..() method.
- * @throws Exception
- */
- public void setUp() throws Exception {
- SwingEngine se = new SwingEngine(this);
- container = se.render(MappingTest.DESCRIPTOR);
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- container.removeAll();
- container=null;
- }
-
- /**
- * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
- */
- public void testMappingPublicFields() {
- TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", b1);
- TestCase.assertNull("Transient Fields must not be initializd by the SwingEngine.", b2);
- TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b3);
- TestCase.assertNull("Transient Fields must not be initializd by the SwingEngine.", b4);
- }
-
- public void testStaticInterfaceMappings() {
- TestCase.assertNotNull("aboutAction is statically defined in an Interface and should have been mapped into the private JMenuItem's action", miAbout.getAction());
- }
-
-}
+/*--
+ $Id: MappingTest.java,v 1.2 2005/06/01 00:04:15 wolfpaulus Exp $
+
+ Copyright (C) 2003-2007 Wolf Paulus.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The end-user documentation included with the redistribution,
+ if any, must include the following acknowledgment:
+ "This product includes software developed by the
+ SWIXML Project (http://www.swixml.org/)."
+ Alternately, this acknowledgment may appear in the software itself,
+ if and wherever such third-party acknowledgments normally appear.
+
+ 4. The name "Swixml" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact
+
+ 5. Products derived from this software may not be called "Swixml",
+ nor may "Swixml" appear in their name, without prior written
+ permission from the Swixml Project Management.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Swixml Project and was originally
+ created by Wolf Paulus . For more information
+ on the Swixml Project, please see .
+*/
+package org.swixml;
+
+import junit.framework.TestCase;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Test class running auto-mapping related tests.
+ * @author Wolf Paulus
+ */
+public class MappingTest extends TestCase implements GlobalActions {
+ public static final String DESCRIPTOR = "xml/mappings.xml";
+ private Container container;
+ private JMenuItem miAbout;
+
+ public JButton b1;
+ public transient JButton b2;
+ private JButton b3;
+ private transient JButton b4;
+
+ public MappingTest() {
+ super("Test Mapping og XML Tags to JComponent Objects in the SwingEngine's Client" );
+ }
+ public MappingTest(String s) {
+ super(s);
+ }
+
+ /**
+ * Renders the test GUI into the container field.
+ * Note: Like with every testcase, the setup method is going to be performed before
+ * the execution of every test..() method.
+ * @throws Exception
+ */
+ public void setUp() throws Exception {
+ SwingEngine se = new SwingEngine(this);
+ container = se.render(MappingTest.DESCRIPTOR);
+ }
+
+ /**
+ * Clears the container
+ */
+ public void teardown() {
+ container.removeAll();
+ container=null;
+ }
+
+ /**
+ * Tests if the JButtons were correctly initialized/mapped by the SwingEngine.
+ */
+ public void testMappingPublicFields() {
+ TestCase.assertNotNull("Public Fields, whose names have matching ids the the XML descriptor should be initializd by the SwingEngine.", b1);
+ TestCase.assertNull("Transient Fields must not be initializd by the SwingEngine.", b2);
+ TestCase.assertNotNull("Private Field, whose names have a matching ids the the XML descriptor should be initializd by the SwingEngine.", b3);
+ TestCase.assertNull("Transient Fields must not be initializd by the SwingEngine.", b4);
+ }
+
+ public void testStaticInterfaceMappings() {
+ TestCase.assertNotNull("aboutAction is statically defined in an Interface and should have been mapped into the private JMenuItem's action", miAbout.getAction());
+ }
+
+}
diff --git a/src/test/java/org/swixml/MenuTest.java b/swixml-core/src/test/java/org/swixml/MenuTest.java
similarity index 97%
rename from src/test/java/org/swixml/MenuTest.java
rename to swixml-core/src/test/java/org/swixml/MenuTest.java
index 87f35f6..2cbe25c 100755
--- a/src/test/java/org/swixml/MenuTest.java
+++ b/swixml-core/src/test/java/org/swixml/MenuTest.java
@@ -1,97 +1,97 @@
-/*--
- $Id: MenuTest.java,v 1.1 2005/06/04 22:24:06 wolfpaulus Exp $
-
- Copyright (C) 2003-2007 Wolf Paulus.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the disclaimer that follows
- these conditions in the documentation and/or other materials provided
- with the distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- SWIXML Project (http://www.swixml.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "Swixml" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact
-
- 5. Products derived from this software may not be called "Swixml",
- nor may "Swixml" appear in their name, without prior written
- permission from the Swixml Project Management.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE SWIXML PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the Swixml Project and was originally
- created by Wolf Paulus . For more information
- on the Swixml Project, please see .
-*/
-package org.swixml;
-
-import junit.framework.TestCase;
-
-import java.awt.*;
-
-/**
- * Test for some JMenuBar specialties.
- */
-public class MenuTest extends TestCase {
- public static final String DESCRIPTOR = "xml/dialog.xml";
- private Container container;
- private SwingEngine se;
-
- public MenuTest() {
- super("Test inserting a Menu into a container.");
- }
-
- public MenuTest(String s) {
- super(s);
- }
-
- public void setUp() throws Exception {
- se = new SwingEngine(this);
- container = se.render(MenuTest.DESCRIPTOR);
- }
-
- /**
- * Clears the container
- */
- public void teardown() {
- container.removeAll();
- container = null;
- }
-
- /**
- * Tests if a JMenubar is added into a container, even if the container doesn't provide
- * a setJMenuBar() method.
- */
- public void testInclusioin() {
- Component menubar = se.find("menubar");
- TestCase.assertNotNull(" tag in the descriptor requires the instantiation of a JMenuBar obj.", menubar);
- TestCase.assertNotNull("Since