Example usage for org.apache.wicket.markup.html.form SubmitLink SubmitLink

List of usage examples for org.apache.wicket.markup.html.form SubmitLink SubmitLink

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form SubmitLink SubmitLink.

Prototype

public SubmitLink(String id) 

Source Link

Document

With this constructor the SubmitLink must be inside a Form.

Usage

From source file:nl.knaw.dans.dccd.web.authn.UserStatusChangeActionSelectionPanel.java

License:Apache License

public void init() {
    // Add selection and enable/disable the 'action buttons' using actionSelection

    // Acivate/*from   ww  w  .j  a  va  2 s  .co m*/
    SubmitLink userActivate = new SubmitLink("userActivate") {
        private static final long serialVersionUID = -661621354590046086L;

        public void onSubmit() {
            logger.debug("userActivate.onSubmit executed");
            getSelection().setSelectedAction(Action.ACTIVATE);
        }
    };
    add(userActivate);
    userActivate.setVisible(getSelection().isAlowedAction(Action.ACTIVATE));
    // confirmation, only for ACTIVATE
    if (getSelection().isAlowedAction(Action.ACTIVATE)) {
        if (getSelection().hasConfirmation(Action.ACTIVATE)) {
            userActivate.add(new LinkConfirmationBehavior(getSelection().getConfirmation(Action.ACTIVATE)));
        }
    }

    // Delete
    SubmitLink userDelete = new SubmitLink("userDelete") {
        private static final long serialVersionUID = -976047485479669445L;

        public void onSubmit() {
            logger.debug("userDelete.onSubmit executed");
            getSelection().setSelectedAction(Action.DELETE);
        }
    };
    add(userDelete);
    userDelete.setVisible(getSelection().isAlowedAction(Action.DELETE));

    // Restore
    SubmitLink userRestore = new SubmitLink("userRestore") {
        private static final long serialVersionUID = 317247670008469017L;

        public void onSubmit() {
            logger.debug("userRestore.onSubmit executed");
            getSelection().setSelectedAction(Action.RESTORE);
        }
    };
    add(userRestore);
    userRestore.setVisible(getSelection().isAlowedAction(Action.RESTORE));
}

From source file:nl.knaw.dans.dccd.web.upload.AdditionalAssociatedFilesUploadPage.java

License:Apache License

private void initPage() {
    // make sure we start fresh      
    cleanUp();/*from w  w w . ja  va 2  s.  co  m*/

    Project project = (Project) getDefaultModelObject();
    if (project == null)
        throw new IllegalArgumentException("Missing project");

    // test if I am allowed to change the project (owner or admin!)
    DccdUser user = (DccdUser) ((DccdSession) getSession()).getUser();
    if (!project.isManagementAllowed(user))
        throw new RestartResponseException(ErrorPage.class);

    // show minimal project info
    add(new Label("project_title", new PropertyModel(project, "title")));
    // need id as well

    // then list all associated files already there
    // you are allowed to see those
    List<DccdAssociatedFileBinaryUnit> units = project.getAssociatedFileBinaryUnits();
    logger.debug("# of associated files = " + units.size());
    add(new ListView<DccdAssociatedFileBinaryUnit>("stored_files", units) {
        public void populateItem(final ListItem<DccdAssociatedFileBinaryUnit> item) {
            final DccdAssociatedFileBinaryUnit unit = item.getModelObject();
            item.add(new Label("stored_files.filename", unit.getFileName()));
        }
    });

    // list of uploaded on this page
    uploadedFilesView = new ListView<File>("uploaded_files", new PropertyModel(this, "uploadedFiles")) {
        private static final long serialVersionUID = -8928838129580404599L;

        public void populateItem(final ListItem<File> item) {
            final File file = item.getModelObject();
            item.add(new Label("uploaded_files.filename", file.getName()));
        }
    };
    uploadedFilesView.setOutputMarkupId(true);
    add(uploadedFilesView);

    // upload additional ones
    logger.info("using temp dir for upload: " + tempDir);
    EasyUploadConfig uploadConfig = new EasyUploadConfig(tempDir);
    uploadConfig.setAutoRemoveMessages(true);
    EasyUpload uploadAssociatedFiles = new EasyUpload("associatedfiles_upload_panel", uploadConfig) {
        private static final long serialVersionUID = -3682853163107499006L;

        @Override
        public void onReceivedFiles(Map<String, String> clientParams, String basePath, List<File> files) {
            logger.debug("Associated files upload done!");
            // get the Files and put them in a list...
            addAssociatedFiles(files);
        }
    };
    // Unzip (when needed) first
    uploadAssociatedFiles.registerPostProcess(UnzipPostProcess.class);
    add(uploadAssociatedFiles);

    Form<Project> form = new Form<Project>("form") {
        private static final long serialVersionUID = 2395669492108652762L;

        @Override
        protected void onSubmit() {
            // empty
        }
    };
    add(form);

    SubmitLink cancelButton = new SubmitLink("cancel_button") {
        private static final long serialVersionUID = 4664735638750828620L;

        @Override
        public void onSubmit() {
            logger.debug("Cancel onSubmit is called");
            cancel();
        }

    };
    cancelButton.setOutputMarkupId(false);
    form.add(cancelButton);
    SubmitLink finishButton = new SubmitLink("finish_button") {
        private static final long serialVersionUID = 6288043958187838779L;

        @Override
        public void onSubmit() {
            logger.debug("Finish onSubmit is called");
            if (getUploadedFiles().isEmpty()) {
                logger.debug("Nothing to store");
                return; // Do nothing!
            }

            finish();
        }

    };
    finishButton.setOutputMarkupId(false);
    form.add(finishButton);

    // add javascript libraries
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/lib/json2.js")));
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/lib/jquery-1.3.2.min.js")));

    // for getting at the upload event handlers
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/EasyUpload.js")));
    // the page specific stuff
    add(HeaderContributor
            .forJavaScript(new ResourceReference(UploadFilesPage.class, "AdditionalFilesUpload.js")));
}

