Examples of StyleConfig


Examples of org.vfny.geoserver.config.StyleConfig

        // Need locale wording for edit and delete
        final String EDIT = HTMLEncoder.decode(messages.getMessage(locale, "label.edit"));
        final String DELETE = HTMLEncoder.decode(messages.getMessage(locale, "label.delete"));
        final String DEFAULT = HTMLEncoder.decode(messages.getMessage(locale, "label.default"));
       
        StyleConfig style = config.getStyle( styleId );
        if( style == null ){
            ActionErrors errors = new ActionErrors();
            errors.add("selectedStyle",
                new ActionError("error.style.invalid", styleId ));           
            request.setAttribute(Globals.ERROR_KEY, errors);           
            return mapping.findForward("config.data.style");
        }
        // Something is selected lets do the requested action
        //
        if (action.equals(DELETE)) {
            config.removeStyle( styleId );
            getApplicationState().notifyConfigChanged();
            selectForm.setSelectedStyle(null);
            selectForm.reset(mapping, request);
            return mapping.findForward("config.data.style");
        }
        if (action.equals(DEFAULT)) {
          Map m = config.getStyles();
          Iterator i = m.values().iterator();
          while(i.hasNext()){
            StyleConfig sc = (StyleConfig)i.next();
            if(sc.isDefault()){
              if(sc.getId()!=null && !sc.getId().equals(styleId)){
                sc.setDefault(false);
                      getApplicationState().notifyConfigChanged();
              }
            }else{
              if(sc.getId()!=null && sc.getId().equals(styleId)){
                sc.setDefault(true);
                      getApplicationState().notifyConfigChanged();
              }
            }
          }
            selectForm.setSelectedStyle(null);
            selectForm.reset(mapping, request);
            return mapping.findForward("config.data.style");
        }
        if( action.equals(EDIT)){
            user.setStyle( new StyleConfig( style ) );
            return mapping.findForward("config.data.style.editor");           
        }
        ActionErrors errors = new ActionErrors();
        errors.add("submit",
            new ActionError("error.action.invalid", action ));           
View Full Code Here

Examples of org.vfny.geoserver.config.StyleConfig

                new ActionError("error.style.exists", styleID ));           
            request.setAttribute(Globals.ERROR_KEY, errors);           
            return mapping.findForward("config.data.style.new");
        }
        // Set up new StyleConfig
        StyleConfig style = new StyleConfig();
        style.setId( styleID );
        style.setDefault( config.getStyles().isEmpty() );
       
        // Pass style over to the Editor
        user.setStyle( style );       
        return mapping.findForward("config.data.style.editor");
    }
View Full Code Here

Examples of org.vfny.geoserver.config.StyleConfig

        styles = new TreeSet();
        Iterator i = config.getStyles().values().iterator();
        boolean defaultSet = false;
        while(i.hasNext()){
          StyleConfig sc = (StyleConfig)i.next();
          if(sc.isDefault()){
            styles.add(sc.getId()+"*");
                defaultSet = true;
          } else {
            styles.add(sc.getId());
          }
        }               
        StyleConfig sConfig;

        UserContainer user = Requests.getUserContainer(request);       
        selectedStyle = "";       
    }
View Full Code Here

Examples of org.vfny.geoserver.config.StyleConfig

      validationReport = null;
        super.reset(arg0, request);
        DataConfig config = ConfigRequests.getDataConfig( request );

        UserContainer user = Requests.getUserContainer( request );
        StyleConfig style = user.getStyle();
        fullyValidate = true; //default value
        fullyValidateChecked = false; //required by html:checkbox
        if (style == null) {
            // Should not happen (unless they bookmark)
            styleID = "";
            _default = config.getStyles().isEmpty();
            filename = "";
            sldFile= null ;
        }
        else {
            styleID = style.getId();
            _default = style.isDefault();
            if (style.getFilename() != null) {
                filename = style.getFilename().getName();
            }
            sldFile= null ;
        }
        defaultChecked = false;
        defaultInitial = _default;
View Full Code Here

Examples of org.vfny.geoserver.config.StyleConfig

        this.keywords = buf.toString();

        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());
                }
            }
        }

        Object attribute = styles;
View Full Code Here

Examples of org.vfny.geoserver.config.StyleConfig

        StylesEditorForm stylesForm = (StylesEditorForm) form;
        FormFile file = stylesForm.getSldFile();
        final String filename = file.getFileName();
        final String styleID = stylesForm.getStyleID();

        StyleConfig style = user.getStyle();
       

       
        boolean doFullValidation = stylesForm.getFullyValidate();
        if (stylesForm.getFullyValidateChecked() == false) {
          doFullValidation = false;
        }
       
        if (doFullValidation)
        {
          List l = getSchemaExceptions(file,request);
          if (l.size() !=0)
          {
            handleValidationErrors(l,file,stylesForm);           
            return mapping.findForward("schemaErrors");
          }
        }

        if (style == null) {
            // Must of bookmarked? Redirect so they can select           
            return mapping.findForward("config.data.style");
        }

 
  ServletContext sc = getServlet().getServletContext();
        //DJB: changed for geoserver_data_dir
        //File rootDir = new File(getServlet().getServletContext().getRealPath("/"));
        File rootDir = GeoserverDataDirectory.getGeoserverDataDirectory(sc);
 
  File styleDir;
  try {
      styleDir = GeoserverDataDirectory.findConfigDir(rootDir, "styles");
  } catch (ConfigurationException cfe) {
            LOGGER.warning("no style dir found, creating new one");
            //if for some bizarre reason we don't fine the dir, make a new one.
            styleDir = new File(rootDir, "styles");
  }
        // send content of FormFile to /styles :
        // there nothing to keep the styles in memory for XMLConfigWriter.store()
        InputStreamReader isr = new InputStreamReader(file.getInputStream());
        File newSldFile = new File(styleDir, filename);

        //here we do a check to see if the file we are trying to upload is
        //overwriting another style file.
        LOGGER.fine("new sld file is: " + newSldFile + ", exists: "
            + newSldFile.exists());

        if (newSldFile.exists()) {
            StyleConfig styleForID = config.getStyle(styleID);

            if (styleForID == null) {
                //if there is already a file at the location (file.exists()), and
                //the system does not have a record of this styleId then it means
                //we are trying to add a new sld at a location that would overwrite
                //another's sld file.
                doFileExistsError(newSldFile, request);

                return mapping.findForward("config.data.style.editor");
            } else {
                //if the system has a record of the file, then we need to check if this
                //update is being performed on the correct style id, so we see if the
                //file in the system is the same as this one. 
                File oldFile = styleForID.getFilename();
                LOGGER.fine("old file: " + oldFile + ", newFile: " + newSldFile);

                if (!oldFile.equals(newSldFile)) {
                    doFileExistsError(newSldFile, request);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.