Examples of StyleInfo


Examples of org.geoserver.catalog.StyleInfo

       
        File f = new File( testData.getDataDirectoryRoot(),
            "styles/foostyle.xml");
        assertTrue( f.exists() );
       
        StyleInfo s = catalog.getStyleByName( "foostyle" );
        catalog.remove( s );
       
        assertFalse( f.exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

    public void testModifyLayerGroup() throws Exception {
        testAddLayerGroup();
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( "lg" );
       
        StyleInfo s = catalog.getFactory().createStyle();
        s.setName( "foostyle2" );
        s.setFilename( "foostyle2.sld");
        catalog.add( s );
       
        lg.getStyles().set( 0, s );
        catalog.save( lg );
       
        File f = new File( testData.getDataDirectoryRoot(),
            "layergroups/lg.xml");
        Document dom = dom( f );
        assertXpathEvaluatesTo( s.getId(), "/layerGroup/styles/style/id", dom );
    }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

            FileUtils.copyURLToFile(getClass().getResource(sld),
                new File( resourceLoader.find( "styles" ), sld) );
        }
       
        //create a style for it
        StyleInfo s = catalog.getFactory().createStyle();
        s.setName( styleName );
        s.setFilename( sld );
        catalog.add( s );
    }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

                //handle the .xml.xml case
                if (new File(styles,sf.getName()+".xml").exists()) {
                    continue;
                }
               
                StyleInfo s = depersist( xp, sf, StyleInfo.class );
                catalog.add( s );
               
                LOGGER.info( "Loaded style '" + s.getName() + "'" );
            }
            catch( Exception e ) {
                LOGGER.log( Level.WARNING, "Failed to load style from file '" + sf.getName() + "'" , e );
            }
        }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

                } catch (IOException e) {
                    throw new WicketRuntimeException(e);
                }

                // update the style object
                StyleInfo s = (StyleInfo) form.getModelObject();
                if (s.getName() == null || "".equals(s.getName().trim())) {
                    // set it
                    nameTextField.setModelValue(ResponseUtils.stripExtension(upload
                            .getClientFileName()));
                    nameTextField.modelChanged();
                }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                // we need to force validation or the value won't be converted
                styles.processInput();
                StyleInfo style = (StyleInfo) styles.getConvertedInput();

                if (style != null) {
                    try {
                        // same here, force validation or the field won't be udpated
                        editor.validate();
                        editor.clearInput();
                        setRawSLD(readFile(style));
                    } catch (Exception e) {
                        error("Errors occurred loading the '" + style.getName() + "' style");
                    }
                    target.addComponent(styleForm);
                }
            }
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

   
    public static final String NAME = "name";

    public StyleEditPage(PageParameters parameters) {
        String name = parameters.getString(NAME);
        StyleInfo si = getCatalog().getStyleByName(name);
       
        if(si == null) {
            error(new ParamResourceModel("StyleEditPage.notFound", this, name).getString());
            setResponsePage(StylePage.class);
            return;
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

    @Override
    protected void onStyleFormSubmit() {
        // write out the file and save name modifications
        try {
            StyleInfo style = (StyleInfo) styleForm.getModelObject();
            getCatalog().save(style);
           
            // write out the SLD
            try {
                getCatalog().getResourcePool().writeStyle(style,
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

    }
   
    public void testCascadeStyle() {
        String styleName = MockData.LAKES.getLocalPart();
        String layerName = getLayerId(MockData.LAKES);
        StyleInfo style = catalog.getStyleByName(styleName);
        assertNotNull(style);
       
        // add the lakes style to builds as an alternate style
        LayerInfo buildings = catalog.getLayerByName(getLayerId(MockData.BUILDINGS));
        buildings.getStyles().add(style);
        catalog.save(buildings);
        buildings = catalog.getLayerByName(getLayerId(MockData.BUILDINGS));
        assertTrue(buildings.getStyles().contains(style));
       
        style.accept(visitor);
       
        // test style reset
        assertEquals(style.getId(), visitor.getObjects(StyleInfo.class, ModificationType.DELETE).get(0).getId());
        String lakesId = catalog.getLayerByName(layerName).getId();
        assertEquals(lakesId, visitor.getObjects(LayerInfo.class, ModificationType.STYLE_RESET).get(0).getId());
       
        // test style removal
        String buildingsId = catalog.getLayerByName(getLayerId(MockData.BUILDINGS)).getId();
View Full Code Here

Examples of org.geoserver.catalog.StyleInfo

   
    @Override
    protected void onStyleFormSubmit() {
        // add the style
        Catalog catalog = getCatalog();
        StyleInfo s = (StyleInfo) styleForm.getModelObject();

        if (s.getFilename() == null) {
            // TODO: check that this does not overriDe any existing files
            s.setFilename(s.getName() + ".sld");
        }
        try {
            getCatalog().add(s);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Error occurred saving the style", e);
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.