felix@2306: package de.intevation.flys.artifacts.states; felix@2306: raimund@3721: import org.apache.log4j.Logger; raimund@3721: import org.w3c.dom.Element; raimund@3721: raimund@3721: import de.intevation.artifacts.Artifact; felix@2312: import de.intevation.artifacts.CallContext; felix@2312: import de.intevation.artifacts.common.utils.StringUtils; raimund@3721: import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; raimund@3721: import de.intevation.flys.artifacts.WINFOArtifact; felix@2312: felix@2312: felix@2306: /** felix@2306: * Get me doubles (km). felix@2306: */ felix@2306: public class EnterMultipleLocationsState extends EnterLocationState { raimund@3721: /** The logger for this class. */ raimund@3721: private static Logger logger = Logger.getLogger(EnterMultipleLocationsState.class); felix@2306: felix@2306: @Override felix@2306: protected String getUIProvider() { raimund@3721: logger.debug("multi location panel"); felix@2306: return "multi_location_panel"; felix@2306: } felix@2312: sascha@3076: felix@2312: /** Deal with multiple double values. */ felix@2312: @Override felix@2312: protected String getLabelFor( felix@2312: CallContext cc, felix@2312: String name, felix@2312: String value, felix@2312: String type felix@2312: ) { felix@2312: String label = ""; felix@2312: String[] vals = value.split(" "); felix@2312: for (int i = 0; i < vals.length; i++) { felix@2312: vals[i] = super.getLabelFor(cc, name, vals[i], type); felix@2312: } felix@2312: felix@2314: return StringUtils.join(" ", vals); felix@2312: } raimund@3721: raimund@3721: /** raimund@3721: * This method creates a list of items. These items represent the amount of raimund@3721: * input data that is possible for this state. raimund@3721: * raimund@3721: * @param cr The ElementCreator. raimund@3721: * @param name The name of the amount of data. raimund@3721: * raimund@3721: * @return a list of items. raimund@3721: */ raimund@3721: @Override raimund@3721: protected Element[] createItems( raimund@3721: ElementCreator cr, raimund@3721: Artifact artifact, raimund@3721: String name, raimund@3721: CallContext context raimund@3721: ) { raimund@3721: if (name.equals("reference_endpoint")) { raimund@3721: Element[] elements = new Element[1]; raimund@3721: WINFOArtifact winfo = (WINFOArtifact) artifact; raimund@3721: Double km = winfo.getReferenceStartKm(); raimund@3721: elements[0] = createItem( raimund@3721: cr, raimund@3721: new String[] {"start_km", km.toString()}); raimund@3721: return elements; raimund@3721: } raimund@3721: return null; raimund@3721: } raimund@3721: felix@2306: } felix@2306: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :