Package org.apache.click

Examples of org.apache.click.ActionListener


        getForm().setButtonAlign(Form.ALIGN_RIGHT);
        getForm().setErrorsPosition(Form.POSITION_MIDDLE);

        previous = new Submit("previous");
        previous.setLabel("< Previous");
        getPreviousButton().setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onPrevious();
            }
        });
        form.add(previous);
        if (!getWizardPage().hasPreviousStep(this)) {
            previous.setDisabled(true);
        }

        next = new Submit("next");
        next.setLabel("Next >");
        getNextButton().setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onNext();
            }
        });
        form.add(next);
        if (!getWizardPage().hasNextStep(this)) {
            next.setDisabled(true);
        }

        finish = new Submit("Finish");
        getFinishButton().setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onFinish();
            }
        });
        form.add(finish);
        if (!getWizardPage().isLastStep(this)) {
            finish.setDisabled(true);
        }

        cancel = new Submit("Cancel");
        getCancelButton().setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onCancel();
            }
        });
        form.add(cancel);
View Full Code Here


        form.add(userNameField);
        form.add(passwordField);
        form.add(passwordAgainField);

        Submit submit = new Submit("create");
        submit.setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onCreate();
            }
        });
        form.add(submit);
View Full Code Here

        repeatIntervalField.add(new Option("86400000", "24 hours"));
        repeatIntervalField.setValue("3600000");
        fieldSet.add(repeatIntervalField);

        Submit saveSubmit = new Submit("Save");
        saveSubmit.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                return onSaveClick();
            }
        });
        form.add(saveSubmit);

        Submit cancelSubmit = new Submit("Cancel");
        cancelSubmit.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                setRedirect(QuartzJobSchedulerPage.class);
                return false;
            }
        });
View Full Code Here

        editLink.setTitle("Edit Job");
        addControl(editLink);

        pauseLink.setAttribute("class", "actionIcon");
        pauseLink.setTitle("Pause Job");
        pauseLink.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                String name = pauseLink.getValue();
                getSchedulerService().pauseJob(name);
                setFlashMessage("Paused job '" + name + "'");
                return true;
            }
        });
        addControl(pauseLink);

        interruptLink.setAttribute("class", "actionIcon");
        interruptLink.setTitle("Interrupt Running Job");
        interruptLink.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                String name = interruptLink.getValue();
                if (getSchedulerService().interuptJob(name)) {
                    setFlashMessage("Interrupted job '" + name + "'");
                } else {
                    setFlashMessage("Could not interrupt job '" + name + "'");
                }
                return true;
            }
        });
        addControl(interruptLink);

        triggerLink.setAttribute("class", "actionIcon");
        triggerLink.setTitle("Trigger Job");
        triggerLink.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                String name = triggerLink.getValue();
                getSchedulerService().triggerJob(name);
                setFlashMessage("Triggered job '" + name +  "'");
                return true;
            }
        });
        addControl(triggerLink);

        resumeLink.setAttribute("class", "actionIcon");
        resumeLink.setTitle("Resume Job");
        resumeLink.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                String name = resumeLink.getValue();
                getSchedulerService().resumeJob(name);
                setFlashMessage("Resumed job '" + name + "'");
                return true;
            }
        });
        addControl(resumeLink);

        deleteLink.setAttribute("class", "actionIcon");
        deleteLink.setTitle("Delete Job");
        String confirmMessage = getMessage("deleteConfirm", "Job");
        deleteLink.setAttribute("onclick", "return window.confirm('" + confirmMessage + "')");
        deleteLink.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                String name = deleteLink.getValue();
                if (getSchedulerService().deleteJob(name)) {
                    setFlashMessage("Deleted job '" + name + "'");
                } else {
                    setFlashMessage("Could not delete " + name);
                }
                return true;
            }
        });
        addControl(deleteLink);

        // Add table action column if user has edit or delete permissions
        final Column actionColumn = new Column("action");

        // Render action controls based on users permission
        actionColumn.setDecorator(new Decorator() {
            public String render(Object object, Context context) {
                JobAndSimpleTrigger jobAndTrigger = (JobAndSimpleTrigger) object;

                HtmlStringBuffer buffer = new HtmlStringBuffer();

                editLink.setParameter("job.name", jobAndTrigger.getJob().getName());
                editLink.render(buffer);

                buffer.append(" | ");
                deleteLink.setValue(jobAndTrigger.getJob().getName());
                deleteLink.render(buffer);

                if (!getSchedulerService().isPaused()) {

                    if (jobAndTrigger.getTriggerState() == Trigger.STATE_PAUSED) {
                        buffer.append(" | ");
                        resumeLink.setValue(jobAndTrigger.getJob().getName());
                        resumeLink.render(buffer);

                    } else {
                        buffer.append(" | ");
                        pauseLink.setValue(jobAndTrigger.getJob().getName());
                        pauseLink.render(buffer);
                    }

                    buffer.append(" | ");
                    triggerLink.setValue(jobAndTrigger.getJob().getName());
                    triggerLink.render(buffer);

                    if (jobAndTrigger.getTriggerState() == Trigger.STATE_BLOCKED) {
                        buffer.append(" | ");
                        interruptLink.setValue(jobAndTrigger.getJob().getName());
                        interruptLink.render(buffer);
                    }
                }

                return buffer.toString();
            }

        });
        actionColumn.setSortable(false);
        table.addColumn(actionColumn);

        // Add Control Buttons.

        newJob.setActionListener(new ActionListener(){
            public boolean onAction(Control source) {
                setRedirect(QuartzJobAndTriggerPage.class);
                return false;
            }
        });
View Full Code Here

    @Bindable protected ActionButton button = new ActionButton();
    @Bindable protected String clicked;

    public ActionDemo() {

        link.setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                clicked = source.getClass().getName() + ".onAction invoked at " + (new Date());
                return true;
            }
        });
View Full Code Here

    /**
     * Create a new Page instance.
     */
    public ControlListenerType2Page() {
        myLink.setActionListener(new ActionListener() {
            public boolean onAction(Control control) {
                 msg = "ControlListenerPage#" + hashCode()
                 + " object method <tt>onAction()</tt> invoked.";

             return true;
View Full Code Here

        // Add the submit link to the fieldSet
        fieldSet.add(submitLink);

        // The SubmitLink action listener
        submitLink.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                demo1Msg = submitLink.getName() + ".onAction invoked at "
                    + (new Date());
                return true;
View Full Code Here

        // Add the parameterized submit link to the FieldSet
        fieldSet.add(paramLink);

        // The Parameterized SubmitLink action listener
        paramLink.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                demo2Msg = paramLink.getName() + ".onAction invoked at "
                    + (new Date());
                demo2Msg += "<br>Parameters:" + paramLink.getParameters();
View Full Code Here

        // Add the Standalone SubmitLink to the Page
        addControl(standaloneLink);

        // The Standalone SubmitLink action listener
        standaloneLink.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                demo3Msg = source.getName() + ".onAction invoked at " +
                    (new Date());
                return true;
View Full Code Here

        // is defined in the page template -> submit-link-demo.htm
        String clickEvent = "return confirmSubmit(this, '" + form.getName() + "', 'Are you sure?');";
        confirmationLink.setOnClick(clickEvent);

        // The Parameterized SubmitLink action listener
        confirmationLink.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                demo4Msg = confirmationLink.getName() + ".onAction invoked at "
                    + (new Date());
                return true;
View Full Code Here

TOP

Related Classes of org.apache.click.ActionListener

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.