Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setTitle.

Prototype

public ModalWindow setTitle(IModel<String> title) 

Source Link

Document

Sets the title of window.

Usage

From source file:org.jaulp.wicket.data.provider.examples.refreshingview.ModalDialogWithStylePanel.java

License:Apache License

public ModalDialogWithStylePanel(String id) {
    super(id);/*from  w ww.  j  a  v a2 s .c o  m*/
    final ModalWindow modal = new ModalWindow("modal");
    modal.setCssClassName("w_vegas");
    modal.setTitle("Trivial Modal");

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

        @Override
        public void onClick(AjaxRequestTarget target) {

            target.appendJavaScript("var originalStyle = $('.wicket-modal').attr('style');"
                    + "$('.wicket-modal').attr('style', originalStyle + 'opacity: 0.5;');");
        }
    };
    Fragment modalFragment = new Fragment(modal.getContentId(), "modalContent", this);
    modalFragment.add(modalLink);
    modal.setContent(modalFragment);

    add(modal);
    add(new AjaxLink<Void>("openModal") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            modal.show(target);
        }
    });
}

From source file:org.obiba.onyx.jade.core.wicket.run.InstrumentRunPanel.java

License:Open Source License

/**
 * Build the panel with the current instrument run and a specified measure.
 * @param id/*from   w w w . j  a va2 s.  com*/
 * @param modal
 * @param measure
 */
public InstrumentRunPanel(String id, final ModalWindow modal, Measure measure) {
    super(id);

    InstrumentRun run = activeInstrumentRunService.getInstrumentRun();
    if (run == null) {
        throw new IllegalStateException("No instrument run in session.");
    }
    modal.setTitle(getTitle(run));
    setDefaultModel(new DetachableEntityModel(queryService, run));
    if (measure != null)
        setMeasure(measure);

    build();
}

From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.ModalFeedbackPanel.java

License:Open Source License

/**
 * @param id Component id.//w ww. ja  v  a  2s .  com
 * @param feedbackWindow ModalWindow in which the panel will be displayed.
 */
@SuppressWarnings("serial")
public ModalFeedbackPanel(final ModalWindow feedbackWindow) {
    super("content");
    feedbackWindow.setTitle(new StringResourceModel("ModalWindowTitle", this, null));
    feedbackWindow.setResizable(false);
    this.setEscapeModelStrings(false);

    add(new AjaxImageLink("close", new StringResourceModel("CloseModalButton", this, null)) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            feedbackWindow.close(target);
        }

    });

}

From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.QuestionCategoryOpenAnswerDefinitionPanel.java

License:Open Source License

private ModalWindow createPadModalWindow(String padId) {
    ModalWindow newPadWindow = new ModalWindow(padId);

    DataType type = getOpenAnswerDefinition().getDataType();
    if (type.equals(DataType.INTEGER) || type.equals(DataType.DECIMAL)) {
        pad = new NumericPad(newPadWindow.getContentId(), getQuestionModel(), getQuestionCategoryModel(),
                getOpenAnswerDefinitionModel()) {
            /**/*from  ww w . j  a  va2  s . c om*/
             * 
             */
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isRequired() {
                // is never required because in a array the pad allows deselecting the category when setting a null value
                return false;
            }
        };

        newPadWindow.setTitle(new StringResourceModel("NumericPadTitle", pad, null));
        newPadWindow.setContent(pad);
        newPadWindow.setCssClassName("onyx");
        newPadWindow.setInitialWidth(288);
        newPadWindow.setInitialHeight(365);
        newPadWindow.setResizable(false);

        // same as cancel
        newPadWindow.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
            private static final long serialVersionUID = 1L;

            public boolean onCloseButtonClicked(AjaxRequestTarget target) {
                return true;
            }
        });

        return newPadWindow;
    }
    throw new UnsupportedOperationException("Pad for type " + type + " not supported yet.");
}

From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.SimplifiedOpenAnswerDefinitionPanel.java

License:Open Source License

public AbstractOpenAnswerDefinitionPanel createPad(ModalWindow padWindow) {
    DataType type = getOpenAnswerDefinition().getDataType();
    if (type.equals(DataType.INTEGER) || type.equals(DataType.DECIMAL)) {
        NumericPad pad = new NumericPad(padWindow.getContentId(), getQuestionModel(),
                getQuestionCategoryModel(), getOpenAnswerDefinitionModel());
        padWindow.setTitle(new StringResourceModel("NumericPadTitle", pad, null));
        return pad;
    } else {//from  www . j a  v  a 2  s  . co  m
        throw new UnsupportedOperationException("Pad for type " + type + " not supported yet.");
    }
}

From source file:org.obiba.onyx.webapp.participant.page.InterviewPage.java

License:Open Source License