From source file:nl.knaw.dans.dccd.web.upload.UploadFilesPage.java

License:Apache License

private void initPage() {
    redirectIfNotLoggedIn();//from w w  w  .  j av  a 2s.  c o m

    logger.debug("Upload page constructor: " + Session.get().getId() + ", " + getId());

    // just to be sure we have a clean CombinedUpload
    reset();

    // Specify type of upload, so it can use this information when generating the status
    getCombinedUpload().setUploadType(uploadType);

    // get the system temp folder
    tempDir = System.getProperty("java.io.tmpdir");
    logger.info("using temp dir for upload: " + tempDir);

    Form form = new Form("form") {
        private static final long serialVersionUID = -941132362346269544L;

        @Override
        protected void onSubmit() {
            // empty
        }
    };
    add(form);

    // same configuration for both uploads
    EasyUploadConfig uploadConfig = new EasyUploadConfig(tempDir);
    uploadConfig.setAutoRemoveMessages(true);
    //uploadConfig.setAutoRemoveFiles(true);

    //--- Tridas
    // TODO put it in a Panel
    //
    // TRiDaS upload
    uploadTridas = new EasyUpload("tridas_upload_panel", uploadConfig) {
        private static final long serialVersionUID = 3910788086153129740L;

        @Override
        public void onReceivedFiles(Map<String, String> clientParams, String basePath, List<File> files) {
            // add to the original files
            getCombinedUpload().addOriginalFiles(files);

            // Always delete the temporary files
            FileUtil.deleteDirectory(new File(basePath));
            logger.info("Temp File(s) deleted");
            logger.debug("Tridas files upload done!");
        }
    };
    uploadTridas.registerPostProcess(TridasXMLUploadProcess.class);
    add(uploadTridas);

    tridasCombinedUploadHintsModel = new Model("");
    tridasCombinedUploadHintslabel = new Label("tridas_combined_upload_hints", tridasCombinedUploadHintsModel);
    tridasCombinedUploadHintslabel.setEscapeModelStrings(false);
    add(tridasCombinedUploadHintslabel);

    tridasCombinedUploadWarningsModel = new Model("");
    tridasCombinedUploadWarningslabel = new Label("tridas_combined_upload_warnings",
            tridasCombinedUploadWarningsModel);
    tridasCombinedUploadWarningslabel.setEscapeModelStrings(false);
    add(tridasCombinedUploadWarningslabel);

    tridasFilesUploadedMessageModel = new Model("");
    tridasFilesUploadedMessageLabel = new Label("tridas_files_uploaded_message",
            tridasFilesUploadedMessageModel);
    tridasFilesUploadedMessageLabel.setEscapeModelStrings(false);
    add(tridasFilesUploadedMessageLabel);

    // --- Tree ring data
    // TODO put it in a Panel
    //
    // upload external measurement values
    // Note: The GUI design says "Values" and the code will use "TreeRingData")
    uploadTreeRingData = new EasyUpload("measurements_upload_panel", uploadConfig) {
        private static final long serialVersionUID = 6954709169671339342L;

        @Override
        public void onReceivedFiles(Map<String, String> clientParams, String basePath, List<File> files) {
            // add to the original files
            getCombinedUpload().addOriginalFiles(files);

            // Always delete the temporary files
            FileUtil.deleteDirectory(new File(basePath));
            logger.info("Temp File(s) deleted");
            logger.debug("Value files upload done!");
        }
    };
    // Unzip (when needed) first
    uploadTreeRingData.registerPostProcess(UnzipPostProcess.class);
    uploadTreeRingData.registerPostProcess(TreeRingDataUploadProcess.class);
    add(uploadTreeRingData);

    treeRingDataCombinedUploadWarningsModel = new Model("");
    treeRingDataCombinedUploadWarningsLabel = new Label("values_combined_upload_warnings",
            treeRingDataCombinedUploadWarningsModel);
    treeRingDataCombinedUploadWarningsLabel.setEscapeModelStrings(false);
    add(treeRingDataCombinedUploadWarningsLabel);

    treeRingDataCombinedUploadErrorsModel = new Model("");
    treeRingDataCombinedUploadErrorsLabel = new Label("values_combined_upload_errors",
            treeRingDataCombinedUploadErrorsModel);
    treeRingDataCombinedUploadErrorsLabel.setEscapeModelStrings(false);
    add(treeRingDataCombinedUploadErrorsLabel);

    treeRingDataFilesUploadedMessageModel = new Model("");
    treeRingDataFilesUploadedMessageLabel = new Label("value_files_uploaded_message",
            treeRingDataFilesUploadedMessageModel);
    treeRingDataFilesUploadedMessageLabel.setEscapeModelStrings(false);
    add(treeRingDataFilesUploadedMessageLabel);

    //--- Associated files   
    add(new AssociatedFilesUploadSectionPanel("associated_files_upload_section_panel"));

    //---      

    // TODO: should construct a selection box for the fileformats
    // based on the possible formats from the Status (A POJO) instead
    // of having it hardcoded in the html, as it is now!
    // The actual selection should then be set in the onBeforeRender.
    final CombinedUploadStatus status = getStatus();

    // Start with the most important languages
    List<Locale> topLocales = LanguageProvider.getLocalesForAllOfficialEULanguages();
    // then the complete list (excluding the top ones!)
    List<Locale> allLocales = LanguageProvider.getLocalesForAllLanguagesExcluding(topLocales);
    List<Locale> locales = new ArrayList<Locale>();
    locales.addAll(topLocales);
    // How do we get a separator between the top and the rest?
    // we  make Locale that display's a separator and handle that bogus selection
    locales.add(new Locale("---"));
    // Note: you now need to filter out this selection on he client, JavaScript code
    locales.addAll(allLocales);
    // Note: we could make a class like LocaleDropDown,
    // but one that follows the curent Locale for the display values etc.
    DropDownChoice tridasLanguageSelection = new DropDownChoice("tridas_language",
            new PropertyModel(status, "tridasLanguage"), locales,
            new ChoiceRenderer("displayName", "language"));
    add(tridasLanguageSelection);

    List<TreeRingDataFileTypeSelection> list = status.getTreeRingDataFileTypeSelection().getSelectionList();
    // use the ChoiceRenderer
    // then the ajax get request also uses a 'readable' name instead of an index in the list
    ChoiceRenderer choiceRenderer = new ChoiceRenderer<TreeRingDataFileTypeSelection>("selection", "selection");
    fileTypeSelection = new DropDownChoice("measurements_filetype",
            new PropertyModel(status, "treeRingDataFileTypeSelection"), list, choiceRenderer);
    add(fileTypeSelection);

    // add javascript libraries
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/lib/json2.js")));
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/lib/jquery-1.3.2.min.js")));
    // for getting at the upload event handlers
    add(HeaderContributor.forJavaScript(new ResourceReference(EasyUpload.class, "js/EasyUpload.js")));

    // for the combined upload
    add(HeaderContributor.forJavaScript(new ResourceReference(UploadFilesPage.class, "CombinedUpload.js")));
    IModel variablesModel = new AbstractReadOnlyModel() {
        private static final long serialVersionUID = -7833455309187754952L;

        public Map<String, CharSequence> getObject() {
            Map<String, CharSequence> variables = new HashMap<String, CharSequence>(1);
            ResourceReference uploadStatusRef = new ResourceReference(
                    CombinedUploadStatusCommand.RESOURCE_NAME);
            variables.put("combinedUploadStatusRequestURL", getPage().urlFor(uploadStatusRef));
            return variables;
        }
    };
    add(TextTemplateHeaderContributor.forJavaScript(UploadFilesPage.class, "CombinedUploadConfig.js",
            variablesModel));

    uploadHintsModel = new Model("");
    uploadHintsLabel = new Label("upload_hints", uploadHintsModel);
    uploadHintsLabel.setEscapeModelStrings(false);
    add(uploadHintsLabel);

    // Actions (Buttons)
    /*
    backButton = new SubmitLink("back_button")
    {
     private static final long serialVersionUID = -8981750027400450695L;
     final String backMessage = "Do you really want to go back to the start of the upload procedure? " + 
    "This will discard the files you uploaded.";   
            
     @Override
     public void onSubmit()
     {
    // logger.debug("Back onSubmit is called");
    back();
     }
            
     @Override
     protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);
    String onclick = tag.getAttributes().getString("onclick");
    // Note when there is uploaded data to be discarded, we have readyToCancel==true
    final String jsString = 
       "if(g_combinedUploadStatus.readyToCancel){" + 
        "if(!confirm('" + backMessage + "')) return false;" +
        "else g_canBrowseaway=true;" +
        "}else g_canBrowseaway=true;";               
    onclick = jsString  + onclick;
    tag.getAttributes().put("onclick", onclick);
     }
    };
    form.add(backButton);
    */

    //cancelButton = new Button("combined_cancel_button", new ResourceModel("combined_cancel_button"))
    cancelButton = new SubmitLink("combined_cancel_button") {
        private static final long serialVersionUID = 2646137560758648463L;
        final String cancelMessage = "Do you really want to restart this step of the the upload procedure? "
                + "This will discard the files you uploaded.";

        @Override
        public void onSubmit() {
            logger.debug("Cancel onSubmit is called");
            cancel();
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            String onclick = tag.getAttributes().getString("onclick");
            final String jsString = "if(g_combinedUploadStatus.readyToCancel){" + "if(!confirm('"
                    + cancelMessage + "')) return false;" + "else g_canBrowseaway=true;"
                    + "}else g_canBrowseaway=true;";
            onclick = jsString + onclick;
            tag.getAttributes().put("onclick", onclick);
        }
    };
    cancelButton.setOutputMarkupId(false);
    form.add(cancelButton);

    //finish_and_upload_button
    finishAndUploadButton = new SubmitLink("finish_and_upload_button") {
        private static final long serialVersionUID = -5706070001789062239L;

        @Override
        public void onSubmit() {
            //logger.debug("finishAndUploadButton onSubmit is called");
            // don't browse away but reset and be ready to upload again!            
            finish();
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            String onclick = tag.getAttributes().getString("onclick");
            // disable the link when not ready to finish
            onclick = "if(g_combinedUploadStatus.readyToFinish)g_canBrowseaway=true;else return false; "
                    + onclick;
            tag.getAttributes().put("onclick", onclick);
        }
    };
    finishAndUploadButton.setOutputMarkupId(false);
    form.add(finishAndUploadButton);

    finishButton = new SubmitLink("finish_button") {
        private static final long serialVersionUID = -5706070001789062239L;

        @Override
        public void onSubmit() {
            // logger.debug("Finish onSubmit is called");
            finish();

            // Redirect to the projects view page...
            //setResponsePage(new ProjectsResultPage());
            // My Projects 
            // TODO go to the project
            // get Projects from CombinedUpload and then if there is only one, go to the view page?
            //setResponsePage(new MyProjectsPage());
            setResponsePage(new MyProjectsSearchResultPage());
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            String onclick = tag.getAttributes().getString("onclick");
            // disable the link when not ready to finish
            onclick = "if(g_combinedUploadStatus.readyToFinish)g_canBrowseaway=true;else return false; "
                    + onclick;
            tag.getAttributes().put("onclick", onclick);
        }
    };
    finishButton.setOutputMarkupId(false);
    form.add(finishButton);

    // Note: browsing/navigating away while there is uploaded data
    // is handled by a JavaScript window.onbeforeunload handler
}

