Package org.apache.wicket.model

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


*
*/
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

        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

* Displays a message suggesting the user to login or to elevate his privileges
*/
public class GeoServerErrorPage extends GeoServerBasePage {

    public GeoServerErrorPage(Page originatingPage, Throwable error) {
        IModel notice = null, errorText = new Model("");
       
        boolean trace = false;
        if (getSession().getAuthentication() != null &&
            getSession().getAuthentication().isAuthenticated())
        {
View Full Code Here

                    error(e);
                }
            }
        });

        IModel gsApp = new GeoServerApplicationModel();

        // controls whether wicket paths are being generated
        final AjaxCheckBox wicketPaths = new AjaxCheckBox("wicketPaths",
                new PropertyModel(gsApp, "debugSettings.outputComponentPath")) {
View Full Code Here

* Displays a message suggesting the user to login or to elevate his privileges
*/
public class UnauthorizedPage extends GeoServerBasePage {

    public UnauthorizedPage() {
        IModel model = null;
        if(getSession().getAuthentication() == null || !getSession().getAuthentication().isAuthenticated())
            model = new ResourceModel( "UnauthorizedPage.loginRequired" );
        else
            model = new ResourceModel( "UnauthorizedPage.insufficientPrivileges" );
        add(new Label("unauthorizedMessage", model));
View Full Code Here

    final FormComponent table;

    public ArcSDECoverageStoreEditPanel(final String componentId, final Form storeEditForm) {
        super(componentId, storeEditForm);

        final IModel model = storeEditForm.getModel();
        setModel(model);
        final CoverageStoreInfo storeInfo = (CoverageStoreInfo) storeEditForm.getModelObject();
        {
            Map<String, String> existingParameters = parseConnectionParameters(storeInfo);
            Map<String, Serializable> connectionParameters = storeInfo.getConnectionParameters();
            connectionParameters.putAll(existingParameters);
        }

        final IModel paramsModel = new PropertyModel(model, "connectionParameters");

        addConnectionPrototypePanel(storeInfo);

        // server, port, instance, user, pwd
        server = addTextPanel(paramsModel, SERVER_PARAM);
View Full Code Here

            /*
             * We're editing an existing store. Don't allow to change the table name, it could be
             * catastrophic for the Catalog/ResourcePool as ability to get to the coverage is really
             * based on the Store's URL and the CoverageInfo is tied to it
             */
            final IModel paramValue = new MapModel(paramsModel, TABLE_NAME);
            final String resourceKey = RESOURCE_KEY_PREFIX + "." + TABLE_NAME;
            final IModel paramLabelModel = new ResourceModel(resourceKey, TABLE_NAME);
            final boolean required = true;
            TextParamPanel tableNamePanel;
            tableNamePanel = new TextParamPanel(panelId, paramValue, paramLabelModel, required);
            add(tableNamePanel);

View Full Code Here

        }
        return sb.toString();
    }

    private void setUpDemoRequestsForm(final File demoDir) {
        final IModel requestModel = getModel();

        final Form demoRequestsForm;
        demoRequestsForm = new Form("demoRequestsForm");
        demoRequestsForm.setOutputMarkupId(true);
        demoRequestsForm.setModel(requestModel);
        add(demoRequestsForm);

        final List<String> demoList = getDemoList(demoDir);
        final DropDownChoice demoRequestsList;
        final IModel reqFileNameModel = new PropertyModel(requestModel, "requestFileName");
        demoRequestsList = new DropDownChoice("demoRequestsList", reqFileNameModel, demoList,
                new IChoiceRenderer() {
                    public String getIdValue(Object obj, int index) {
                        return String.valueOf(obj);
                    }
View Full Code Here

                defaultStyleUpdater.updateStyleImage(target);
            }
        });

        // build a palette with no reordering allowed, since order doesn't affect anything
        IModel stylesModel = LiveCollectionModel.set(new PropertyModel(layerModel, "styles"));
        Palette extraStyles = new Palette("extraStyles", stylesModel, styles,
                new StyleNameRenderer(), 10, false) {
            /**
             * Override otherwise the header is not i18n'ized
             */
 
View Full Code Here

TOP

Related Classes of org.apache.wicket.model.IModel

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.