Package org.geoserver.web

Examples of org.geoserver.web.CatalogIconFactory


            @Override
            protected Component getComponentForProperty(String id, IModel itemModel,
                    Property<LayerSummary> property) {
                final LayerSummary layerSummary = (LayerSummary) itemModel.getObject();
                final CatalogIconFactory icons = CatalogIconFactory.get();
                LayerInfo layer = layerSummary.getLayer();
        if(property == LAYER) {
                    Fragment f = new Fragment(id, "edit", ImportSummaryPage.this);
                   
                    Link editLink = editLink(layerSummary);
                    editLink.setEnabled(layer != null);
                    f.add(editLink);
                   
                    return f;
                } else if(property == STATUS) {
                    ResourceReference icon = layerSummary.getStatus().successful() ?
                            icons.getEnabledIcon() : icons.getDisabledIcon();
                    Fragment f = new Fragment(id, "iconFragment", ImportSummaryPage.this);
                    f.add(new Image("icon", icon));
                    return f;
                } else if(property == TYPE) {
                    if(layer != null) {
                        ResourceReference icon = icons.getSpecificLayerIcon(layer);
                        Fragment f = new Fragment(id, "iconFragment", ImportSummaryPage.this);
                        Image image = new Image("icon", icon);
                        image.add(new AttributeModifier("title", true, new Model(getTypeTooltip(layer))));
            f.add(image);
                        return f;
View Full Code Here


        final ArrayList<String> sortedDsNames = new ArrayList<String>(getAvailableDataStores()
                .keySet());
        Collections.sort(sortedDsNames);

        final CatalogIconFactory icons = CatalogIconFactory.get();
        final ListView dataStoreLinks = new ListView("vectorResources", sortedDsNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String dataStoreFactoryName = item.getModelObjectAsString();
                final DataAccessFactory factory = getAvailableDataStores()
                        .get(dataStoreFactoryName);
                final String description = factory.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new DataAccessNewPage(dataStoreFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", dataStoreFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(factory.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };

        final List<String> sortedCoverageNames = new ArrayList<String>();
        sortedCoverageNames.addAll(getAvailableCoverageStores().keySet());
        Collections.sort(sortedCoverageNames);

        final ListView coverageLinks = new ListView("rasterResources", sortedCoverageNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String coverageFactoryName = item.getModelObjectAsString();
                final Map<String, Format> coverages = getAvailableCoverageStores();
                Format format = coverages.get(coverageFactoryName);
                final String description = format.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new CoverageStoreNewPage(coverageFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", coverageFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(format.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };
View Full Code Here

                    IModel itemModel, Property<Resource> property) {
                if (property == NewLayerPageProvider.NAME) {
                    return new Label(id, property.getModel(itemModel));
                } else if (property == NewLayerPageProvider.PUBLISHED) {
                    final Resource resource = (Resource) itemModel.getObject();
                    final CatalogIconFactory icons = CatalogIconFactory.get();
                    if(resource.isPublished()) {
                        ResourceReference icon = icons.getEnabledIcon();
                        Fragment f = new Fragment(id, "iconFragment", NewLayerPage.this);
                        f.add(new Image("layerIcon", icon));
                        return f;
                    } else {
                        return new Label(id);
View Full Code Here

    GeoServerTablePanel<LayerInfo> table;
    GeoServerDialog dialog;
    SelectionRemovalLink removal;

    public LayerPage() {
        final CatalogIconFactory icons = CatalogIconFactory.get();
        table = new GeoServerTablePanel<LayerInfo>("table", provider, true) {

            @Override
            protected Component getComponentForProperty(String id, IModel itemModel,
                    Property<LayerInfo> property) {
                if(property == TYPE) {
                    Fragment f = new Fragment(id, "iconFragment", LayerPage.this);
                    f.add(new Image("layerIcon", icons.getSpecificLayerIcon((LayerInfo) itemModel.getObject())));
                    return f;
                } else if(property == WORKSPACE) {
                    return workspaceLink(id, itemModel);
                } else if(property == STORE) {
                    return storeLink(id, itemModel);
                } else if(property == NAME) {
                    return layerLink(id, itemModel);
                } else if(property == ENABLED) {
                    LayerInfo layerInfo = (LayerInfo) itemModel.getObject();
                    // ask for enabled() instead of isEnabled() to account for disabled resource/store
                    boolean enabled = layerInfo.enabled();
                    ResourceReference icon = enabled? icons.getEnabledIcon() : icons.getDisabledIcon();
                    Fragment f = new Fragment(id, "iconFragment", LayerPage.this);
                    f.add(new Image("layerIcon", icon));
                    return f;
                } else if(property == SRS) {
                    return new Label(id, SRS.getModel(itemModel));
View Full Code Here

    @Override
    protected Component getComponentForProperty(String id, IModel itemModel,
            Property<StoreInfo> property) {

        final CatalogIconFactory icons = CatalogIconFactory.get();

        if (property == TYPE) {
            final StoreInfo storeInfo = (StoreInfo) itemModel.getObject();

            ResourceReference storeIcon = icons.getStoreIcon(storeInfo);

            Fragment f = new Fragment(id, "iconFragment", StorePanel.this);
            f.add(new Image("storeIcon", storeIcon));

            return f;
        } else if (property == WORKSPACE) {
            return workspaceLink(id, itemModel);
        } else if (property == NAME) {
            return storeNameLink(id, itemModel);
        } else if (property == ENABLED) {
            final StoreInfo storeInfo = (StoreInfo) itemModel.getObject();
            ResourceReference enabledIcon;
            if (storeInfo.isEnabled()) {
                enabledIcon = icons.getEnabledIcon();
            } else {
                enabledIcon = icons.getDisabledIcon();
            }
            Fragment f = new Fragment(id, "iconFragment", StorePanel.this);
            f.add(new Image("storeIcon", enabledIcon));
            return f;
        }
View Full Code Here

                    IModel itemModel, Property<Resource> property) {
                if (property == NewLayerPageProvider.NAME) {
                    return new Label(id, property.getModel(itemModel));
                } else if (property == NewLayerPageProvider.PUBLISHED) {
                    final Resource resource = (Resource) itemModel.getObject();
                    final CatalogIconFactory icons = CatalogIconFactory.get();
                    if(resource.isPublished()) {
                        ResourceReference icon = icons.getEnabledIcon();
                        Fragment f = new Fragment(id, "iconFragment", NewLayerPage.this);
                        f.add(new Image("layerIcon", icon));
                        return f;
                    } else {
                        return new Label(id);
View Full Code Here

        final ArrayList<String> sortedDsNames = new ArrayList<String>(getAvailableDataStores()
                .keySet());
        Collections.sort(sortedDsNames);

        final CatalogIconFactory icons = CatalogIconFactory.get();
        final ListView dataStoreLinks = new ListView("vectorResources", sortedDsNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String dataStoreFactoryName = item.getDefaultModelObjectAsString();
                final DataAccessFactory factory = getAvailableDataStores()
                        .get(dataStoreFactoryName);
                final String description = factory.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new DataAccessNewPage(dataStoreFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", dataStoreFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(factory.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };

        final List<String> sortedCoverageNames = new ArrayList<String>();
        sortedCoverageNames.addAll(getAvailableCoverageStores().keySet());
        Collections.sort(sortedCoverageNames);

        final ListView coverageLinks = new ListView("rasterResources", sortedCoverageNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String coverageFactoryName = item.getDefaultModelObjectAsString();
                final Map<String, Format> coverages = getAvailableCoverageStores();
                Format format = coverages.get(coverageFactoryName);
                final String description = format.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new CoverageStoreNewPage(coverageFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", coverageFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(format.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };
View Full Code Here

    @Override
    protected Component getComponentForProperty(String id, IModel itemModel,
            Property<StoreInfo> property) {

        final CatalogIconFactory icons = CatalogIconFactory.get();

        if (property == TYPE) {
            final StoreInfo storeInfo = (StoreInfo) itemModel.getObject();

            ResourceReference storeIcon = icons.getStoreIcon(storeInfo);

            Fragment f = new Fragment(id, "iconFragment", StorePanel.this);
            f.add(new Image("storeIcon", storeIcon));

            return f;
        } else if (property == WORKSPACE) {
            return workspaceLink(id, itemModel);
        } else if (property == NAME) {
            return storeNameLink(id, itemModel);
        } else if (property == ENABLED) {
            final StoreInfo storeInfo = (StoreInfo) itemModel.getObject();
            ResourceReference enabledIcon;
            if (storeInfo.isEnabled()) {
                enabledIcon = icons.getEnabledIcon();
            } else {
                enabledIcon = icons.getDisabledIcon();
            }
            Fragment f = new Fragment(id, "iconFragment", StorePanel.this);
            f.add(new Image("storeIcon", enabledIcon));
            return f;
        }
View Full Code Here

    GeoServerTablePanel<LayerInfo> table;
    GeoServerDialog dialog;
    SelectionRemovalLink removal;

    public LayerPage() {
        final CatalogIconFactory icons = CatalogIconFactory.get();
        table = new GeoServerTablePanel<LayerInfo>("table", provider, true) {

            @Override
            protected Component getComponentForProperty(String id, IModel itemModel,
                    Property<LayerInfo> property) {
                if(property == TYPE) {
                    Fragment f = new Fragment(id, "iconFragment", LayerPage.this);
                    f.add(new Image("layerIcon", icons.getSpecificLayerIcon((LayerInfo) itemModel.getObject())));
                    return f;
                } else if(property == WORKSPACE) {
                    return workspaceLink(id, itemModel);
                } else if(property == STORE) {
                    return storeLink(id, itemModel);
                } else if(property == NAME) {
                    return layerLink(id, itemModel);
                } else if(property == ENABLED) {
                    LayerInfo layerInfo = (LayerInfo) itemModel.getObject();
                    // ask for enabled() instead of isEnabled() to account for disabled resource/store
                    boolean enabled = layerInfo.enabled();
                    ResourceReference icon = enabled? icons.getEnabledIcon() : icons.getDisabledIcon();
                    Fragment f = new Fragment(id, "iconFragment", LayerPage.this);
                    f.add(new Image("layerIcon", icon));
                    return f;
                } else if(property == SRS) {
                    return new Label(id, SRS.getModel(itemModel));
View Full Code Here

        final ArrayList<String> sortedDsNames = new ArrayList<String>(getAvailableDataStores()
                .keySet());
        Collections.sort(sortedDsNames);

        final CatalogIconFactory icons = CatalogIconFactory.get();
        final ListView dataStoreLinks = new ListView("vectorResources", sortedDsNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String dataStoreFactoryName = item.getDefaultModelObjectAsString();
                final DataAccessFactory factory = getAvailableDataStores()
                        .get(dataStoreFactoryName);
                final String description = factory.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new DataAccessNewPage(dataStoreFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", dataStoreFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(factory.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };

        final List<String> sortedCoverageNames = new ArrayList<String>();
        sortedCoverageNames.addAll(getAvailableCoverageStores().keySet());
        Collections.sort(sortedCoverageNames);

        final ListView coverageLinks = new ListView("rasterResources", sortedCoverageNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String coverageFactoryName = item.getDefaultModelObjectAsString();
                final Map<String, Format> coverages = getAvailableCoverageStores();
                Format format = coverages.get(coverageFactoryName);
                final String description = format.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new CoverageStoreNewPage(coverageFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", coverageFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(format.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };
View Full Code Here

TOP

Related Classes of org.geoserver.web.CatalogIconFactory

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.