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

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

Introduction

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

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

From source file:eu.uqasar.web.pages.admin.teams.panels.EditTeamPanel.java

License:Apache License

private SubmitLink newDeleteSelectedButton(final CheckGroup<TeamMembership> teamGroup) {
    SubmitLink submitLink = new SubmitLink("deleteSelected") {

        @Override/*from w  w  w . j  a va 2 s. c o  m*/
        protected void onConfigure() {
            super.onConfigure();
            // only enabled if at least one user is selected
            if (teamGroup.getModelObject().isEmpty()) {
                add(new CssClassNameAppender(Model.of("disabled")) {
                    private static final long serialVersionUID = 5588027455196328830L;

                    // remove css class when component is rendered again
                    @Override
                    public boolean isTemporary(Component component) {
                        return true;
                    }
                });
                setEnabled(false);
            } else {
                setEnabled(true);
            }
        }

        @Override
        public void onSubmit() {
            // TODO implement deletion of users!
            System.out.println("DELETE ME!");
        }
    };
    submitLink.setOutputMarkupId(true);
    return submitLink;
}

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

License:Apache License

private void initPage() {
    // make sure we start fresh      
    cleanUp();/*w w  w.  ja  v  a 2 s  . com*/

    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:org.sakaiproject.sitestats.tool.wicket.components.AjaxLazyLoadImage.java

License:Educational Community License

private SubmitLink createMaximizedLink(final String id) {
    SubmitLink link = new SubmitLink(id, form) {
        private static final long serialVersionUID = 1L;

        @Override//w  w w . ja  v  a  2  s .  co  m
        public void onSubmit() {
            if (returnPage != null || returnClass != null) {
                setResponsePage(new MaximizedImagePage(returnPage, returnClass) {
                    @Override
                    public byte[] getMaximizedImageData() {
                        int _width = (int) ((int) maxWidth * 0.98);
                        return AjaxLazyLoadImage.this.getImageData(_width, 2 * _width / 3);
                    }
                });
            }
            super.onSubmit();
        }
    };
    link.setOutputMarkupId(true);
    return link;
}