001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005: package org.vfny.geoserver.form.wcs;
006:
007: import org.apache.struts.action.ActionErrors;
008: import org.apache.struts.action.ActionForm;
009: import org.apache.struts.action.ActionMapping;
010: import org.opengis.coverage.grid.Format;
011: import org.vfny.geoserver.util.CoverageStoreUtils;
012: import java.util.ArrayList;
013: import java.util.Iterator;
014: import java.util.List;
015: import java.util.regex.Pattern;
016: import javax.servlet.http.HttpServletRequest;
017:
018: /**
019: * DOCUMENT ME!
020: *
021: * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
022: * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
023: */
024: public class DataCoveragePluginsForm extends ActionForm {
025: private static final Pattern idPattern = Pattern.compile("^\\a$");
026:
027: /**
028: *
029: */
030: private List formats;
031:
032: /**
033: *
034: */
035: private List formatDescriptions;
036:
037: /**
038: *
039: */
040: private List formatIDs;
041:
042: /**
043: * Default state of New form
044: *
045: * @param mapping DOCUMENT ME!
046: * @param request DOCUMENT ME!
047: */
048: public void reset(ActionMapping mapping, HttpServletRequest request) {
049: super .reset(mapping, request);
050: formats = CoverageStoreUtils.listDataFormats();
051: formatDescriptions = new ArrayList();
052: formatIDs = new ArrayList();
053:
054: Format fTmp;
055:
056: for (Iterator i = formats.iterator(); i.hasNext();) {
057: fTmp = (Format) i.next();
058: formatDescriptions.add(fTmp.getDescription());
059: formatIDs.add(fTmp.getName());
060: }
061: }
062:
063: /**
064: * Check NewForm for correct use
065: *
066: * @param mapping DOCUMENT ME!
067: * @param request DOCUMENT ME!
068: *
069: * @return DOCUMENT ME!
070: */
071: public ActionErrors validate(ActionMapping mapping,
072: HttpServletRequest request) {
073: ActionErrors errors = new ActionErrors();
074:
075: return errors;
076: }
077:
078: /*
079: * Allows the JSP page to easily access the list of dataFormat Descriptions
080: */
081: public List getFormatDescriptions() {
082: return formatDescriptions;
083: }
084:
085: public void setFormatDescriptions(List desc) {
086: formatDescriptions = desc;
087: }
088:
089: /**
090: *
091: */
092: public List getFormatIDs() {
093: return formatIDs;
094: }
095:
096: public void setFormatIDs(List ids) {
097: formatIDs = ids;
098: }
099:
100: /**
101: *
102: */
103: public List getFormats() {
104: return formats;
105: }
106:
107: public void setFormats(List f) {
108: formats = f;
109: }
110: }
|