public InterviewPage() {
    super();//from  w  w  w  . ja va  2 s .c om

    if (activeInterviewService.getParticipant() == null || activeInterviewService.getInterview() == null) {
        setResponsePage(WebApplication.get().getHomePage());
    } else {

        addOrReplace(new EmptyPanel("header"));
        //
        // Modify menu bar.
        //
        remove("menuBar");
        add(new InterviewMenuBar("menuBar"));

        final InterviewLogPanel interviewLogPanel;
        final Dialog interviewLogsDialog;
        interviewLogPanel = new InterviewLogPanel("content", 338, new LoadableInterviewLogModel());
        interviewLogsDialog = DialogBuilder
                .buildDialog("interviewLogsDialog", new StringResourceModel("Log", this, null),
                        interviewLogPanel)
                .setOptions(Option.CLOSE_OPTION).setFormCssClass("interview-log-dialog-form").getDialog();
        interviewLogsDialog.setHeightUnit("em");
        interviewLogsDialog.setWidthUnit("em");
        interviewLogsDialog.setInitialHeight(34);
        interviewLogsDialog.setInitialWidth(59);
        interviewLogsDialog.setCloseButtonCallback(new CloseButtonCallback() {
            private static final long serialVersionUID = 1L;

            public boolean onCloseButtonClicked(AjaxRequestTarget target, Status status) {
                // Update comment count on interview page once the modal window closes. User may have added comments.
                updateCommentCount(target);
                return true;
            }
        });
        interviewLogPanel.setup(interviewLogsDialog);
        interviewLogPanel.add(new AttributeModifier("class", true, new Model("interview-log-panel-content")));
        interviewLogPanel.setMarkupId("interviewLogPanel");
        interviewLogPanel.setOutputMarkupId(true);

        add(interviewLogsDialog);

        Participant participant = activeInterviewService.getParticipant();

        add(new ParticipantPanel("participant", new DetachableEntityModel(queryService, participant), true));

        // Create modal comments window
        final ModalWindow commentsWindow;
        add(commentsWindow = new ModalWindow("addCommentsModal"));
        commentsWindow.setCssClassName("onyx");
        commentsWindow.setTitle(new StringResourceModel("CommentsWindow", this, null));
        commentsWindow.setHeightUnit("em");
        commentsWindow.setWidthUnit("em");
        commentsWindow.setInitialHeight(34);
        commentsWindow.setInitialWidth(50);

        commentsWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

            private static final long serialVersionUID = 1L;

            public void onClose(AjaxRequestTarget target) {

            }
        });

        ViewInterviewLogsLink viewCommentsIconLink = createIconLink("viewCommentsIconLink", interviewLogsDialog,
                interviewLogPanel, true);
        add(viewCommentsIconLink);
        ContextImage commentIcon = createContextImage("commentIcon", "icons/note.png");
        viewCommentsIconLink.add(commentIcon);

        ViewInterviewLogsLink viewLogIconLink = createIconLink("viewLogIconLink", interviewLogsDialog,
                interviewLogPanel, false);
        add(viewLogIconLink);
        ContextImage logIcon = createContextImage("logIcon", "icons/loupe_button.png");
        viewLogIconLink.add(logIcon);

        // Add view interview comments action
        add(viewComments = new ViewInterviewLogsLink("viewComments", interviewLogsDialog, interviewLogPanel,
                true) {

            private static final long serialVersionUID = -5561038138085317724L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                interviewLogPanel.setCommentsOnly(true);

                // Disable Show All Button
                target.appendJavascript(
                        "$('[name=showAll]').attr('disabled','true');$('[name=showAll]').css('color','rgba(0, 0, 0, 0.2)');$('[name=showAll]').css('border-color','rgba(0, 0, 0, 0.2)');");
                super.onClick(target);
            }

        });
        add(new ViewInterviewLogsLink("viewLog", interviewLogsDialog, interviewLogPanel, false) {

            private static final long serialVersionUID = -5561038138085317724L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                interviewLogPanel.setCommentsOnly(false);

                // Disable Show All Button
                target.appendJavascript(
                        "$('[name=showAll]').attr('disabled','true');$('[name=showAll]').css('color','rgba(0, 0, 0, 0.2)');$('[name=showAll]').css('border-color','rgba(0, 0, 0, 0.2)');");
                super.onClick(target);
            }

        });

        // Add create interview comments action
        add(addCommentDialog = createAddCommentDialog());
        add(new AjaxLink("addComment") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                addCommentDialog.show(target);
            }
        });

        // Initialize comments counter
        updateCommentsCount();

        ActiveInterviewModel interviewModel = new ActiveInterviewModel();

        kvPanel = new KeyValueDataPanel("interview");
        kvPanel.addRow(new StringResourceModel("StartDate", this, null),
                new PropertyModel(interviewModel, "startDate"));
        kvPanel.addRow(new StringResourceModel("EndDate", this, null),
                new PropertyModel(interviewModel, "endDate"));
        kvPanel.addRow(new StringResourceModel("Status", this, null),
                new PropertyModel(interviewModel, "status"));
        add(kvPanel);

        // Interview cancellation
        final ActionDefinition cancelInterviewDef = actionDefinitionConfiguration
                .getActionDefinition(ActionType.STOP, "Interview", null, null);
        final ActionWindow interviewActionWindow = new ActionWindow("modal") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) {
                activeInterviewService.setStatus(InterviewStatus.CANCELLED);
                setResponsePage(InterviewPage.class);
            }

        };
        add(interviewActionWindow);

        AjaxLink link = new AjaxLink("cancelInterview") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                Label label = new Label("content",
                        new StringResourceModel("ConfirmCancellationOfInterview", InterviewPage.this, null));
                label.add(new AttributeModifier("class", true, new Model("confirmation-dialog-content")));
                ConfirmationDialog confirmationDialog = getConfirmationDialog();

                confirmationDialog.setContent(label);
                confirmationDialog
                        .setTitle(new StringResourceModel("ConfirmCancellationOfInterviewTitle", this, null));
                confirmationDialog.setYesButtonCallback(new OnYesCallback() {

                    private static final long serialVersionUID = -6691702933562884991L;

                    public void onYesButtonClicked(AjaxRequestTarget target) {
                        interviewActionWindow.show(target, null, cancelInterviewDef);
                    }

                });
                confirmationDialog.show(target);
            }

            @Override
            public boolean isVisible() {
                InterviewStatus status = activeInterviewService.getInterview().getStatus();
                return (status == InterviewStatus.IN_PROGRESS || status == InterviewStatus.COMPLETED);
            }
        };
        MetaDataRoleAuthorizationStrategy.authorize(link, RENDER, "PARTICIPANT_MANAGER");
        add(link);

        // Interview closing
        final ActionDefinition closeInterviewDef = actionDefinitionConfiguration
                .getActionDefinition(ActionType.STOP, "Closed.Interview", null, null);
        final ActionWindow closeInterviewActionWindow = new ActionWindow("closeModal") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) {
                activeInterviewService.setStatus(InterviewStatus.CLOSED);
                setResponsePage(InterviewPage.class);
            }

        };
        add(closeInterviewActionWindow);

        AjaxLink closeLink = new AjaxLink("closeInterview") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                Label label = new Label("content",
                        new StringResourceModel("ConfirmClosingOfInterview", InterviewPage.this, null));
                label.add(new AttributeModifier("class", true, new Model("confirmation-dialog-content")));
                ConfirmationDialog confirmationDialog = getConfirmationDialog();

                confirmationDialog.setContent(label);
                confirmationDialog
                        .setTitle(new StringResourceModel("ConfirmClosingOfInterviewTitle", this, null));
                confirmationDialog.setYesButtonCallback(new OnYesCallback() {

                    private static final long serialVersionUID = -6691702933562884991L;

                    public void onYesButtonClicked(AjaxRequestTarget target) {
                        closeInterviewActionWindow.show(target, null, closeInterviewDef);
                    }

                });
                confirmationDialog.show(target);
            }

            @Override
            public boolean isVisible() {
                InterviewStatus status = activeInterviewService.getInterview().getStatus();
                return (status == InterviewStatus.IN_PROGRESS);
            }
        };
        MetaDataRoleAuthorizationStrategy.authorize(link, RENDER, "PARTICIPANT_MANAGER");
        add(closeLink);

        // Reinstate interview link
        add(createReinstateInterviewLink());

        // Print report link
        class ReportLink extends AjaxLink {

            private static final long serialVersionUID = 1L;

            public ReportLink(String id) {
                super(id);
            }

            @Override
            public void onClick(AjaxRequestTarget target) {
                getPrintableReportsDialog().show(target);
            }
        }

        ReportLink printReportLink = new ReportLink("printReport");
        printReportLink.add(new Label("reportLabel", new ResourceModel("PrintReport")));
        add(printReportLink);

        add(new StageSelectionPanel("stage-list", getFeedbackWindow()) {

            private static final long serialVersionUID = 1L;

            @Override
            public void onViewComments(AjaxRequestTarget target, String stage) {

                commentsWindow.setContent(new CommentsModalPanel("content", commentsWindow, stage) {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onAddComments(AjaxRequestTarget target) {
                        InterviewPage.this.updateCommentsCount();
                        target.addComponent(InterviewPage.this.commentsCount);
                    }

                });
                commentsWindow.show(target);
            }

            @Override
            public void onViewLogs(AjaxRequestTarget target, String stage, boolean commentsOnly) {
                interviewLogPanel.setStageName(stage);
                interviewLogPanel.setCommentsOnly(commentsOnly);
                interviewLogPanel.setReadOnly(true);
                interviewLogPanel.addInterviewLogComponent();

                interviewLogsDialog.show(target);
            }

            @Override
            public void onActionPerformed(AjaxRequestTarget target, Stage stage, Action action) {
                if (activeInterviewService.getStageExecution(action.getStage()).isFinal()) {
                    setResponsePage(InterviewPage.class);
                } else {
                    InterviewPage.this.updateCommentsCount();
                    target.addComponent(InterviewPage.this.commentsCount);
                }

            }

        });

        AjaxLink exitLink = new AjaxLink("exitInterview") {

            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                interviewManager.releaseInterview();
                setResponsePage(HomePage.class);
            }
        };
        add(exitLink);

    }
}

