Package org.geoserver.web.wicket

Examples of org.geoserver.web.wicket.ParamResourceModel


        return disabled;
    }

    @Override
    protected String getDescription() {
        return new ParamResourceModel("description", this, title).getString();
    }
View Full Code Here


                    @Override
                    protected String load() {
                        if(item.getFilteredProcesses().isEmpty()) {
                            // all processes are enabled
                            return new ParamResourceModel("WPSAdminPage.filter.all", null).getString();
                        }
                       
                        Class factoryClass = item.getFactoryClass();
                        ProcessFactory pf = GeoServerProcessors.getProcessFactory(factoryClass, false);
                        if(pf != null) {
                            Set<Name> names = new HashSet<Name>(pf.getNames());
                            int total = names.size();
                            names.removeAll(item.getFilteredProcesses());
                            int active = names.size();
                            return new ParamResourceModel("WPSAdminPage.filter.active", null, active, total).getString();
                           
                        }
                       
                        return "?";
                    }
View Full Code Here

                    FormComponentFeedbackBorder codeBorder = new FormComponentFeedbackBorder(
                            "border");
                    codeFragment.add(codeBorder);
                    TextField<String> code = new TextField<String>("txt",
                            new PropertyModel<String>(itemModel, "code"));
                    code.setLabel(new ParamResourceModel("th.code", UniqueResourceIdentifiersEditor.this));
                    code.setRequired(true);
                    codeBorder.add(code);
                    return codeFragment;
                } else if ("namespace".equals(name)) {
                    Fragment nsFragment = new Fragment(id, "txtFragment",
                            UniqueResourceIdentifiersEditor.this);
                    FormComponentFeedbackBorder namespaceBorder = new FormComponentFeedbackBorder(
                            "border");
                    nsFragment.add(namespaceBorder);
                    TextField<String> namespace = new TextField<String>("txt",
                            new PropertyModel<String>(itemModel, "namespace"));
                    namespace.setLabel(new ParamResourceModel("th.namespace", UniqueResourceIdentifiersEditor.this));
                    namespace.add(new URIValidator());
                    namespaceBorder.add(namespace);
                    return nsFragment;
                } else if ("metadataURL".equals(name)) {
                    Fragment urlFragment = new Fragment(id, "txtFragment",
                            UniqueResourceIdentifiersEditor.this);
                    FormComponentFeedbackBorder namespaceBorder = new FormComponentFeedbackBorder(
                            "border");
                    urlFragment.add(namespaceBorder);
                    TextField<String> url = new TextField<String>("txt",
                            new PropertyModel<String>(itemModel, "metadataURL"));
                    url.add(new URIValidator());
                    namespaceBorder.add(url);
                    return urlFragment;
                } else if ("remove".equals(name)) {
                    Fragment removeFragment = new Fragment(id, "removeFragment",
                            UniqueResourceIdentifiersEditor.this);
                    GeoServerAjaxFormLink removeLink = new GeoServerAjaxFormLink("remove") {

                        @Override
                        protected void onClick(AjaxRequestTarget target, Form form) {
                            UniqueResourceIdentifiers identifiers = identifiersModel.getObject();
                            UniqueResourceIdentifier sdi = (UniqueResourceIdentifier) itemModel
                                    .getObject();
                            identifiers.remove(sdi);
                            target.addComponent(container);
                        }
                    };
                    removeFragment.add(removeLink);
                    return removeFragment;
                }
                return null;
            }
        };
        identifiers.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
        identifiers.setPageable(false);
        identifiers.setSortable(false);
        identifiers.setFilterable(false);
        container.add(identifiers);

        // add new link button
        button = new AjaxButton("addIdentifier") {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                UniqueResourceIdentifiers identifiers = identifiersModel.getObject();
                identifiers.add(new UniqueResourceIdentifier());

                target.addComponent(container);
            }
           
            @Override
            protected void onError(AjaxRequestTarget target, Form<?> form) {
                // the form validator triggered, but we don't want the msg to display
                Session.get().cleanupFeedbackMessages();
                Session.get().dirty();
                onSubmit(target, form);
            }
           
        };
        add(button);
       
        // grab a seat... the way I'm adding this validator in onBeforeRender will be hard
        // to stomach... however, could not find other way to add a validation to an editabl table, grrr
        add(new IValidator<UniqueResourceIdentifiers>() {

            @Override
            public void validate(IValidatable<UniqueResourceIdentifiers> validatable) {
                UniqueResourceIdentifiers identifiers = identifiersModel.getObject();
                if(identifiers.size() == 0) {
                  ValidationError error = new ValidationError();
                  String message = new ParamResourceModel(
                          "noSpatialDatasetIdentifiers", UniqueResourceIdentifiersEditor.this).getString();
                  error.setMessage(message);
                  validatable.error(error);
                }
               
View Full Code Here

                        return "-";
                    } else {
                        String name = type.name();
                        try {
                            String key = BandsPanel.class.getSimpleName() + "." +  name;
                            ParamResourceModel rm = new ParamResourceModel(key, null);
                            return rm.getString();
                        } catch(Exception e) {
                            return name;
                        }
                       
                    }
View Full Code Here

        mainContent.add(popup);
        final StyleNameModel styleNameModel = new StyleNameModel(style);
        mainContent.add(new Label("style.name", styleNameModel));
        final PropertyModel layerNameModel = new PropertyModel(layer, "prefixedName");
        mainContent.add(new Label("layer.name", layerNameModel));
        mainContent.add(new AjaxLink("change.style", new ParamResourceModel("CssDemoPage.changeStyle", this)) {
            public void onClick(AjaxRequestTarget target) {
                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                popup.setInitialHeight(400);
                popup.setInitialWidth(600);
                popup.setTitle(new Model("Choose style to edit"));
                popup.setContent(new StyleChooser(popup.getContentId(), CssDemoPage.this));
                popup.show(target);
            }
        });
        mainContent.add(new AjaxLink("change.layer", new ParamResourceModel("CssDemoPage.changeLayer", this)) {
            public void onClick(AjaxRequestTarget target) {
                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                popup.setInitialHeight(400);
                popup.setInitialWidth(600);
                popup.setTitle(new Model("Choose layer to edit"));
                popup.setContent(new LayerChooser(popup.getContentId(), CssDemoPage.this));
                popup.show(target);
            }
        });
        mainContent.add(new AjaxLink("create.style", new ParamResourceModel("CssDemoPage.createStyle", this)) {
            public void onClick(AjaxRequestTarget target) {
                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                popup.setInitialHeight(200);
                popup.setInitialWidth(300);
                popup.setTitle(new Model("Choose name for new style"));
                popup.setContent(new StyleNameInput(popup.getContentId(), CssDemoPage.this));
                popup.show(target);
            }
        });
        mainContent.add(new AjaxLink("associate.styles", new ParamResourceModel("CssDemoPage.associateStyles", this)) {
            public void onClick(AjaxRequestTarget target) {
                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                popup.setInitialHeight(400);
                popup.setInitialWidth(600);
                popup.setTitle(new Model("Choose layers to associate"));
                popup.setContent(new MultipleLayerChooser(popup.getContentId(), CssDemoPage.this));
                popup.show(target);
            }
        });
        ParamResourceModel associateToLayer = new ParamResourceModel("CssDemoPage.associateDefaultStyle", this, styleNameModel, layerNameModel);
        final SimpleAjaxLink associateDefaultStyle = new SimpleAjaxLink("associate.default.style", new Model(), associateToLayer) {
            public void onClick(final AjaxRequestTarget linkTarget) {
                final Component theComponent = this;
                dialog.setResizable(false);
                dialog.setHeightUnit("em");
                dialog.setWidthUnit("em");
                dialog.setInitialHeight(7);
                dialog.setInitialWidth(50);
                dialog.showOkCancel(linkTarget, new DialogDelegate() {
                    boolean success = false;
                   
                    @Override
                    protected boolean onSubmit(AjaxRequestTarget target, Component contents) {
                        layer.setDefaultStyle(style);
                        getCatalog().save(layer);
                        theComponent.setEnabled(false);
                        success = true;
                        return true;
                    }
                   
                    @Override
                    public void onClose(AjaxRequestTarget target) {
                        super.onClose(target);
                        target.addComponent(theComponent);
                        if(success) {
                            CssDemoPage.this.info(new ParamResourceModel("CssDemoPage.styleAssociated",  CssDemoPage.this, styleNameModel, layerNameModel).getString());
                            target.addComponent(getFeedbackPanel());                          
                        }
                    }
                   
                    @Override
                    protected Component getContents(String id) {
                        ParamResourceModel confirm = new ParamResourceModel("CssDemoPage.confirmAssocation", CssDemoPage.this, styleNameModel.getObject(),
                                layerNameModel.getObject(), layer.getDefaultStyle().getName());
                        return new Label(id, confirm);
                    }
                });
            }
View Full Code Here

        // print(tester.getLastRenderedPage(), true, true);
       
        // now trigger the validation, we cannot be without spatial data identifiers
        tester.submitForm("form");
       
        String error = new ParamResourceModel("UniqueResourceIdentifiersEditor.noSpatialDatasetIdentifiers", null).getString();
        tester.assertErrorMessages(new String[] {error});
    }
View Full Code Here

        form.add(saveLink());
        form.add(cancelLink());
    }

    protected Component removeLink(String id, IModel itemModel) {
        SimpleAjaxLink link = new SimpleAjaxLink(id, itemModel, new ParamResourceModel("remove", this)) {
           
            @Override
            protected void onClick(AjaxRequestTarget target) {
                // remove the link
                AggregateTypeConfiguration config = form.getModelObject();
View Full Code Here

        };
        return link;
    }
   
    protected Component makeDefaultLink(String id, IModel itemModel) {
        return new SimpleAjaxLink(id, itemModel, new ParamResourceModel("makeDefault", this)) {
           
            @Override
            protected void onClick(AjaxRequestTarget target) {
                // remove the link
                AggregateTypeConfiguration config = form.getModelObject();
View Full Code Here

            @Override
            public void onSubmit() {
                AggregateTypeConfiguration config = form.getModelObject();
                List<SourceType> stypes = config.getSourceTypes();
                if(stypes == null || stypes.size() == 0) {
                    error(new ParamResourceModel("atLeastOneSource", AbstractConfigPage.this).getString());
                } else  if (AbstractConfigPage.this.onSubmit()) {
                    originalConfig.copyFrom(config);
                    setResponsePage(master.getPage());
                }
            }
View Full Code Here

        // see if the user selected anything
        final List<Script> selection = tablePanel.getSelection();
        if (selection.size() == 0)
            return;

        dialog.setTitle(new ParamResourceModel("confirmRemoval", this));

        // if there is something to cancel, let's warn the user about what
        // could go wrong, and if the user accepts, let's delete what's needed
        dialog.showOkCancel(target, new GeoServerDialog.DialogDelegate() {
            protected Component getContents(String id) {
View Full Code Here

TOP

Related Classes of org.geoserver.web.wicket.ParamResourceModel

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.