001: /*
002: * Created on Jan 22, 2004
003: *
004: * To change the template for this generated file go to
005: * Window - Preferences - Java - Code Generation - Code and Comments
006: */
007: package org.vfny.geoserver.form.validation;
008:
009: import org.apache.struts.action.ActionErrors;
010: import org.apache.struts.action.ActionForm;
011: import org.apache.struts.action.ActionMapping;
012: import org.vfny.geoserver.config.validation.ValidationConfig;
013: import java.util.SortedSet;
014: import java.util.TreeSet;
015: import javax.servlet.ServletContext;
016: import javax.servlet.http.HttpServletRequest;
017:
018: /**
019: * ValidationTestSuiteSelectForm purpose.
020: * <p>
021: * Used to store data coming in from the web form, to be passed to
022: * the ValidationTestSuiteSelectAction.
023: * </p>
024: *
025: * @author rgould, Refractions Research, Inc.
026: * @author $Author: dmzwiers $ (last modification)
027: * @version $Id: ValidationTestSuiteSelectForm.java 6177 2007-02-19 10:11:27Z aaime $
028: */
029: public class ValidationTestSuiteSelectForm extends ActionForm {
030: private String selectedTestSuite;
031: private String buttonAction;
032:
033: public void reset(ActionMapping arg0, HttpServletRequest request) {
034: super .reset(arg0, request);
035:
036: selectedTestSuite = "";
037: buttonAction = "";
038: }
039:
040: public ActionErrors validate(ActionMapping mapping,
041: HttpServletRequest request) {
042: ActionErrors errors = new ActionErrors();
043:
044: return errors;
045: }
046:
047: public SortedSet getTestSuites() {
048: try {
049: ServletContext context = getServlet().getServletContext();
050: ValidationConfig validationConfig = (ValidationConfig) context
051: .getAttribute(ValidationConfig.CONFIG_KEY);
052:
053: if ((validationConfig != null)
054: && (validationConfig.getTestSuiteNames() != null)) {
055: return new TreeSet(validationConfig.getTestSuiteNames());
056: }
057: } catch (Exception e) {
058: e.printStackTrace();
059: }
060:
061: return new TreeSet();
062: }
063:
064: /**
065: * Access selectedTestSuite property.
066: *
067: * @return Returns the selectedTestSuite.
068: */
069: public String getSelectedTestSuite() {
070: if (selectedTestSuite != null) {
071: return selectedTestSuite;
072: }
073:
074: return "";
075: }
076:
077: /**
078: * Set selectedTestSuite to selectedTestSuite.
079: *
080: * @param selectedTestSuite The selectedTestSuite to set.
081: */
082: public void setSelectedTestSuite(String selectedTestSuite) {
083: this .selectedTestSuite = selectedTestSuite;
084: }
085:
086: /**
087: * Access buttonAction property.
088: *
089: * @return Returns the buttonAction.
090: */
091: public String getButtonAction() {
092: return buttonAction;
093: }
094:
095: /**
096: * Set buttonAction to buttonAction.
097: *
098: * @param buttonAction The buttonAction to set.
099: */
100: public void setButtonAction(String buttonAction) {
101: this.buttonAction = buttonAction;
102: }
103: }
|