Package org.vfny.geoserver.global.dto

Examples of org.vfny.geoserver.global.dto.StyleDTO


        if ((dto == null) || (dto.getStyles() == null)) {
            throw new NullPointerException("List of styles is required");
        }

        for (Iterator i = dto.getStyles().values().iterator(); i.hasNext();) {
            StyleDTO styleDTO = (StyleDTO) i.next();
            String id = styleDTO.getId();
            Style style;

            try {
                style = loadStyle(styleDTO.getFilename());
                //HACK: due to our crappy weird id shit we rename the style's specified
                //name with the id we (and our clients) refer to the style as.
                //Should redo style management to not make use of our weird ids, just
                //use the style's name out of the styles directory.
                style.setName(id);
            } catch (Exception ioException) { // was IOException
                LOGGER.log(Level.SEVERE, "Could not load style " + id,
                    ioException);

                continue;
            }

            stFiles.put(id, styleDTO.getFilename());
            map.put(id, style);
        }

        LOGGER.finer("returning styles " + map + "\n and set map " + stFiles);
View Full Code Here


        i = styles.keySet().iterator();

        while (i.hasNext()) {
            String id = (String) i.next();
            Style st = (Style) styles.get(id);
            StyleDTO sdto = new StyleDTO();
            sdto.setDefault(st.isDefault());
            sdto.setFilename((File) stFiles.get(id));
            sdto.setId(id);
            tmp.put(id, sdto);
        }

        LOGGER.finer("setting styles to: " + tmp);
        dto.setStyles(tmp);
View Full Code Here

        if (obj == null) {
            throw new NullPointerException(
                "Style Data Transfer Object required");
        }

        StyleDTO sDto = (StyleDTO) obj;
        id = sDto.getId();
        filename = new File(sDto.getFilename().toString());
        _default = sDto.isDefault();
    }
View Full Code Here

     * @return a copy of this classes data in a StyleDTO object.
     *
     * @see org.vfny.geoserver.config.DataStructure#toDTO()
     */
    public StyleDTO toDTO() {
        StyleDTO sDto = new StyleDTO();
        sDto.setDefault(_default);
        sDto.setFilename(new File(filename.toString()));
        sDto.setId(id);

        return sDto;
    }
View Full Code Here

        i = data.getStyles().keySet().iterator();

        while (i.hasNext()) {
            String s = (String) i.next();
            StyleDTO st = (StyleDTO) data.getStyles().get(s);

            if (st != null) {
                storeStyle(cw, st);
            }
        }
View Full Code Here

            stylesList = stylesElem.getElementsByTagName("style");
        }

        if ((stylesList == null) || (stylesList.getLength() == 0)) {
            //no styles where defined, just add a default one
            StyleDTO s = new StyleDTO();
            s.setId("normal");
            s.setFilename(new File(baseDir, "normal.sld"));
            s.setDefault(true);
            styles.put("normal", s);
        }

        int styleCount = stylesList.getLength();
        Element styleElem;

        for (int i = 0; i < styleCount; i++) {
            styleElem = (Element) stylesList.item(i);

            StyleDTO s = new StyleDTO();
            s.setId(ReaderUtils.getAttribute(styleElem, "id", true));
            s.setFilename(new File(baseDir,
                    ReaderUtils.getAttribute(styleElem, "filename", true)));
            s.setDefault(ReaderUtils.getBooleanAttribute(styleElem, "default",
                    false, false));
            styles.put(s.getId(), s);
           
            LOGGER.config("Loaded style " + s.getId());
        }

        return styles;
    }
View Full Code Here

  }

  private static Map createStyles(File baseDir) {
    Map map = new HashMap();

    StyleDTO dto = new StyleDTO();
    dto.setDefault(false);
    dto.setFilename(new File(baseDir, "default.sld"));
    dto.setId("default");
    map.put("default", dto);

    for (int i = 0; i < AbstractCiteDataTest.CITE_TYPE_NAMES.length; i++) {
      String typeName = AbstractCiteDataTest.CITE_TYPE_NAMES[i];
      String sldName = typeName + ".sld";
      File sldFile = new File(baseDir, sldName);
      if (!sldFile.exists()) {
        System.err.println("Style file not found, unsing default.sld: "
            + sldFile);
        continue;
      }
      dto = new StyleDTO();
      dto.setDefault(false);
      dto.setFilename(sldFile);
      dto.setId(typeName);
      map.put(typeName, dto);
    }
    return map;
  }
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.global.dto.StyleDTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.