From source file:org.onexus.ui.api.utils.panels.HelpMark.java

License:Apache License

public HelpMark(final String panelId, final String title, final String displayLabel, final String helpText) {
    super(panelId);

    // Add modal window
    final ModalWindow modal = new ModalWindow("modalWindowEmbeeded");
    modal.setTitle(title);
    modal.setInitialWidth(700);/*from  w w w  .j a v  a 2s  .com*/
    modal.setInitialHeight(500);
    add(modal);

    // Add mark label
    final WebMarkupContainer container = new WebMarkupContainer("displayLabel");
    container.add(new Label("label", displayLabel));
    add(container);

    // Add question mark icon
    Image img = null;
    container.add(img = new Image("imageHelp", Icons.HELP) {

        @Override
        protected boolean shouldAddAntiCacheParameter() {
            return false;
        }

    });
    img.add(new AjaxEventBehavior("onclick") {

        @Override
        protected void onEvent(final AjaxRequestTarget target) {

            if (modal != null) {
                modal.setInitialWidth(700);
                modal.setInitialHeight(500);
                modal.setContent(new HelpContentPanel(modal.getContentId(), helpText));
                modal.show(target);
            }

        }

    });

    // Visible only if there is some
    setVisible(helpText != null);

}

From source file:org.onexus.website.api.utils.panels.HelpMark.java

