⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typeseditorform.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                buf.append(" ");
            }
        }

        this.keywords = buf.toString();

        metadataLinks = new MetaDataLink[2];
        metadataLinks[0] = new MetaDataLink();
        metadataLinks[0].setType("text/plain");
        metadataLinks[1] = new MetaDataLink();
        metadataLinks[1].setType("text/plain");

        if ((type.getMetadataLinks() != null) && (type.getMetadataLinks().size() > 0)) {
            List links = new ArrayList(type.getMetadataLinks());
            MetaDataLink link = (MetaDataLink) links.get(0);
            metadataLinks[0] = new MetaDataLink(link);

            if (links.size() > 1) {
                link = (MetaDataLink) links.get(1);
                metadataLinks[1] = new MetaDataLink(link);
            }
        }

        styles = new TreeSet();

        for (Iterator i = config.getStyles().values().iterator(); i.hasNext();) {
            StyleConfig sc = (StyleConfig) i.next();
            styles.add(sc.getId());

            if (sc.isDefault()) {
                if ((styleId == null) || styleId.equals("")) {
                    styleId.equals(sc.getId());
                }
            }
        }

        typeStyles = new TreeSet();

        for (Iterator i = type.getStyles().iterator(); i.hasNext();) {
            String styleName = (String) i.next();
            typeStyles.add(styleName);
        }

        Object attribute = styles;

        if (attribute instanceof org.vfny.geoserver.form.data.AttributeDisplay) {
            ;
        }
    }

    private Object lookUpAttribute(String name) {
        for (Iterator i = attributes.iterator(); i.hasNext();) {
            Object attribute = i.next();

            if (attribute instanceof AttributeDisplay
                    && name.equals(((AttributeDisplay) attribute).getName())) {
                return attribute;
            }

            if (attribute instanceof AttributeForm
                    && name.equals(((AttributeForm) attribute).getName())) {
                return attribute;
            }
        }

        return null;
    }

    /**
     * Create a List of AttributeDisplay based on AttributeTypeInfoDTO.
     *
     * @param dtoList
     *
     * @return
     */
    private List attributesDisplayList(List dtoList) {
        List list = new ArrayList();
        int index = 0;

        for (Iterator i = dtoList.iterator(); i.hasNext(); index++) {
            Object next = i.next();
            //System.out.println(index + " attribute: " + next);
            list.add(new AttributeDisplay(new AttributeTypeInfoConfig((AttributeTypeInfoDTO) next)));
        }

        return list;
    }

    /**
     * Create a List of AttributeForm based on AttributeTypeInfoDTO.
     *
     * @param dtoList
     * @param schema DOCUMENT ME!
     *
     * @return
     */
    private List attributesFormList(List dtoList, FeatureType schema) {
        List list = new ArrayList();

        for (Iterator i = dtoList.iterator(); i.hasNext();) {
            AttributeTypeInfoConfig config = (AttributeTypeInfoConfig) i.next();
            list.add(new AttributeForm(config, schema.getAttributeType(config.getName())));
        }

        return list;
    }

    /**
     * Generate DTO attributes List for the TypesEditorAction.
     *
     * <p>
     * This list only includes entries defined by the user, not those generated
     * by the schemaBase.
     * </p>
     *
     * <p>
     * If the user has chosen -- then this list will be <code>null</code>.
     * </p>
     *
     * @return List of user supplied AttributeTypeInfoConfig, or
     *         <code>null</code>
     */
    public List toSchemaAttributes() {
        if ((schemaBase == null) || schemaBase.equals("--")) {
            return null;
        }

        List list = new ArrayList();

        for (Iterator i = attributes.iterator(); i.hasNext();) {
            Object obj = i.next();

            if (obj instanceof AttributeForm) {
                AttributeForm form = (AttributeForm) obj;
                list.add(form.toConfig());
            }
        }

        return list;
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();

        Locale locale = (Locale) request.getLocale();

        //MessageResources messages = servlet.getResources();
        //TODO: not sure about this, changed for struts 1.2.8 upgrade
        MessageResources messages = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY);
        final String BBOX = HTMLEncoder.decode(messages.getMessage(locale,
                    "config.data.calculateBoundingBox.label"));
        final String SLDWIZARD = HTMLEncoder.decode(messages.getMessage(locale,
                    "config.data.sldWizard.label"));
        final String LOOKUP_SRS = HTMLEncoder.decode(messages.getMessage(locale,
                    "config.data.lookupSRS.label"));

        // If autoGenerateExtent flag is not set, don't break.
        if (autoGenerateExtent == null) {
            autoGenerateExtent = "false";
        }

        // Pass Attribute Management Actions through without
        // much validation.
        if (action.startsWith("Up") || action.startsWith("Down") || action.startsWith("Remove")
                || action.equals(BBOX) || action.equals(SLDWIZARD) || action.equals(LOOKUP_SRS)) {
            return errors;
        }

        // Check selected style exists
        DataConfig data = ConfigRequests.getDataConfig(request);

        if (!(data.getStyles().containsKey(styleId) || "".equals(styleId))) {
            errors.add("styleId", new ActionError("error.styleId.notFound", styleId));
        }

        // check name exists in current DataStore?
        if (!autoGenerateExtent.equals("true")) {
            if (("".equals(minX) || "".equals(minY) || "".equals(maxX) || "".equals(maxY))) {
                errors.add("latlongBoundingBox", new ActionError("error.latLonBoundingBox.required"));
            } else {
                try {
                    Double.parseDouble(minX);
                    Double.parseDouble(minY);
                    Double.parseDouble(maxX);
                    Double.parseDouble(maxY);
                } catch (NumberFormatException badNumber) {
                    errors.add("latlongBoundingBox",
                        new ActionError("error.latLonBoundingBox.invalid", badNumber));
                }
            }
        }

        if (isCachingEnabled()) {
            try {
                Integer.parseInt(cacheMaxAge);
            } catch (NumberFormatException nfe) {
                errors.add("cacheMaxAge", new ActionError("error.cacheMaxAge.malformed", nfe));
            } catch (Throwable t) {
                errors.add("cacheMaxAge", new ActionError("error.cacheMaxAge.error", t));
            }
        }

        return errors;
    }

    /**
     * Are belong to us.
     *
     * <p>
     * What can I say it is near a deadline! Easy access for
     * <code>Editor.jsp</code>.
     * </p>
     *
     * @return Possible schemaBase options
     */
    public List getAllYourBase() {
        return schemaBases;
    }

    public List getAllMetadataURLTypes() {
        return allMetadataURLTypes;
    }

    //
    // Generated Accessors for Editor.jsp
    //

    /**
     * Access attributes property.
     *
     * @return Returns the attributes.
     */
    public List getAttributes() {
        return attributes;
    }

    /**
     * Set attributes to attributes.
     *
     * @param attributes The attributes to set.
     */
    public void setAttributes(List attributes) {
        this.attributes = attributes;
    }

    /**
     * Access dataStoreId property.
     *
     * @return Returns the dataStoreId.
     */
    public String getDataStoreId() {
        return dataStoreId;
    }

    /**
     * Set dataStoreId to dataStoreId.
     *
     * @param dataStoreId The dataStoreId to set.
     */
    public void setDataStoreId(String dataStoreId) {
        this.dataStoreId = dataStoreId;
    }

    /**
     * Access abstact (or description) property.
     *
     * @return Returns the description.
     */
    public String getAbstract() {
        return description;
    }

    /**
     * Set abstact (or description) to description.
     *
     * @param description The description to set.
     */
    public void setAbstract(String description) {
        this.description = description;
    }

    /**
     * Access keywords property.
     *
     * @return Returns the keywords.
     */
    public String getKeywords() {
        return keywords;
    }

    /**
     * Set keywords to keywords.
     *
     * @param keywords The keywords to set.
     */
    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public MetaDataLink getMetadataLink(int index) {
        return metadataLinks[index];
    }

    /**
     * Access name property.
     *
     * @return Returns the name.
     */
    public String getTypeName() {
        return typeName;
    }

    /**
     * Set name to name.
     *
     * @param name The name to set.
     */
    public void setTypeName(String name) {
        this.typeName = name;
    }

    /**
     * Access schemaBase property.
     *
     * @return Returns the schemaBase.
     */
    public String getSchemaBase() {
        return schemaBase;
    }

    /**
     * Set schemaBase to schemaBase.
     *
     * @param schemaBase The schemaBase to set.
     */
    public void setSchemaBase(String schemaBase) {
        this.schemaBase = schemaBase;
    }

    /**
     * Access sRS property.
     *
     * @return Returns the sRS.
     */
    public String getSRS() {
        return SRS;
    }

    /**
     * Access SRSWKT property.  There is no setSRSWKT() because its derived from the SRS id.
     *
     * @return Returns the sRS.
     */
    public String getSRSWKT() {
        return SRSWKT;
    }
    
    /**
     * Access SRSWKT property.  There is no setSRSWKT() because its derived from the SRS id.
     *
     * @return Returns the sRS.
     */
    public String getNativeSRSWKT() {
        return nativeSRSWKT;
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -