Package org.geoserver.catalog

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
        assertNull(catalog.getStyleByName(styleName));
        assertEquals(StyleInfo.DEFAULT_POLYGON, catalog.getLayerByName(layerName).getDefaultStyle().getName());
       
View Full Code Here


       
        // the removal button
        header.add(removal = new SelectionRemovalLink("removeSelected", table, dialog) {
            @Override
            protected StringResourceModel canRemove(CatalogInfo object) {
                StyleInfo s = (StyleInfo) object;
                if ( StyleInfo.DEFAULT_POINT.equals( s.getName() ) ||
                    StyleInfo.DEFAULT_LINE.equals( s.getName() ) ||
                    StyleInfo.DEFAULT_POLYGON.equals( s.getName() ) ||
                    StyleInfo.DEFAULT_RASTER.equals( s.getName() ) ) {
                    return new StringResourceModel("cantRemoveDefaultStyle", StylePage.this, null );
                }
                return null;
            }
        });
View Full Code Here

        tester.assertRenderedPage(FormTestPage.class);
        tester.assertComponent("form", Form.class);
        tester.assertComponent("form:panel:defaultStyle", DropDownChoice.class);
       
        // check selecting something else works
        StyleInfo target = ((List<StyleInfo>) new StylesModel().getObject()).get(0);
        FormTester ft = tester.newFormTester("form");
        ft.select("panel:defaultStyle", 0);
        ft.submit();
        tester.assertModelValue("form:panel:defaultStyle", target);
    }
View Full Code Here

                else {
                    for ( int i = 0; i < styleNames.size(); i++ ) {
                        String styleName = styleNames.get( i );
                        styleName = styleName.trim();
                       
                        StyleInfo style = null;
                        if ( "".equals( styleName ) ) {
                            style = null;
                        }
                        else {
                            style = catalog.getStyleByName( styleName );   
View Full Code Here

            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof StyleInfo))
            return false;
        final StyleInfo other = (StyleInfo) obj;
        if (filename == null) {
            if (other.getFilename() != null)
                return false;
        } else if (!filename.equals(other.getFilename()))
            return false;
        if (id == null) {
            if (other.getId() != null)
                return false;
        } else if (!id.equals(other.getId()))
            return false;
        if (name == null) {
            if (other.getName() != null)
                return false;
        } else if (!name.equals(other.getName()))
            return false;
       
        return true;
    }
View Full Code Here

        }

        @Override
        protected Component getComponentForProperty(String id, IModel itemModel,
                Property<StyleInfo> property) {
            final StyleInfo style = (StyleInfo) itemModel.getObject();
            if ( property == NAME ) {
                return new SimpleAjaxLink( id, NAME.getModel( itemModel ) ) {
                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        handleStyle(style, target);
View Full Code Here

        }

        public FeatureTypeCreator layer(boolean globalStyle) throws IOException {
            layer = builder().buildLayer(featureType);

            StyleInfo style = newStyle(globalStyle);
            layer.setDefaultStyle(style);

            catalog.add(style);
            catalog.add(layer);
View Full Code Here

            return this;
        }

        public FeatureTypeCreator style(boolean global) throws IOException {
            StyleInfo style = newStyle(global);
            catalog.add(style);

            layer.getStyles().add(style);
            return this;
        }
View Full Code Here

        //TODO: grab all of the icons
    }

    StyleInfo convertToWorkspaceLocal(StyleInfo s) {
        StyleInfo newStyle = catalog.getFactory().createStyle();
        new CatalogBuilder(catalog).updateStyle(newStyle, s);

        newStyle.setWorkspace(options.workspace());
        return newStyle;
    }
View Full Code Here

//        }
    }

    void loadStyles(File styleDir) throws IOException {
        for (File f : styleDir.listFiles(CONFIG_FILE)) {
            StyleInfo s = depersist(f, StyleInfo.class);
            s.setWorkspace(workspace);

            //TODO: copy over sld file?
            catalog.add(s);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.StyleInfo

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.