01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.form.data;
06:
07: import org.apache.struts.action.ActionErrors;
08: import org.apache.struts.action.ActionForm;
09: import org.apache.struts.action.ActionMapping;
10: import org.vfny.geoserver.config.DataConfig;
11: import java.util.ArrayList;
12: import java.util.Arrays;
13: import java.util.Collection;
14: import java.util.List;
15: import java.util.Set;
16: import javax.servlet.ServletContext;
17: import javax.servlet.http.HttpServletRequest;
18:
19: /**
20: * DOCUMENT ME!
21: *
22: * @author User To change the template for this generated type comment go to
23: * Window - Preferences - Java - Code Generation - Code and Comments
24: */
25: public class DataFeatureTypesSelectForm extends ActionForm {
26: private String selectedFeatureTypeName;
27: private String buttonAction;
28:
29: public void reset(ActionMapping arg0, HttpServletRequest arg1) {
30: super .reset(arg0, arg1);
31: selectedFeatureTypeName = "";
32: }
33:
34: public ActionErrors validate(ActionMapping mapping,
35: HttpServletRequest request) {
36: ActionErrors errors = new ActionErrors();
37:
38: return errors;
39: }
40:
41: /**
42: * DOCUMENT ME!
43: *
44: * @return Returns the selectedFeatureTypeName.
45: */
46: public String getSelectedFeatureTypeName() {
47: return selectedFeatureTypeName;
48: }
49:
50: /**
51: * DOCUMENT ME!
52: *
53: * @param selectedFeatureTypeName The selectedFeatureTypeName to set.
54: */
55: public void setSelectedFeatureTypeName(
56: String selectedFeatureTypeName) {
57: this .selectedFeatureTypeName = selectedFeatureTypeName;
58: }
59:
60: public List getTypeNames() {
61: ServletContext context = getServlet().getServletContext();
62: DataConfig config = (DataConfig) context
63: .getAttribute(DataConfig.CONFIG_KEY);
64:
65: ArrayList ret = new ArrayList(config.getFeaturesTypes()
66: .keySet());
67: Object[] sortable = ret.toArray();
68: Arrays.sort(sortable);
69:
70: return Arrays.asList(sortable);
71: }
72:
73: /**
74: * Access buttonAction property.
75: *
76: * @return Returns the buttonAction.
77: */
78: public String getButtonAction() {
79: return buttonAction;
80: }
81:
82: /**
83: * Set buttonAction to buttonAction.
84: *
85: * @param buttonAction The buttonAction to set.
86: */
87: public void setButtonAction(String buttonAction) {
88: this.buttonAction = buttonAction;
89: }
90: }
|