From source file:nl.knaw.dans.dccd.web.upload.UploadIntroPage.java

License:Apache License

public UploadIntroPage() {
    uploadSelection = new UploadTypeSelection();

    Form form = new Form("form");
    add(form);/*from w w  w  . j a  v a 2  s .c o  m*/

    // TODO use html formatting for the "hint" texts in the properties file
    // Place it in a Label and use label.setEscapeModelStrings(false);
    form.add(new Label("hint_text", getString("hint")).setEscapeModelStrings(false));

    // upload type selection as Choice
    RadioChoice choice = new RadioChoice("selection", new PropertyModel(uploadSelection, "selection"),
            uploadSelection.getTypeList(), new EnumChoiceRenderer(this, null)) {
        private static final long serialVersionUID = -784957323409770888L;

        // NOTE disable the manual creation option, we don't have it YET
        // NOTE HARDCODED  to be the second option!
        @Override
        protected boolean isDisabled(Object object, int index, String selected) {
            if (index > 0)
                return true;
            else
                return false;
        }

    };
    choice.setEscapeModelStrings(false);
    form.add(choice);

    // Next
    form.add(new SubmitLink("next") {
        private static final long serialVersionUID = -4179679565306357773L;

        @Override
        public void onSubmit() {
            //logger.info("Next onSubmit is called");
            //logger.info("OnSubmit with selection: " + uploadSelection.getSelectionAsString());
            next();
        }
    });

    // Cancel
    form.add(new SubmitLink("cancel") {
        private static final long serialVersionUID = -3928218818189732662L;

        @Override
        public void onSubmit() {
            //logger.info("Cancel onSubmit is called");
            cancel();
        }
    });
}

