morciuch 2002/08/20 10:37:18
Added: src/java/org/apache/jetspeed/modules/parameters
CheckBox.java CheckBoxGroup.java ListBox.java
ParameterPresentationStyle.java
ParameterPresentationStyleFactory.java
TextArea.java
Log:
Initial check in (see Bugzilla issue 11697)
Revision Changes Path
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/CheckBox.java
Index: CheckBox.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
//turbine support
import org.apache.turbine.util.RunData;
// java stuff
import java.util.Map;
// ecs stuff
import org.apache.ecs.html.Input;
/**
* Returns check box control intialized with the value parameter.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: CheckBox.java,v 1.1 2002/08/20 17:37:17 morciuch Exp $
*/
public class CheckBox extends ParameterPresentationStyle
{
public static final String ROWS = "rows";
public static final String COLS = "cols";
/**
* Returns presentation control
*/
public String getContent(RunData data, String name, String value, Map parms)
{
Input cb = new Input(Input.CHECKBOX, name, 1);
cb.setChecked(new Boolean(value).booleanValue());
return cb.toString();
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/CheckBoxGroup.java
Index: CheckBoxGroup.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
//ecs stuff
import org.apache.ecs.ElementContainer;
import org.apache.ecs.html.Table;
import org.apache.ecs.html.Input;
import org.apache.ecs.html.TD;
import org.apache.ecs.html.TR;
// java stuff
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.Map;
import java.util.Enumeration;
//turbine support
import org.apache.turbine.util.RunData;
/**
* Returns a group of check boxes using the following options:
* <UL>
* <LI><code>items</code>: list of comma-delimited check box names</LI>
* <LI><code>layout</code> [$northsouth|<strong>$eastwest</strong>]: presentation
layout</LI>
* </UL>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: CheckBoxGroup.java,v 1.1 2002/08/20 17:37:17 morciuch Exp $
*/
public class CheckBoxGroup extends ParameterPresentationStyle
{
public static final String ITEMS = "items";
public static final String LAYOUT = "layout";
public static final String LAYOUT_EW = "$eastwest";
public static final String LAYOUT_NS = "$northsouth";
/**
* Returns presentation control
*/
public String getContent(RunData data, String name, String value, Map parms)
{
ElementContainer result = new ElementContainer();
String items = (String)parms.get(this.ITEMS);
String layout = (String)parms.get(this.LAYOUT);
StringTokenizer st = new StringTokenizer(items, ",");
Vector v = new Vector();
while ( st.hasMoreTokens() )
{
String token = st.nextToken().trim();
if ( !token.equalsIgnoreCase("") )
{
v.add(token);
}
}
Table t = new Table();
for ( Enumeration e = v.elements(); e.hasMoreElements(); )
{
String item = ((String)e.nextElement()).trim();
Input cb = new Input(Input.CHECKBOX, item, item);
cb.setChecked(value.indexOf(item) >= 0);
cb.setOnClick(getJavascript(name, v));
ElementContainer temp = new ElementContainer();
temp.addElement(cb).addElement(" ").addElement(item);
if ( layout.equalsIgnoreCase(this.LAYOUT_NS) )
{
t.addElement(new TR().addElement(new TD(temp)));
} else
{
result.addElement(temp);
}
}
if ( layout.equalsIgnoreCase(this.LAYOUT_NS) )
{
result.addElement(t);
}
result.addElement(new Input(Input.HIDDEN, name, value));
return result.toString();
}
/**
*
* @param name
* @param v
* @return string
*/
private String getJavascript(String name, Vector v)
{
StringBuffer result = new StringBuffer();
result.append(name).append(".value = ");
for ( Enumeration e = v.elements(); e.hasMoreElements(); )
{
String item = (String)e.nextElement();
result.append("((");
result.append(item);
result.append(".checked) ? ");
result.append(item);
result.append(".value : '')");
if ( e.hasMoreElements() )
{
result.append(" + \',\' + ");
}
}
return result.toString();
}
/**
* Test method
*/
public static void main(String args[])
{
CheckBoxGroup cbg = new CheckBoxGroup();
java.util.Hashtable parms = new java.util.Hashtable();
parms.put(ITEMS,
"Tomaszewski,Gorgon,Zmuda,Szymanowski,Musial,Kasperczak,Deyna,Cmikiewicz,Lato,Szarmach,Gadocha");
System.out.println(cbg.getContent(null, "test",
"Deyna,,,,Gorgon,Lato,Szarmach,", parms));
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/ListBox.java
Index: ListBox.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
//ecs stuff
import org.apache.ecs.html.Select;
import org.apache.ecs.html.Option;
// java stuff
import java.util.Map;
import java.util.Arrays;
import java.util.StringTokenizer;
//turbine support
import org.apache.turbine.util.RunData;
/**
* Returns simple list box control.
* <p>Options:
* <UL>
* <LI><code>items</code> - comma-separated list of list box items</LI>
* <LI><code>layout</code> [<strong>$combo</strong>|$list] - combo box vs list
box</LI>
* <LI><code>size</code> - size of the list box for $list style</LI>
* <LI><code>sort</code> [<strong>false</strong>|true] - return sorted list of
items</LI>
* <LI><code>multiplechoice</code> [<strong>false</strong>|true] - allow multiple
selections</LI>
* <LI><code>null-if-empty</code> [<strong>false</strong>|true] - do not return a
select control if item list is empty</LI>
* </UL>
* @author <a href="[EMAIL PROTECTED]">Mark Orciuch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Trapp</a>
* @version $Id: ListBox.java,v 1.1 2002/08/20 17:37:17 morciuch Exp $
*/
public class ListBox extends ParameterPresentationStyle
{
public static final String SORT = "sort";
public static final String ITEMS = "items";
public static final String LAYOUT = "layout";
public static final String LAYOUT_COMBO = "$combo";
public static final String LAYOUT_LIST = "$list";
public static final String LIST_SIZE = "listsize";
public static final String MULTIPLE_CHOICE = "multiplechoice";
public static final String NULL_IF_EMPTY = "null-if-empty";
String layout = null;
String items[] = null;
String size = null;
boolean multiple = false;
/**
* Returns presentation control
*
* @param data
* @param name
* @param value
* @param parms
* @return string
*/
public String getContent(RunData data, String name, String value, Map parms)
{
init(data);
Select select = null;
if ( layout.equalsIgnoreCase(this.LAYOUT_LIST) )
{
select = new Select(name, new Integer(size).intValue());
} else
{
select = new Select(name);
}
if ( multiple )
{
select.setMultiple(multiple);
}
if ( items != null )
{
boolean sort = new Boolean((String)this.getParm(this.SORT,
"false")).booleanValue();
if ( sort )
{
Arrays.sort(items);
}
for ( int i=0; i < items.length; i++ )
{
Option option = new Option(items[i]).addElement(items[i]);
option.setSelected(items[i].equalsIgnoreCase(value));
select.addElement(option);
}
}
// If no items to display, do not display empty control
boolean nullIfEmpty = new Boolean((String)this.getParm(this.NULL_IF_EMPTY,
"false")).booleanValue();
if ( this.items == null || (nullIfEmpty && items.length == 0) )
{
return null;
}
return select.toString();
}
/**
* Initialize options
*
* @param data
*/
protected void init(RunData data)
{
this.layout = (String)this.getParm(this.LAYOUT, this.LAYOUT_COMBO);
this.items = this.getItems(data);
this.size = (String)this.getParm(this.LIST_SIZE, "1");
this.multiple = new Boolean((String)this.getParm(this.MULTIPLE_CHOICE,
"false")).booleanValue();
}
/**
* Parse items into an arrary of strings
*
* @param data
* @return string array
*/
protected String[] getItems(RunData data)
{
String[] result = null;
String list = (String)this.getParm(this.ITEMS, "");
StringTokenizer it = new StringTokenizer(list, ",");
int size = it.countTokens();
if ( size > 0 )
{
result = new String[size];
int i = 0;
while ( it.hasMoreTokens() )
{
String item = (String)it.nextToken();
result[i] = item;
i++;
}
}
return result;
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/ParameterPresentationStyle.java
Index: ParameterPresentationStyle.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
// Turbine support
import org.apache.turbine.modules.Assembler;
import org.apache.turbine.util.RunData;
// Java support
import java.util.Map;
/**
* Interface to be implemented by parameter presentation style class
*
* @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: ParameterPresentationStyle.java,v 1.1 2002/08/20 17:37:18 morciuch
Exp $
*/
public abstract class ParameterPresentationStyle extends Assembler
{
private Map styleparms = null;
/**
* Returns presentation method html fragment
*
* @param data run context info
* @param name name for the returned control
* @param value default value for the control
* @param parms hashtable with presentation parameters
* @return html for the control
*/
public abstract String getContent(RunData data, String name, String value, Map
parms);
/**
* Allows to initialize style parameter hashtable
*
* @param parms
*/
public void setParms(Map parms)
{
this.styleparms = parms;
}
/**
* Allows to retrieve a style parameter with default
*
* @param key
* @param def
* @return object
*/
public Object getParm(String key, Object def)
{
Object result = null;
if ( this.styleparms != null )
{
result = this.styleparms.get(key);
}
if ( result == null )
{
result = def;
}
return result;
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/ParameterPresentationStyleFactory.java
Index: ParameterPresentationStyleFactory.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
// Turbine Utility Classes
import org.apache.turbine.services.assemblerbroker.util.java.JavaBaseFactory;
import org.apache.turbine.modules.Assembler;
/**
* A parameter presentation method factory factory that attempts to load a java
class from
* the module packages defined in the TurbineResource.properties.
*
* @author <a href="[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: ParameterPresentationStyleFactory.java,v 1.1 2002/08/20 17:37:18
morciuch Exp $
*/
public class ParameterPresentationStyleFactory extends JavaBaseFactory
{
/**
* Retrieve named assembler instance
*
* @param name assembler name
* @return assembler instance
*/
public Assembler getAssembler(String name)
{
return getAssembler("parameters",name);
}
}
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/TextArea.java
Index: TextArea.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* 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/>.
*/
package org.apache.jetspeed.modules.parameters;
//turbine support
import org.apache.turbine.util.RunData;
// java stuff
import java.util.Map;
/**
* Returns texarea control intialized with the value parameter using the following
options:
* <UL>
* <LI><code>rows</code>: number of rows (default = 3)</LI>
* <LI><code>cols</code>: number of columns (default = 80)</LI>
*</UL>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: TextArea.java,v 1.1 2002/08/20 17:37:18 morciuch Exp $
*/
public class TextArea extends ParameterPresentationStyle
{
public static final String ROWS = "rows";
public static final String COLS = "cols";
/**
* Returns presentation control
*/
public String getContent(RunData data, String name, String value, Map parms)
{
String rows = (String)this.getParm(this.ROWS, "3");
String cols = (String)this.getParm(this.COLS, "80");
org.apache.ecs.html.TextArea tx = new org.apache.ecs.html.TextArea(name,
rows, cols).addElement(value);
return tx.toString();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>