# HG changeset patch # User Tim Englich # Date 1268744576 0 # Node ID a5e860f17a52490bd5b8d98cef231d81fcd082d1 # Parent b81f6f8966688705ae56cc4a4ec76465ce508586 Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues. gnv-artifacts/trunk@787 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b81f6f896668 -r a5e860f17a52 gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Tue Mar 16 12:55:58 2010 +0000 +++ b/gnv-artifacts/ChangeLog Tue Mar 16 13:02:56 2010 +0000 @@ -1,3 +1,13 @@ +2010-03-16 Tim Englich + + * src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java: + Added an new State wich will handle the Display of Coordinatevalues and + fetch given Inputparameters from the Presettings and copy them to + the InputValues. + This new Class is necessary because we can have Pointobjects given in + the Presettings which should be used to fetch all MeshPoints within a + given Distance aroud the Coordinate and display its Coordindatevalues. + 2010-03-16 Tim Englich * src/main/java/de/intevation/gnv/utils/InputValidator.java (getPointValue): diff -r b81f6f896668 -r a5e860f17a52 gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java Tue Mar 16 13:02:56 2010 +0000 @@ -0,0 +1,76 @@ +/** + * + */ +package de.intevation.gnv.state; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import de.intevation.artifactdatabase.Config; +import de.intevation.artifacts.CallContext; +import de.intevation.gnv.state.exception.StateException; + +/** + * @author Tim Englich + * + */ +public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState { + + + /** + * The UID of this Class. + */ + private static final long serialVersionUID = -3972304838976884048L; + + private String transferPreSettingsName = null; + + private String transferInputDataname = null; + /** + * Constructor + */ + public PreSettingsTransferCoordinateSelectionState() { + super(); + } + + /** + * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext) + */ + @Override + public void initialize(String uuid, CallContext context) + throws StateException { + Map preSettings = this.getPreSettings(); + if (preSettings != null){ + InputData ip = preSettings.get(transferPreSettingsName); + if (ip != null){ + Collection localInputdata = new ArrayList(1); + localInputdata.add(new DefaultInputData(transferInputDataname, + ip.getValue())); + this.putInputData(localInputdata, uuid); + } + } + + super.initialize(uuid, context); + } + + /** + * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) + */ + @Override + public void setup(Node configuration) { + + Element preSettingsNode = (Element)Config.getNodeXPath(configuration, + "presettings-transfer"); + if (preSettingsNode != null){ + this.transferPreSettingsName = preSettingsNode.getAttribute("presetting"); + this.transferInputDataname = preSettingsNode.getAttribute("inputvalue"); + } + super.setup(configuration); + } + + + +}