From source file:org.antbear.jee.wicket.PlainDataView.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    add(new FeedbackPanel("feedback"));

    final DataView<Integer> dataView = new DataView<Integer>("list", new IntegerDataProvider()) {
        private static final long serialVersionUID = 1L;

        @Override/*from   ww w . j  a va2 s. com*/
        protected void populateItem(Item item) {
            item.add(new Label("text", item.getDefaultModelObjectAsString()));
        }
    };

    final Form<Void> form = new Form<Void>("form") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            ++submitCount;
            info("Form submitted " + submitCount + " times");
        }
    };

    final Button submitButton = new Button("submit") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            IntegerDatabase db = DatabaseLocator.locate();
            if (db.size() > 0) {
                db.removeLast();
            } else {
                error("No more items.");
            }
        }
    };

    add(form);
    form.add(dataView);
    form.add(submitButton);

    form.add(new SubmitLink("restoreDatabase") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            info("Database restored");
            DatabaseLocator.locate().restore();
        }
    });
}

From source file:org.antbear.jee.wicket.PlainList.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    add(new FeedbackPanel("feedback"));

    final List<Integer> listData = getList();
    final PropertyListView<Integer> listView = new PropertyListView<Integer>("list", listData) {
        private static final long serialVersionUID = 1L;

        @Override//w w w. j a v  a 2  s.  c  o  m
        protected void populateItem(ListItem<Integer> item) {
            item.add(new Label("text", item.getDefaultModelObjectAsString()));
            item.add(this.removeLink("remove", item));
        }
    };

    final Form<?> form = new Form<Void>("form") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            ++submitCounter;
            info("Form submitted " + submitCounter + " times");
        }
    };

    final Button submitButton = new Button("submit") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            if (listData.size() > 0) {
                listData.remove(listData.size() - 1);
                listView.setModelObject(listData);
            } else {
                error("No more items.");
            }
        }
    };

    add(form);
    form.add(listView);
    form.add(submitButton);

    form.add(new SubmitLink("restoreDatabase") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            info("Database restored");
            DatabaseLocator.locate().restore();
            List<Integer> l = getList();
            listView.setModelObject(l);
        }
    });
}

