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

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

Introduction

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

Prototype

public ModalWindow setCookieName(final String cookieName) 

Source Link

Document

Sets the name of the cookie that is used to remember window position (and size if the window is resizable).

Usage

From source file:org.syncope.console.pages.TaskModalPage.java

License:Apache License

public TaskModalPage(final TaskTO taskTO) {
    final TaskTO actual = taskTO.getId() == 0 ? taskTO
            : taskTO instanceof PropagationTaskTO ? taskRestClient.readPropagationTask(taskTO.getId())
                    : taskTO instanceof NotificationTaskTO ? taskRestClient.readNotificationTask(taskTO.getId())
                            : taskTO instanceof SyncTaskTO
                                    ? taskRestClient.readSchedTask(SyncTaskTO.class, taskTO.getId())
                                    : taskRestClient.readSchedTask(SchedTaskTO.class, taskTO.getId());

    taskTO.setExecutions(actual.getExecutions());

    final ModalWindow taskExecMessageWin = new ModalWindow("taskExecMessageWin");
    taskExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    taskExecMessageWin.setCookieName("task-exec-message-win-modal");
    add(taskExecMessageWin);//w  w  w . j  a v  a  2s  .  c  o m

    form = new Form("form");
    form.setModel(new CompoundPropertyModel(taskTO));
    add(form);

    profile = new WebMarkupContainer("profile");
    profile.setOutputMarkupId(true);
    form.add(profile);

    executions = new WebMarkupContainer("executions");
    executions.setOutputMarkupId(true);
    form.add(executions);

    final Label idLabel = new Label("idLabel", new ResourceModel("id"));
    profile.add(idLabel);

    final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"),
            new PropertyModel<String>(taskTO, "id"), false);

    id.setEnabled(false);
    profile.add(id);

    final List<IColumn> columns = new ArrayList<IColumn>();
    columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id"));

    columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate"));

    columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate"));

    columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status"));

    columns.add(new AbstractColumn<TaskExecTO>(new ResourceModel("actions", "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<TaskExecTO>> cellItem, final String componentId,
                final IModel<TaskExecTO> model) {

            final TaskExecTO taskExecutionTO = model.getObject();

            final ActionLinksPanel panel = new ActionLinksPanel(componentId, model);

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    taskExecMessageWin.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ExecMessageModalPage(model.getObject().getMessage());
                        }
                    });
                    taskExecMessageWin.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Tasks", "read",
                    StringUtils.hasText(model.getObject().getMessage()));

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        taskRestClient.deleteExecution(taskExecutionTO.getId());

                        taskTO.removeExecution(taskExecutionTO);

                        info(getString("operation_succeded"));
                    } catch (SyncopeClientCompositeErrorException scce) {
                        error(scce.getMessage());
                    }

                    target.add(feedbackPanel);
                    target.add(executions);
                }
            }, ActionLink.ActionType.DELETE, "Tasks", "delete");

            cellItem.add(panel);
        }
    });

    final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns,
            new TaskExecutionsProvider(taskTO), 10);

    executions.add(table);
}

From source file:org.syncope.console.pages.Users.java

License:Apache License

public Users(final PageParameters parameters) {
    super(parameters);

    // Modal window for editing user attributes
    final ModalWindow editModalWin = new ModalWindow("editModal");
    editModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    editModalWin.setInitialHeight(EDIT_MODAL_WIN_HEIGHT);
    editModalWin.setInitialWidth(EDIT_MODAL_WIN_WIDTH);
    editModalWin.setCookieName("edit-modal");
    add(editModalWin);/*from  w  w w  .j a v  a  2  s .com*/

    final ResultSetPanel searchResult = new ResultSetPanel("searchResult", true, null, getPageReference());
    add(searchResult);

    final ResultSetPanel listResult = new ResultSetPanel("listResult", false, null, getPageReference());
    add(listResult);

    // create new user
    final AjaxLink createLink = new IndicatingAjaxLink("createLink") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            editModalWin.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new EditUserModalPage(Users.this.getPageReference(), editModalWin, new UserTO());
                }
            });

            editModalWin.show(target);
        }
    };
    MetaDataRoleAuthorizationStrategy.authorize(createLink, ENABLE,
            xmlRolesReader.getAllAllowedRoles("Users", "create"));
    add(createLink);

    setWindowClosedReloadCallback(editModalWin);

    final Form searchForm = new Form("searchForm");
    add(searchForm);

    final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel");
    searchForm.add(searchPanel);

    searchForm.add(new IndicatingAjaxButton("search", new ResourceModel("search")) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {

            final NodeCond searchCond = searchPanel.buildSearchCond();
            LOG.debug("Node condition " + searchCond);

            doSearch(target, searchCond, searchResult);

            Session.get().getFeedbackMessages().clear();
            target.add(searchPanel.getSearchFeedback());
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form form) {

            target.add(searchPanel.getSearchFeedback());
        }
    });
}

From source file:org.wicketstuff.calendarviews.LargeView.java

License:Apache License

protected final void initializeDetailModalWindow(ModalWindow modal) {
    modal.setCookieName("calendar-detail-modal");
}