Examples of IModel


Examples of org.apache.wicket.model.IModel

    }

    public TranslationEditPage(final Locale targetLocale) {
        super();

        final IModel translationModel;
        {
            TranslateBean translateBean;
            final GeoServerApplication application = getGeoServerApplication();
            translateBean = (TranslateBean) application.getMetaData(TRANSLATION_BEAN);
            if (translateBean == null) {
                TranslationController controller = getController();
                Map<Locale, Map<String, String>> translatedResources;
                translatedResources = controller.getTranslatedResources();

                // default locale is keyed by null
                Locale baseLocale = null;
                translateBean = new TranslateBean(baseLocale, translatedResources);
                application.setMetaData(TRANSLATION_BEAN, translateBean);
            }

            translateBean.setTargetLanguage(targetLocale);

            // translationModel = new Model(translateBean);
            translationModel = new LoadableDetachableModel() {
                private static final long serialVersionUID = 1L;

                @Override
                protected Object load() {
                    final Application application = getApplication();
                    TranslateBean translateState = (TranslateBean) application
                            .getMetaData(TRANSLATION_BEAN);
                    return translateState;
                }
            };
        }

        setModel(translationModel);
        add(toolbar());
        add(filter());

        add(translateForm = new Form("translateForm"));
        translateForm
                .add(keyTreePanel = new ResourceKeyTreePanel("keyTreePanel", translationModel));
        translateForm.add(translationPanel = new TranslationResourcePanel("resourcePanel",
                translationModel));
        add(changeUILocale());

        final IModel currentKeyModel = new PropertyModel(translationModel, "currentKey");
        keyTreePanel.getTree().add(new AjaxFormSubmitBehavior(translateForm, "onclick") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target) {
                String selectedNodeKey = keyTreePanel.getSelectedNodeKey();
                currentKeyModel.setObject(selectedNodeKey);
                translationPanel.refresh(target);
            }

            @Override
            protected void onError(final AjaxRequestTarget target) {
View Full Code Here

Examples of org.apache.wicket.model.IModel

    private Component filter() {
        // build the filter form
        filterForm = new Form("filterForm");

        final IModel filterModel = new PropertyModel(getModel(), "filter");
        filterForm.add(filter = new TextField("filter", filterModel));
        filter.add(new SimpleAttributeModifier("title", String.valueOf(new ResourceModel(
                "ResourceKeyTreePanel.search", "Search").getObject())));
        filterForm.add(hiddenSubmit = hiddenSearchSubmit());
        filterForm.setDefaultButton(hiddenSubmit);
View Full Code Here

Examples of org.apache.wicket.model.IModel

        toolbarForm.add(showMissingOnlyComponent());
        return toolbarForm;
    }

    private CheckBox showMissingOnlyComponent() {
        final IModel model = new PropertyModel(getModel(), "showMissingOnly");
        final CheckBox checkBox = new CheckBox("showMissingOnly", model);

        checkBox.add(new AjaxFormSubmitBehavior(toolbarForm, "onChange") {
            private static final long serialVersionUID = 1L;
View Full Code Here

Examples of org.apache.wicket.model.IModel

            }
        };
    }

    private Component changeUiLanguageChoice() {
        final IModel sessionModel = new Model(getSession());
        final IModel uiLocaleModel = new PropertyModel(sessionModel, "locale");
        IModel choices = new LocaleListDetachableModel(true, uiLocaleModel);

        final Component uiLanguageChoice = new LocaleDropDown("changeUiLanguage", uiLocaleModel,
                uiLocaleModel, choices);

        uiLanguageChoice.add(new AjaxFormSubmitBehavior(changeUILanguageForm, "onChange") {
View Full Code Here

Examples of org.apache.wicket.model.IModel

     * </ul>
     * </p>
     */
    @SuppressWarnings("unchecked")
    public void refresh() {
        final IModel translateBeanModel = getModel();
        final Boolean missingOnly = (Boolean) new PropertyModel(translateBeanModel,
                "showMissingOnly").getObject();

        PropertyModel keysModel;
        if (missingOnly) {
            keysModel = new PropertyModel(translateBeanModel, "missingKeys");
        } else {
            keysModel = new PropertyModel(translateBeanModel, "resourceKeys");
        }

        Collection<String> keys = (Collection<String>) keysModel.getObject();

        final String flatKeywords = (String) new PropertyModel(translateBeanModel, "filter")
                .getObject();
        if (flatKeywords != null && flatKeywords.trim().length() > 0) {
            final TranslateBean translationState = (TranslateBean) translateBeanModel.getObject();
            this.keys = updateFilter(flatKeywords, keys, translationState);
        } else {
            this.keys = new TreeSet<String>(keys);
        }

        IModel flatViewModel = new PropertyModel(translateBeanModel, "flatView");
        boolean flatView = ((Boolean) flatViewModel.getObject()).booleanValue();
        if (flatView) {
            setFlatView();
        } else {
            setTreeView();
        }
View Full Code Here

Examples of org.apache.wicket.model.IModel

            setModel(localeSelectionModel);
            add(targetLanguageChoice());
        }

        private Component targetLanguageChoice() {
            final IModel selectionModel = getModel();
            IModel choices = new LocaleListDetachableModel(false, new Model(getLocale()));
            final IModel sessionModel = new Model(getSession());
            final IModel uiLocaleModel = new PropertyModel(sessionModel, "locale");
            final Component targetLanguageChoice = new LocaleDropDown("targetLanguage",
                    uiLocaleModel, selectionModel, choices);

            /*
             * Use a different form for the target language drop down so when submitting it doesn't
View Full Code Here

Examples of org.apache.wicket.model.IModel

@SuppressWarnings("serial")
public class ImportSummaryPage extends GeoServerSecuredPage {

    public ImportSummaryPage(final ImportSummary summary) {
        // the synthetic results
        IModel summaryMessage;
        Exception error = summary.getError();
        if(error != null) {
            String errorSummary = error.getClass().getSimpleName() + ", " + error.getMessage();
            summaryMessage = new ParamResourceModel("summaryError", this, errorSummary);
        } else if(summary.getProcessedLayers() == 0) {
View Full Code Here

Examples of org.apache.wicket.model.IModel

    static final List<String> DEFAULT_LOG_PROFILES = Arrays.asList("DEFAULT_LOGGING.properties",
            "VERBOSE_LOGGING.properties", "PRODUCTION_LOGGING.properties",
            "GEOTOOLS_DEVELOPER_LOGGING.properties", "GEOSERVER_DEVELOPER_LOGGING.properties");

    public GlobalSettingsPage() {
        final IModel globalInfoModel = getGlobalInfoModel();
        final IModel loggingInfoModel = getLoggingInfoModel();
       
        Form form = new Form("form", new CompoundPropertyModel(globalInfoModel));

        add(form);

        form.add(new CheckBox("verbose"));
        form.add(new CheckBox("verboseExceptions"));
        form.add(new TextField("numDecimals"));
        form.add(new TextField("charset"));
        form.add(new TextField("proxyBaseUrl"));
       
        logLevelsAppend(form, loggingInfoModel);
        form.add(new CheckBox("stdOutLogging", new PropertyModel( loggingInfoModel, "stdOutLogging")));
        form.add(new TextField("loggingLocation", new PropertyModel( loggingInfoModel, "location")) );
       
        form.add(new TextField("featureTypeCacheSize"));
       
        Button submit = new Button("submit", new StringResourceModel("submit", this, null)) {
            @Override
            public void onSubmit() {
                GeoServer gs = getGeoServer();
                gs.save( (GeoServerInfo) globalInfoModel.getObject() );
                gs.save( (LoggingInfo) loggingInfoModel.getObject() );
                setResponsePage(GeoServerHomePage.class);
            }
        };
        form.add(submit);
       
View Full Code Here

Examples of org.apache.wicket.model.IModel

*
*/
public abstract class BaseServiceAdminPage<T extends ServiceInfo> extends GeoServerSecuredPage {

    public BaseServiceAdminPage() {
        final IModel infoModel = new LoadableDetachableModel() {
            public Object load() {
                return getGeoServer().getService(getServiceClass());
            }
        };
       
        Form form = new Form( "form", new CompoundPropertyModel(infoModel));
        add(form);
       
        form.add(new Label("service.enabled", new StringResourceModel("service.enabled", this, null, new Object[]{
            getServiceName()
        })));
        form.add(new TextField("maintainer"));
        TextField onlineResource = new TextField("onlineResource");
        onlineResource.add(new UrlValidator());
        form.add(onlineResource);
        form.add(new CheckBox("enabled"));
        form.add(new CheckBox("citeCompliant"));
        form.add(new TextField("title"));
        form.add(new TextArea("abstract"));
        form.add(new KeywordsEditor("keywords", LiveCollectionModel.list(new PropertyModel(infoModel, "keywords"))));
        form.add(new TextField("fees"));
        form.add(new TextField("accessConstraints"));
       
        build(infoModel, form);
       
        SubmitLink submit = new SubmitLink("submit",new StringResourceModel( "save", (Component)null, null) ) {
            @Override
            public void onSubmit() {
                handleSubmit((T)infoModel.getObject());
                setResponsePage(GeoServerHomePage.class);
            }
        };
        form.add(submit);
       
View Full Code Here

Examples of org.apache.wicket.model.IModel

        add(listContainer);
        dataView = new DataView("items", dataProvider) {

            @Override
            protected void populateItem(Item item) {
                final IModel itemModel = item.getModel();

                // odd/even style
                item.add(new SimpleAttributeModifier("class", item.getIndex() % 2 == 0 ? "even"
                        : "odd"));
               
                // add row selector (visible only if selection is active)
                WebMarkupContainer cnt = new WebMarkupContainer("selectItemContainer");
                cnt.add(selectOneCheckbox(item));
                cnt.setVisible(selectable);
                item.add(cnt);

                // create one component per viewable property
                item.add(new ListView("itemProperties", dataProvider.getVisibleProperties()) {

                    @Override
                    protected void populateItem(ListItem item) {
                        Property<T> property = (Property<T>) item.getModelObject();

                        Component component = getComponentForProperty("component", itemModel,
                                property);
                       
                        if(component == null) {
                            // show a plain label if the the subclass did not create any component
                            component = new Label("component", property.getModel(itemModel));
                        } else if (!"component".equals(component.getId())) {
                            // add some checks for the id, the error message
                            // that wicket returns in case of mismatch is not
                            // that helpful
                            throw new IllegalArgumentException("getComponentForProperty asked "
                                    + "to build a component " + "with id = 'component' "
                                    + "for property '" + property.getName() + "', but got '"
                                    + component.getId() + "' instead");
                        }
                        item.add(component);
                    }

                });
            }

        };
        listContainer.add(dataView);

        // add select all checkbox
        WebMarkupContainer cnt = new WebMarkupContainer("selectAllContainer");
        cnt.add(selectAll = selectAllCheckbox());
        cnt.setVisible(selectable);
        listContainer.add(cnt);
       
        // add the sorting links
        listContainer.add(new ListView("sortableLinks", dataProvider.getVisibleProperties()) {

            @Override
            protected void populateItem(ListItem item) {
                Property<T> property = (Property<T>) item.getModelObject();

                // build a sortable link if the property is sortable, a label otherwise
                IModel titleModel = getPropertyTitle(property);
                if (property.getComparator() != null) {
                    Fragment f = new Fragment("header", "sortableHeader", item);
                    AjaxLink link = sortLink(dataProvider, item);
                    link.add(new Label("label", titleModel));
                    f.add(link);
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.