From source file:org.apache.isis.viewer.wicket.ui.util.Links.java

License:Apache License

public static <T extends Page> AbstractLink newSubmitLink(final String linkId,
        final PageParameters pageParameters, final Class<T> pageClass) {
    return new SubmitLink(linkId) {
        private static final long serialVersionUID = 1L;

        @Override//from w w  w . j  a  v  a 2 s . co m
        // TODO mgrigorov: consider overriding onAfterSubmit instead
        public void onSubmit() {
            getForm().setResponsePage(pageClass, pageParameters);
            super.onSubmit();
        }
    };
}

From source file:org.apache.karaf.webconsole.karaf.feature.repository.AddRepositoryPage.java

License:Apache License

@SuppressWarnings({ "rawtypes", "unchecked", "serial" })
public AddRepositoryPage() {
    final IModel<Repository> model = new Model(new WicketRepository());

    final Form<Repository> form = new Form<Repository>("form", model);
    form.add(new AddRepositoryPanel("repository", model));
    form.add(new SubmitLink("submit") {
        @Override/* w  w  w  . j  a va2s  .co m*/
        public void onSubmit() {
            URI uri = model.getObject().getURI();
            try {
                featuresService.addRepository(uri);
            } catch (Exception e) {
                Map<String, Object> map = new HashMap<String, Object>();
                map.put("uri", uri);
                form.error("Can not create repository " + e.getMessage(), map);
            }
        }
    });

    add(form);
}

