You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/26 20:07:37 UTC
cvs commit: jakarta-commons-sandbox/jelly maven.xml .cvsignore
jstrachan 2002/09/26 11:07:37
Modified: jelly/src/test/org/apache/commons/jelly/swing run.jelly
jelly/src/test/org/apache/commons/jelly/demos
HomepageBuilder.java template2.jelly
template1.jelly
jelly/src/java/org/apache/commons/jelly/tags/swing
SwingTagLibrary.java ComponentTag.java TdTag.java
jelly maven.xml .cvsignore
Added: jelly/src/test/org/apache/commons/jelly/demos
homepageBuilder.jelly
jelly/src/java/org/apache/commons/jelly/tags/swing
BorderLayoutTag.java BorderAlignTag.java
Log:
Some JellySwing changes.
Firstly added support for <borderLayout> and <borderAlign align="center"> style of tags to use the Swing BorderLayout.
Added support for <vbox> and <hbox> to create Swing Box panels (which have their own inbuilt BoxLayout)
Also added colfill="true" and rowfill="true" options on <td> so that columns can stretch
Finally I've improved the JellyRunner so that its a little dialog, with a history field and a button so that reevaluating the same script can be much easier. Just hit save in your editor and hit the button and the Jelly script executes immediately - no more waiting for a JVM to start.
Revision Changes Path
1.2 +50 -9 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/run.jelly
Index: run.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/run.jelly,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- run.jelly 25 Sep 2002 17:54:57 -0000 1.1
+++ run.jelly 26 Sep 2002 18:07:36 -0000 1.2
@@ -8,18 +8,59 @@
<j:if test="${empty working.dir}">
<j:set var="working.dir" value="src/test/org/apache/commons/jelly/swing"/>
</j:if>
+
+ <!-- action to choose a file -->
+ <action var="chooseFileAction" name="...">
+ <fileChooser var="chooser" description="Jelly files" currentDirectory="${working.dir}"/>
- <fileChooser var="chooser" description="Jelly files" currentDirectory="${working.dir}"/>
+ ${chooser.showDialog(frame, 'Choose Jelly file')}
- ${chooser.showDialog(frame, 'Choose Jelly file')}
+ <j:set var="file" value="${chooser.selectedFile}"/>
+ <j:if test="${file != null}">
+ <j:set target="${scriptField}" property="text" value="${file.toURL().toString()}"/>
+ </j:if>
+ </action>
+
+
+ <!-- create the dialog -->
+ <dialog var="dialog" size="400,150" location="200,200" title="Jelly Runner">
+ <panel>
+ <tableLayout>
+ <tr>
+ <td colfill="true">
+ <panel>
+ <borderLayout hgap="2" vgap="2">
+ <borderAlign align="west">
+ <label text="Script to run:"/>
+ </borderAlign>
+ <borderAlign align="center">
+ <textField var="scriptField"/>
+ </borderAlign>
+ <borderAlign align="east">
+ <button action="${chooseFileAction}"/>
+ </borderAlign>
+ </borderLayout>
+ </panel>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <panel>
+ <button>
+ <action name="Run Script">
+ <log:info>about to run ${file}</log:info>
+ <j:include uri="${file.toURL().toString()}"/>
+ </action>
+ </button>
+ </panel>
+ </td>
+ </tr>
+ </tableLayout>
+ </panel>
+ </dialog>
+
+ ${dialog.setVisible(true)}
- <j:set var="file" value="${chooser.selectedFile}"/>
-
- <j:if test="${file != null}">
- <log:info>about to run ${file}</log:info>
- <j:include uri="${file.toURL().toString()}"/>
- </j:if>
-
</j:jelly>
1.2 +65 -7 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/HomepageBuilder.java
Index: HomepageBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/HomepageBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HomepageBuilder.java 25 Sep 2002 18:36:59 -0000 1.1
+++ HomepageBuilder.java 26 Sep 2002 18:07:36 -0000 1.2
@@ -1,11 +1,65 @@
-package org.apache.commons.jelly.demos;
-
-
-/**
- *
+/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2002 The Apache Software Foundation. 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 following disclaimer 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 acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
*
- * @author administrator
+ * $Id$
*/
+package org.apache.commons.jelly.demos;
import java.awt.*;
import java.awt.event.*;
@@ -22,7 +76,11 @@
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.impl.Embedded;
-
+/**
+ * A sample Swing program that demonstrates the use of Jelly as a templating mechanism
+ *
+ * @author Otto von Wachter
+ */
public class HomepageBuilder extends JPanel {
JTextField nameField;
1.2 +1 -1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/template2.jelly
Index: template2.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/template2.jelly,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- template2.jelly 25 Sep 2002 18:36:59 -0000 1.1
+++ template2.jelly 26 Sep 2002 18:07:36 -0000 1.2
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html">
+<j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html">
<html>
1.2 +1 -1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/template1.jelly
Index: template1.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/template1.jelly,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- template1.jelly 25 Sep 2002 18:36:59 -0000 1.1
+++ template1.jelly 26 Sep 2002 18:07:36 -0000 1.2
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html">
+<j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:html="jelly:html">
<html>
1.1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/demos/homepageBuilder.jelly
Index: homepageBuilder.jelly
===================================================================
<?xml version="1.0"?>
<j:jelly
xmlns:j="jelly:core"
xmlns="jelly:swing"
xmlns:log="jelly:log">
<!-- create the generate page action -->
<action var="createPageAction" name="Build and preview your page!">
<j:set var="name" value="${nameField.text}"/>
<j:set var="background" value="${colorField.text}"/>
<j:set var="url" value="${pictureField.text}"/>
<j:set var="hobbies" value="${hobbyModel.toArray()}"/>
<j:set var="template" value="${templateField.getSelectedItem().toString()}"/>
<log:info>name = ${name}</log:info>
<log:info>background = ${background}</log:info>
<log:info>url = ${url}</log:info>
<log:info>hobbies = ${hobbies}</log:info>
<log:info>template = ${template}</log:info>
<j:file name="demopage.html" outputMode="html">
<j:include uri="${template}"/>
</j:file>
<frame var="showPageFrame" size="500,600" location="200,200" title="Your Homepage">
<scrollPane>
<editorPane page="${context.getResource('/demopage.html').toString()}" editable="false"/>
</scrollPane>
</frame>
${showPageFrame.show()}
</action>
<!-- create the Frame -->
<frame var="frame" title="Homepage Builder" location="100,100" size="800,400">
<panel>
<!-- uncomment this when we've implemented emptyBorder
<emptyBorder top="20" left="20" bottom="20" right="20" />
-->
<borderLayout>
<borderAlign align="west">
<vbox>
<label text="Name:"/>
<textField var="nameField" text="James Bond"/>
<label text="Favourite Color:"/>
<textField var="colorField" text="#007007"/>
<label text="Picture URL::"/>
<textField var="pictureField" text="http://www.ianfleming.org/007news/images3/c2002_pierce1.jpg"/>
<label text="Choose template::"/>
<comboBox var="templateField"/>
${templateField.addItem('template1.jelly')}
${templateField.addItem('template2.jelly')}
<label text="Add a Hobby:"/>
<textField var="hobbyField"/>
<button>
<action name="Add >>>">
${hobbyModel.addElement(hobbyField.text)}
</action>
</button>
</vbox>
</borderAlign>
<borderAlign align="east">
<scrollPane>
<j:useBean class="javax.swing.DefaultListModel" var="hobbyModel"/>
<list model="${hobbyModel}"/>
${hobbyModel.addElement('Killing bad guys')}
${hobbyModel.addElement('Wrecking cars')}
${hobbyModel.addElement('Eating jelly')}
</scrollPane>
</borderAlign>
<borderAlign align="south">
<button action="${createPageAction}"/>
</borderAlign>
</borderLayout>
</panel>
</frame>
${frame.show()}
</j:jelly>
1.10 +24 -0 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java
Index: SwingTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SwingTagLibrary.java 25 Sep 2002 17:54:57 -0000 1.9
+++ SwingTagLibrary.java 26 Sep 2002 18:07:36 -0000 1.10
@@ -129,6 +129,10 @@
// GridBagLayout
registerTag( "gridBagLayout", GridBagLayoutTag.class );
registerTag( "gbc", GbcTag.class );
+
+ // BorderLayout
+ registerTag( "borderLayout", BorderLayoutTag.class );
+ registerTag( "borderAlign", BorderAlignTag.class );
}
/** Creates a new script to execute the given tag name and attributes */
@@ -178,6 +182,7 @@
// but children should also be able to be any component (as Swing comps. are all container)
registerBeanFactory( "desktopPane", JDesktopPane.class );
registerBeanFactory( "dialog", JDialog.class );
+ registerBeanFactory( "editorPane", JEditorPane.class );
registerBeanFactory( "fileChooser", JFileChooser.class );
registerBeanFactory( "frame", JFrame.class );
registerBeanFactory( "internalFrame", JInternalFrame.class );
@@ -208,6 +213,25 @@
}
}
);
+
+ // Box related layout components
+ registerFactory(
+ "hbox",
+ new Factory() {
+ public Object newInstance() {
+ return Box.createHorizontalBox();
+ }
+ }
+ );
+ registerFactory(
+ "vbox",
+ new Factory() {
+ public Object newInstance() {
+ return Box.createVerticalBox();
+ }
+ }
+ );
+
registerBeanFactory( "tabbedPane", JTabbedPane.class );
registerBeanFactory( "table", JTable.class );
registerBeanFactory( "textArea", JTextArea.class );
1.9 +5 -0 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java
Index: ComponentTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ComponentTag.java 25 Sep 2002 16:26:15 -0000 1.8
+++ ComponentTag.java 26 Sep 2002 18:07:36 -0000 1.9
@@ -155,6 +155,11 @@
public void setLayout(LayoutManager layout) throws Exception {
Component component = getComponent();
if ( component != null ) {
+ if ( component instanceof RootPaneContainer ) {
+ RootPaneContainer rpc = (RootPaneContainer) component;
+ component = rpc.getContentPane();
+ }
+
// lets just try set the 'layout' property
BeanUtils.setProperty( component, "layout", layout );
}
1.2 +42 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/TdTag.java
Index: TdTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/TdTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TdTag.java 25 Sep 2002 16:26:15 -0000 1.1
+++ TdTag.java 26 Sep 2002 18:07:36 -0000 1.2
@@ -88,6 +88,8 @@
private String valign;
private int colspan = 1;
private int rowspan = 1;
+ private boolean colfill = false;
+ private boolean rowfill = false;
public TdTag() {
}
@@ -147,6 +149,36 @@
this.rowspan = rowspan;
}
+ /**
+ * Returns the colfill.
+ * @return boolean
+ */
+ public boolean isColfill() {
+ return colfill;
+ }
+
+ /**
+ * Returns the rowfill.
+ * @return boolean
+ */
+ public boolean isRowfill() {
+ return rowfill;
+ }
+
+ /**
+ * Sets whether or not this column should allow its component to stretch to fill the space available
+ */
+ public void setColfill(boolean colfill) {
+ this.colfill = colfill;
+ }
+
+ /**
+ * Sets whether or not this row should allow its component to stretch to fill the space available
+ */
+ public void setRowfill(boolean rowfill) {
+ this.rowfill = rowfill;
+ }
+
// Implementation methods
//-------------------------------------------------------------------------
@@ -163,7 +195,16 @@
if (rowspan < 1) {
rowspan = 1;
}
- answer.fill = GridBagConstraints.BOTH;
+ if (isColfill()) {
+ answer.fill = isRowfill()
+ ? GridBagConstraints.BOTH
+ : GridBagConstraints.HORIZONTAL;
+ }
+ else {
+ answer.fill = isRowfill()
+ ? GridBagConstraints.VERTICAL
+ : GridBagConstraints.NONE;
+ }
answer.weightx = 0.2;
answer.weighty = 0;
answer.gridwidth = colspan;
1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/BorderLayoutTag.java
Index: BorderLayoutTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTag.java,v 1.7 2002/05/17 15:18:12 jstrachan Exp $
* $Revision: 1.7 $
* $Date: 2002/05/17 15:18:12 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. 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 following disclaimer 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* $Id: DynamicTag.java,v 1.7 2002/05/17 15:18:12 jstrachan Exp $
*/
package org.apache.commons.jelly.tags.swing;
import java.awt.BorderLayout;
import java.awt.LayoutManager;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A Layout tag which uses nested <borderAlign> tags to implement a BorderLayout
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision: 1.7 $
*/
public class BorderLayoutTag extends LayoutTagSupport {
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(LayoutTagSupport.class);
private int hgap;
private int vgap;
public BorderLayoutTag() {
}
// Properties
//-------------------------------------------------------------------------
/**
* Returns the hgap.
* @return int
*/
public int getHgap() {
return hgap;
}
/**
* Returns the vgap.
* @return int
*/
public int getVgap() {
return vgap;
}
/**
* Sets the horizontal gap in pixels.
*/
public void setHgap(int hgap) {
this.hgap = hgap;
}
/**
* Sets the vertical gap in pixels
*/
public void setVgap(int vgap) {
this.vgap = vgap;
}
// Implementation methods
//-------------------------------------------------------------------------
/**
* Creates a BorderLayout
*/
protected LayoutManager createLayoutManager() throws Exception {
return new BorderLayout(hgap, vgap);
}
}
1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/BorderAlignTag.java
Index: BorderAlignTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTag.java,v 1.7 2002/05/17 15:18:12 jstrachan Exp $
* $Revision: 1.7 $
* $Date: 2002/05/17 15:18:12 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. 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 following disclaimer 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* $Id: DynamicTag.java,v 1.7 2002/05/17 15:18:12 jstrachan Exp $
*/
package org.apache.commons.jelly.tags.swing;
import java.awt.BorderLayout;
import java.awt.Component;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Represents a layout of a child component within its parent <borderLayout> layout.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision: 1.7 $
*/
public class BorderAlignTag extends TagSupport implements ContainerTag {
private String align;
// ContainerTag interface
//-------------------------------------------------------------------------
/**
* Adds a child component to this parent
*/
public void addChild(Component component, Object constraints) throws Exception {
BorderLayoutTag tag = (BorderLayoutTag) findAncestorWithClass( BorderLayoutTag.class );
if (tag == null) {
throw new JellyException( "this tag must be nested within a <tr> tag" );
}
tag.addLayoutComponent(component, getConstraints());
}
// Tag interface
//-------------------------------------------------------------------------
public void doTag(final XMLOutput output) throws Exception {
invokeBody(output);
}
// Properties
//-------------------------------------------------------------------------
/**
* Returns the align.
* @return String
*/
public String getAlign() {
return align;
}
/**
* Sets the alignment of the child component which is a case insensitive value
* of {NORTH, SOUTH, EAST, WEST, CENTER} which defaults to CENTER
*/
public void setAlign(String align) {
this.align = align;
}
// Implementation methods
//-------------------------------------------------------------------------
protected Object getConstraints() {
if ("north".equalsIgnoreCase(align)) {
return BorderLayout.NORTH;
}
else if ("south".equalsIgnoreCase(align)) {
return BorderLayout.SOUTH;
}
else if ("east".equalsIgnoreCase(align)) {
return BorderLayout.EAST;
}
else if ("west".equalsIgnoreCase(align)) {
return BorderLayout.WEST;
}
else {
// default to CENTER
return BorderLayout.CENTER;
}
}
}
1.34 +12 -0 jakarta-commons-sandbox/jelly/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/maven.xml,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- maven.xml 25 Sep 2002 18:36:59 -0000 1.33
+++ maven.xml 26 Sep 2002 18:07:37 -0000 1.34
@@ -455,4 +455,16 @@
</java>
</goal>
+
+ <!-- move this into a Maven plugin -->
+ <goal name="jelly:runner" prereqs="jelly-task"
+ description="Runs the Jelly Runner which is a JellySwing script to run other Jelly scripts)">
+ <java classname="org.apache.commons.jelly.Jelly" fork="yes">
+ <classpath refid="test.classpath"/>
+ <sysproperty key="http.proxyHost" value="${maven.proxy.host}"/>
+ <sysproperty key="http.proxyPort" value="${maven.proxy.port}"/>
+ <arg value="src/test/org/apache/commons/jelly/swing/run.jelly"/>
+ </java>
+ </goal>
+
</project>
1.9 +1 -0 jakarta-commons-sandbox/jelly/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/.cvsignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- .cvsignore 25 Sep 2002 06:41:12 -0000 1.8
+++ .cvsignore 26 Sep 2002 18:07:37 -0000 1.9
@@ -7,3 +7,4 @@
*.gz
snapshot.bat
tmp
+demopage.html
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>