License:Apache License

public HelpMark(final String panelId, final String title, final String displayLabel, final String helpText) {
    super(panelId);

    // Add modal window
    final ModalWindow modal = new ModalWindow("modalWindowEmbeeded");
    modal.setTitle(title);
    modal.setInitialWidth(700);/*from  www  .  jav a2  s  .  c o  m*/
    modal.setInitialHeight(500);
    add(modal);

    // Add mark label
    final WebMarkupContainer container = new WebMarkupContainer("displayLabel");
    container.add(new Label("label", displayLabel));
    add(container);

    // Add question mark icon
    Image img = new Image("imageHelp", Icons.HELP) {

        @Override
        protected boolean shouldAddAntiCacheParameter() {
            return false;
        }

    };

    container.add(img);
    img.add(new AjaxEventBehavior("onclick") {

        @Override
        protected void onEvent(final AjaxRequestTarget target) {

            if (modal != null) {
                modal.setInitialWidth(700);
                modal.setInitialHeight(500);
                modal.setContent(new HelpContentPanel(modal.getContentId(), helpText));
                modal.show(target);
            }

        }

    });

    // Visible only if there is some
    setVisible(helpText != null);

}

From source file:org.sakaiproject.attendance.tool.pages.BasePage.java

License:Educational Community License

protected AjaxLink<?> getAddEditWindowAjaxLink(final AttendanceEvent obj, final String id) {
    return new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        public void onClick(AjaxRequestTarget target) {
            final ModalWindow window = getAddOrEditItemWindow();
            window.setTitle(new ResourceModel("attendance.add.edit.header"));
            window.setContent(// www  . j  a v a  2  s  .c  om
                    new EventInputPanel(window.getContentId(), window, new CompoundPropertyModel<>(obj)));
            window.show(target);
        }
    };
}

From source file:org.sakaiproject.attendance.tool.pages.Overview.java

License:Educational Community License

private void createAddAttendanceItem() {
    final Form<?> addAttendanceItemForm = new Form<Void>("add-attendance-item-form");
    final AjaxButton addAttendanceItem = new AjaxButton("add-attendance-item") {
        @Override//from w w w .jav a  2 s .co  m
        public void onSubmit(final AjaxRequestTarget target, final Form form) {
            final ModalWindow window = getAddOrEditItemWindow();
            window.setTitle(new ResourceModel("attendance.add.header"));
            window.setContent(new EventInputPanel(window.getContentId(), window, null));
            window.show(target);
        }
    };

    addAttendanceItem.setDefaultFormProcessing(false);
    addAttendanceItem.setOutputMarkupId(true);
    addAttendanceItemForm.add(addAttendanceItem);

    add(addAttendanceItemForm);
}