From source file:org.apache.karaf.webconsole.osgi.config.ConfigurationEditPage.java

License:Apache License

@SuppressWarnings("serial")
public ConfigurationEditPage(PageParameters params) {
    pid = params.get("pid").toString();

    add(new Label("pid", pid));
    ConfigurationModel configuration = new ConfigurationModel(pid, configurationAdmin);
    setDefaultModel(configuration);/*from ww w.ja va2  s  .c  om*/

    @SuppressWarnings("unchecked")
    Map<String, String> properties = DictionaryUtils.map(configuration.getObject().getProperties());
    Map<String, String> system = ConfigurationFilterUtil.filter(properties);

    MapEditForm<String, String> mapEditForm = new MapEditForm<String, String>("edit",
            new CompoundPropertyModel<Map<String, String>>(properties)) {
        @Override
        protected void onSubmit() {
            Map<String, String> map = getModelObject();

            Configuration configuration = (Configuration) ConfigurationEditPage.this.getDefaultModelObject();
            try {
                if (configuration.getBundleLocation() != null) {
                    configuration.setBundleLocation(null);
                }
                configuration.update(DictionaryUtils.dictionary(map));

                Session.get().info("Configuration " + pid + " updated.");
                RequestCycle.get().setResponsePage(ConfigurationsPage.class);
            } catch (IOException e) {
                error("Unable to update configuration " + e.getMessage());
            }
        }
    };
    mapEditForm.add(new SubmitLink("submit"));
    add(mapEditForm);

    add(new MapDataTable<String, String>("system", new MapDataProvider<String, String>(system), 5));
}

From source file:org.apache.karaf.webconsole.osgi.log.OptionsForm.java

License:Apache License

@SuppressWarnings("serial")
public OptionsForm(String id, CompoundPropertyModel<Options> model) {
    super(id, model);

    IModel<Priority> priority = model.bind("priority");
    Select<Priority> select = new Select<Priority>("priority", priority);
    select.add(new SelectOptions<Priority>("options", Arrays.asList(Priority.values()),
            new IOptionRenderer<Priority>() {
                public String getDisplayValue(Priority object) {
                    return object.name();
                }//from  w w  w .j  a v a 2  s  . c  om

                public IModel<Priority> getModel(Priority value) {
                    return Model.of(value);
                }
            }));

    add(select);
    add(new TextField<Long>("dateFrom", Long.class));
    add(new TextField<Long>("dateTo", Long.class));
    add(new TextField<String>("messageFragment", String.class));
    add(new TextField<String>("bundleNameFragment", String.class));

    add(new SubmitLink("submit"));
}