- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 19 Aug 2009 18:57:14 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/parameters
In directory hutz:/tmp/cvs-serv25802/src/org/w3c/unicorn/tasklist/parameters
Modified Files:
Tag: dev2
ParameterType.java Parameter.java ParameterFactory.java
Added Files:
Tag: dev2
DropdownListParameter.java
Log Message:
added a new parameter display: dropdown list (select with multiple choices)
Index: ParameterFactory.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/parameters/Attic/ParameterFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- ParameterFactory.java 11 Aug 2009 16:05:34 -0000 1.1.2.1
+++ ParameterFactory.java 19 Aug 2009 18:57:12 -0000 1.1.2.2
@@ -26,6 +26,8 @@
return new CheckboxListParameter();
case TParamType.INT_DROPDOWN:
return new DropDownParameter();
+ case TParamType.INT_DROPDOWNLIST:
+ return new DropdownListParameter();
case TParamType.INT_RADIO:
return new RadioParameter();
case TParamType.INT_TEXTAREA:
--- NEW FILE: DropdownListParameter.java ---
// $Id: DropdownListParameter.java,v 1.1.2.1 2009/08/19 18:57:12 tgambet Exp $
// Author: Jean-Guilhem Rouel
// (c) COPYRIGHT MIT, ERCIM and Keio, 2006.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.unicorn.tasklist.parameters;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* DropdownListParameter<br />
* Created: Aug 19, 2009<br />
*
* @author Jean-Guilhem ROUEL, Thomas GAMBET
*/
public class DropdownListParameter extends Parameter {
private Map<String, Value> mapOfValue;
private Map<String, Value> mapOfDefaultValue;
/**
* Default constructor for a CheckboxListParameter (see Parameter default
* constructor).
*/
protected DropdownListParameter() {
super();
Parameter.logger.trace("Constructor()");
}
/**
* Adds a Value object to the mapOfValue.
*
* @param aValue
* The value to add.
*/
@Override
public void addValue(final Value aValue) {
this.mapOfValue.put(aValue.getName(), aValue);
}
/**
* Finds a Value object in the map given its name.
*
* @param sName
* The name of the Value.
* @return The Value object if the String corresponds to a key.
*/
@Override
public Value getValue(final String sName) {
return this.mapOfValue.get(sName);
}
/*
* (non-Javadoc)
*
* @see org.w3c.unicorn.tasklist.parameters.Parameter#getDefault()
*/
@Override
public Map<String, Value> getMapOfDefaultValue() {
return this.mapOfDefaultValue;
}
/**
* Sets the default Value in the mapOfDefaultValue.
*
* @param sDefaultValues
* The new default value.
*/
@Override
public void setDefaultValues(final String sDefaultValues) {
this.mapOfDefaultValue = new LinkedHashMap<String, Value>();
for (String sDefault : sDefaultValues.split(",")) {
sDefault = sDefault.trim();
final Value aValue = this.mapOfValue.get(sDefault);
if (aValue != null) {
this.mapOfDefaultValue.put(sDefault, aValue);
} else {
Parameter.logger.error("The default value " + sDefault
+ " is not a valid value.");
}
}
}
/*
* (non-Javadoc)
*
* @see org.w3c.unicorn.tasklist.parameters.Parameter#getValues()
*/
@Override
public Map<String, Value> getMapOfValue() {
return this.mapOfValue;
}
/**
* Defines or replaces the mapOfValue.
*
* @param mapOfValue
* The new map of values.
*/
@Override
public void setMapOfValue(final Map<String, Value> mapOfValue) {
this.mapOfValue = mapOfValue;
}
/**
* Returns the type of the parameter.
*
* @return The type DROPDOWNLIST.
*/
@Override
public ParameterType getType() {
return ParameterType.DROPDOWNLIST;
}
/**
* Merges a Parameter with this one if the type complies.
*
* @param aParameter
* The parameter to merge with the current one.
* @return True if they merged correctly, else false.
*/
@Override
public boolean merge(final Parameter aParameter) {
Parameter.logger.trace("merge");
// Types must match
if (!(aParameter instanceof DropdownListParameter)) {
Parameter.logger.warn("Type of parameter " + this.getName()
+ " and " + aParameter.getName() + " not matching.");
return false;
}
if (!super.merge(aParameter)) {
return false;
}
final DropdownListParameter aDropdownListParameter = (DropdownListParameter) aParameter;
for (final Value aValue : aDropdownListParameter.getMapOfValue()
.values()) {
final Value aLocalValue = this.getValue(aValue.getName());
if (null == aLocalValue) {
this.addValue(aValue);
continue;
}
for (final String sLocale : aValue.getLongName().getSetOfLocale()) {
if (!aLocalValue.hasLongName(sLocale)) {
aLocalValue.addLongName(sLocale, aValue
.getLongName(sLocale));
continue;
}
}
for (final String sValue : aValue.getMapOfMapping().keySet()) {
if (!aLocalValue.hasMapping(sValue)) {
aLocalValue.addListOfMapping(sValue, aValue
.getListOfMapping(sValue));
}
}
}
return true;
}
}
Index: ParameterType.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/parameters/Attic/ParameterType.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- ParameterType.java 11 Aug 2009 16:05:33 -0000 1.1.2.1
+++ ParameterType.java 19 Aug 2009 18:57:11 -0000 1.1.2.2
@@ -12,9 +12,9 @@
*/
public enum ParameterType {
- CHECKBOX("checkbox"), CHECKBOXLIST("checkboxlist"), DROPDOWN("dropdownlist"), RADIO(
+ CHECKBOX("checkbox"), CHECKBOXLIST("checkboxlist"), DROPDOWN("dropdown"), RADIO(
"radio"), TEXTAREA("textarea"), TEXTFIELD("textfield"), UNKNOWN(
- "unknown");
+ "unknown"), DROPDOWNLIST("dropdownlist");
private final String sValue;
Index: Parameter.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/parameters/Attic/Parameter.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Parameter.java 11 Aug 2009 16:05:33 -0000 1.1.2.1
+++ Parameter.java 19 Aug 2009 18:57:11 -0000 1.1.2.2
@@ -192,7 +192,7 @@
@Override
public String toString() {
final int iStringBufferSize = 1000;
- final String sVariableSeparator = " ";
+ final String sVariableSeparator = "\n";
final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize);
aStringBuffer.append("name:").append(sName);
Received on Wednesday, 19 August 2009 18:57:24 UTC