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

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

Introduction

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

Prototype

public ModalWindow(final String id) 

Source Link

Document

Creates a new modal window component.

Usage

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

License:Apache License

public TaskModalPage(final AbstractTaskTO taskTO) {
    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 ava2  s  . c  o  m

    form = new Form<AbstractTaskTO>(FORM);
    form.setModel(new CompoundPropertyModel<AbstractTaskTO>(taskTO));
    add(form);

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

    executions = new WebMarkupContainer("executionContainer");
    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"));

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

    final List<IColumn<TaskExecTO, String>> columns = new ArrayList<IColumn<TaskExecTO, String>>();

    final int paginatorRows = 10;

    columns.add(new PropertyColumn<TaskExecTO, String>(new ResourceModel("id"), "id", "id"));

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

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

    columns.add(new PropertyColumn<TaskExecTO, String>(new ResourceModel("status"), "status", "status"));

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

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public ActionLinksPanel getActions(final String componentId, final IModel<TaskExecTO> model) {

            final TaskExecTO taskExecutionTO = model.getObject();

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

            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, 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.getExecutions().remove(taskExecutionTO);

                        info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (SyncopeClientException scce) {
                        error(scce.getMessage());
                    }

                    feedbackPanel.refresh(target);
                    target.add(executions);
                }
            }, ActionLink.ActionType.DELETE, TASKS);

            return panel;
        }

        @Override
        public Component getHeader(final String componentId) {
            final ActionLinksPanel panel = new ActionLinksPanel(componentId, new Model(), getPageReference());

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    if (target != null) {
                        final AjaxFallbackDefaultDataTable<TaskExecTO, String> currentTable = new AjaxFallbackDefaultDataTable<TaskExecTO, String>(
                                "executionsTable", columns,
                                new TaskExecutionsProvider(getCurrentTaskExecution(taskTO)), paginatorRows);
                        currentTable.setOutputMarkupId(true);
                        target.add(currentTable);
                        executions.addOrReplace(currentTable);
                    }
                }
            }, ActionLink.ActionType.RELOAD, TASKS, "list");

            return panel;
        }
    });

    final AjaxFallbackDefaultDataTable<TaskExecTO, String> table = new AjaxFallbackDefaultDataTable<TaskExecTO, String>(
            "executionsTable", columns, new TaskExecutionsProvider(getCurrentTaskExecution(taskTO)),
            paginatorRows);

    executions.add(table);
}

From source file:org.apache.syncope.console.pages.Todo.java

License:Apache License

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

    add(window = new ModalWindow("editApprovalWin"));

    container = new WebMarkupContainer("approvalContainer");

    MetaDataRoleAuthorizationStrategy.authorize(container, RENDER,
            xmlRolesReader.getAllAllowedRoles("Approval", "list"));

    paginatorRows = prefMan.getPaginatorRows(getRequest(), Constants.PREF_TODO_PAGINATOR_ROWS);

    List<IColumn<WorkflowFormTO, String>> columns = new ArrayList<IColumn<WorkflowFormTO, String>>();
    columns.add(new PropertyColumn<WorkflowFormTO, String>(new ResourceModel("taskId"), "taskId", "taskId"));
    columns.add(new PropertyColumn<WorkflowFormTO, String>(new ResourceModel("key"), "key", "key"));
    columns.add(new PropertyColumn<WorkflowFormTO, String>(new ResourceModel("description"), "description",
            "description"));
    columns.add(new DatePropertyColumn<WorkflowFormTO>(new ResourceModel("createTime"), "createTime",
            "createTime"));
    columns.add(new DatePropertyColumn<WorkflowFormTO>(new ResourceModel("dueDate"), "dueDate", "dueDate"));
    columns.add(new PropertyColumn<WorkflowFormTO, String>(new ResourceModel("owner"), "owner", "owner"));
    columns.add(new AbstractColumn<WorkflowFormTO, String>(new ResourceModel("actions", "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override/*from  ww w .ja v a2 s. co  m*/
        public String getCssClass() {
            return "action";
        }

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

            final WorkflowFormTO formTO = model.getObject();

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

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        restClient.claimForm(formTO.getTaskId());
                        info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (SyncopeClientException scee) {
                        error(getString(Constants.ERROR) + ": " + scee.getMessage());
                    }
                    feedbackPanel.refresh(target);
                    target.add(container);
                }
            }, ActionLink.ActionType.CLAIM, "Approval");

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

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

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ApprovalModalPage(Todo.this.getPageReference(), window, formTO);
                        }
                    });

                    window.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Approval",
                    SyncopeSession.get().getUsername().equals(formTO.getOwner()));

            cellItem.add(panel);
        }
    });

    final AjaxFallbackDefaultDataTable<WorkflowFormTO, String> approvalTable = new AjaxFallbackDefaultDataTable<WorkflowFormTO, String>(
            "approvalTable", columns, new ApprovalProvider(), paginatorRows);
    container.add(approvalTable);

    container.setOutputMarkupId(true);
    add(container);

    @SuppressWarnings("rawtypes")
    Form approvalPaginatorForm = new Form("paginatorForm");

    MetaDataRoleAuthorizationStrategy.authorize(approvalPaginatorForm, RENDER,
            xmlRolesReader.getAllAllowedRoles("Approval", "list"));

    @SuppressWarnings({ "unchecked", "rawtypes" })
    final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser",
            new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices());

    rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            prefMan.set(getRequest(), getResponse(), Constants.PREF_TODO_PAGINATOR_ROWS,
                    String.valueOf(paginatorRows));
            approvalTable.setItemsPerPage(paginatorRows);

            target.add(container);
        }
    });

    approvalPaginatorForm.add(rowsChooser);
    add(approvalPaginatorForm);

    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setInitialHeight(WIN_HEIGHT);
    window.setInitialWidth(WIN_WIDTH);
    window.setCookieName("edit-approval-modal");

    setWindowClosedCallback(window, container);
}

From source file:org.apache.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 ww  w.  j a va2s  .  c o  m*/

    final AbstractSearchResultPanel searchResult = new UserSearchResultPanel("searchResult", true, null,
            getPageReference(), restClient);
    add(searchResult);

    final AbstractSearchResultPanel listResult = new UserSearchResultPanel("listResult", false, null,
            getPageReference(), restClient);
    add(listResult);

    // create new user
    final AjaxLink<Void> createLink = new ClearIndicatingAjaxLink<Void>("createLink", getPageReference()) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        protected void onClickInternal(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.Builder("searchPanel").build();
    searchForm.add(searchPanel);

    final ClearIndicatingAjaxButton searchButton = new ClearIndicatingAjaxButton("search",
            new ResourceModel("search"), getPageReference()) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
            final String fiql = searchPanel.buildFIQL();
            LOG.debug("FIQL: " + fiql);

            doSearch(target, fiql, searchResult);

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

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

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

    searchForm.add(searchButton);
    searchForm.setDefaultButton(searchButton);
}

From source file:org.apache.syncope.console.SyncopeApplication.java

License:Apache License

public void setupNavigationPanel(final WebPage page, final XMLRolesReader xmlRolesReader,
        final boolean notsel) {
    final ModalWindow infoModal = new ModalWindow("infoModal");
    page.add(infoModal);/*ww  w . j  a  va 2  s  .  c  om*/
    infoModal.setInitialWidth(350);
    infoModal.setInitialHeight(300);
    infoModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    infoModal.setCookieName("infoModal");
    infoModal.setPageCreator(new ModalWindow.PageCreator() {

        private static final long serialVersionUID = -7834632442532690940L;

        @Override
        public Page createPage() {
            return new InfoModalPage();
        }
    });

    final AjaxLink<Page> infoLink = new AjaxLink<Page>("infoLink") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            infoModal.show(target);
        }
    };
    page.add(infoLink);

    BookmarkablePageLink<Page> schemaLink = new BookmarkablePageLink<Page>("schema", Schema.class);
    MetaDataRoleAuthorizationStrategy.authorize(schemaLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Schema", "list"));
    page.add(schemaLink);
    schemaLink.add(new Image("schemaIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "schema" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> usersLink = new BookmarkablePageLink<Page>("users", Users.class);
    MetaDataRoleAuthorizationStrategy.authorize(usersLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Users", "list"));
    page.add(usersLink);
    usersLink.add(new Image("usersIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "users" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> rolesLink = new BookmarkablePageLink<Page>("roles", Roles.class);
    MetaDataRoleAuthorizationStrategy.authorize(rolesLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Roles", "list"));
    page.add(rolesLink);
    rolesLink.add(new Image("rolesIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "roles" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> resourcesLink = new BookmarkablePageLink<Page>("resources", Resources.class);
    MetaDataRoleAuthorizationStrategy.authorize(resourcesLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Resources", "list"));
    page.add(resourcesLink);
    resourcesLink.add(new Image("resourcesIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "resources" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> todoLink = new BookmarkablePageLink<Page>("todo", Todo.class);
    MetaDataRoleAuthorizationStrategy.authorize(todoLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Approval", "list"));
    page.add(todoLink);
    todoLink.add(new Image("todoIcon",
            new ContextRelativeResource(IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "todo" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> reportLink = new BookmarkablePageLink<Page>("reports", Reports.class);
    MetaDataRoleAuthorizationStrategy.authorize(reportLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Reports", "list"));
    page.add(reportLink);
    reportLink.add(new Image("reportsIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "reports" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> configurationLink = new BookmarkablePageLink<Page>("configuration",
            Configuration.class);
    MetaDataRoleAuthorizationStrategy.authorize(configurationLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Configuration", "list"));
    page.add(configurationLink);
    configurationLink.add(new Image("configurationIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "configuration" + Constants.PNG_EXT)));

    BookmarkablePageLink<Page> taskLink = new BookmarkablePageLink<Page>("tasks", Tasks.class);
    MetaDataRoleAuthorizationStrategy.authorize(taskLink, WebPage.ENABLE,
            xmlRolesReader.getAllAllowedRoles("Tasks", "list"));
    page.add(taskLink);
    taskLink.add(new Image("tasksIcon", new ContextRelativeResource(
            IMG_PREFIX + (notsel ? IMG_NOTSEL : "") + "tasks" + Constants.PNG_EXT)));

    page.add(new BookmarkablePageLink<Page>("logout", Logout.class));
}

From source file:org.apache.syncope.console.SyncopeApplication.java

License:Apache License

public void setupEditProfileModal(final WebPage page, final UserSelfRestClient userSelfRestClient) {
    // Modal window for editing user profile
    final ModalWindow editProfileModalWin = new ModalWindow("editProfileModal");
    editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    editProfileModalWin.setInitialHeight(EDIT_PROFILE_WIN_HEIGHT);
    editProfileModalWin.setInitialWidth(EDIT_PROFILE_WIN_WIDTH);
    editProfileModalWin.setCookieName("edit-profile-modal");
    page.add(editProfileModalWin);/*from  w  w  w . j  a v a  2s .  com*/

    final AjaxLink<Page> editProfileLink = new AjaxLink<Page>("editProfileLink") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            final UserTO userTO = SyncopeSession.get().isAuthenticated() ? userSelfRestClient.read()
                    : new UserTO();

            editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new UserSelfModalPage(page.getPageReference(), editProfileModalWin, userTO);
                }
            });

            editProfileModalWin.show(target);
        }
    };

    editProfileLink.add(new Label("username", SyncopeSession.get().getUsername()));

    if ("admin".equals(SyncopeSession.get().getUsername())) {
        editProfileLink.setEnabled(false);
    }

    page.add(editProfileLink);
}

From source file:org.brixcms.plugin.prototype.ManagePrototypesPanel.java

License:Apache License

public ManagePrototypesPanel(String id, final IModel<Workspace> model) {
    super(id, model);
    setOutputMarkupId(true);//from   w  w  w .ja va 2 s.  co  m

    IModel<List<Workspace>> prototypesModel = new LoadableDetachableModel<List<Workspace>>() {
        @Override
        protected List<Workspace> load() {
            List<Workspace> list = PrototypePlugin.get().getPrototypes();
            return getBrix().filterVisibleWorkspaces(list, Context.ADMINISTRATION);
        }
    };

    Form<Void> modalWindowForm = new Form<Void>("modalWindowForm");
    add(modalWindowForm);

    final ModalWindow modalWindow = new ModalWindow("modalWindow");
    modalWindow.setInitialWidth(64);
    modalWindow.setWidthUnit("em");
    modalWindow.setUseInitialHeight(false);
    modalWindow.setResizable(false);
    modalWindow.setTitle(new ResourceModel("selectItems"));
    modalWindowForm.add(modalWindow);

    add(new ListView<Workspace>("prototypes", prototypesModel) {
        @Override
        protected IModel<Workspace> getListItemModel(IModel<? extends List<Workspace>> listViewModel,
                int index) {
            return new WorkspaceModel(listViewModel.getObject().get(index));
        }

        @Override
        protected void populateItem(final ListItem<Workspace> item) {
            PrototypePlugin plugin = PrototypePlugin.get();
            final String name = plugin.getUserVisibleName(item.getModelObject(), false);

            item.add(new Label("label", name));
            item.add(new Link<Void>("browse") {
                @Override
                public void onClick() {
                    model.setObject(item.getModelObject());
                }
            });

            item.add(new AjaxLink<Void>("restoreItems") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    String prototypeId = item.getModelObject().getId();
                    String targetId = ManagePrototypesPanel.this.getModelObject().getId();
                    Panel panel = new RestoreItemsPanel(modalWindow.getContentId(), prototypeId, targetId);
                    modalWindow.setTitle(new ResourceModel("selectItems"));
                    modalWindow.setContent(panel);
                    modalWindow.show(target);
                }

                @Override
                public boolean isVisible() {
                    Workspace target = ManagePrototypesPanel.this.getModelObject();
                    Action action = new RestorePrototypeAction(Context.ADMINISTRATION, item.getModelObject(),
                            target);
                    return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
                }
            });

            item.add(new Link<Void>("delete") {
                @Override
                public void onClick() {
                    Workspace prototype = item.getModelObject();
                    prototype.delete();
                }

                @Override
                public boolean isVisible() {
                    Action action = new DeletePrototypeAction(Context.ADMINISTRATION, item.getModelObject());
                    return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
                }
            });
        }
    });

    Form<Object> form = new Form<Object>("form") {
        @Override
        public boolean isVisible() {
            Workspace current = ManagePrototypesPanel.this.getModelObject();
            Action action = new CreatePrototypeAction(Context.ADMINISTRATION, current);
            return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
        }
    };

    TextField<String> prototypeName = new TextField<String>("prototypeName",
            new PropertyModel<String>(this, "prototypeName"));
    form.add(prototypeName);

    prototypeName.setRequired(true);
    prototypeName.add(new UniquePrototypeNameValidator());

    final FeedbackPanel feedback;

    add(feedback = new FeedbackPanel("feedback"));
    feedback.setOutputMarkupId(true);

    form.add(new AjaxButton("submit") {
        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            String workspaceId = ManagePrototypesPanel.this.getModelObject().getId();
            CreatePrototypePanel panel = new CreatePrototypePanel(modalWindow.getContentId(), workspaceId,
                    ManagePrototypesPanel.this.prototypeName);
            modalWindow.setContent(panel);
            modalWindow.setTitle(new ResourceModel("selectItemsToCreate"));
            modalWindow.setWindowClosedCallback(new WindowClosedCallback() {
                public void onClose(AjaxRequestTarget target) {
                    target.addComponent(ManagePrototypesPanel.this);
                }
            });
            modalWindow.show(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    });

    add(form);
}

From source file:org.cdlflex.charts.modalwindow.ModalWindowPage.java

License:Apache License

public ModalWindowPage() {

    final ModalWindow window = new ModalWindow("modalWindow");
    window.setContent(new ChartPanel("content"));
    this.add(window);

    Button button = new Button("button");
    button.add(new AjaxEventBehavior("onclick") {
        private static final long serialVersionUID = 1L;

        @Override/*from  w w w .j  a v a  2s . c  om*/
        protected void onEvent(AjaxRequestTarget target) {
            window.show(target);
        }
    });
    this.add(button);

}

From source file:org.dcm4chee.dashboard.ui.report.ReportPanel.java

License:LGPL

public ReportPanel(String id) {
    super(id);//  ww  w  .  j  a  va2 s . com

    add(createGroupWindow = new ModalWindow("create-group-window")
            .setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = 1L;

                @Override
                public Page createPage() {
                    return new CreateGroupPage(createGroupWindow);
                }
            }));

    int[] winSize = DashboardCfgDelegate.getInstance().getWindowSize("createGroup");
    add(new ModalWindowLink("toggle-group-form-link", createGroupWindow, winSize[0], winSize[1])
            .add(new Image("toggle-group-form-image", ImageManager.IMAGE_COMMON_ADD)
                    .add(new ImageSizeBehaviour("vertical-align: middle;")))
            .add(new Label("dashboard.report.add-group-form.title",
                    new ResourceModel("dashboard.report.add-group-form.title")))
            .add(new TooltipBehaviour("dashboard.report."))
            .add(new SecurityBehavior(getModuleName() + ":newGroupLink")));

    add(modalWindow = new ModalWindow("modal-window"));
}

From source file:org.dcm4chee.usr.ui.usermanagement.role.aet.AETGroupListPanel.java

License:LGPL

public AETGroupListPanel(String id) {
    super(id);/*from   ww  w .j  a v  a 2  s.com*/
    windowsizeMap.put("editAETGroup", UsrCfgDelegate.getInstance().getWindowSize("editAETGroup"));
    windowsizeMap.put("aetAssignment", UsrCfgDelegate.getInstance().getWindowSize("aetAssignment"));

    userAccess = (UserAccess) JNDIUtils.lookup(UserAccess.JNDI_NAME);
    setOutputMarkupId(true);

    allAETGroups.setObject(userAccess.getAllAETGroups());

    add(aetGroupWindow = new ModalWindow("aet-group-window"));
    add(aetAssignmentWindow = new ModalWindow("aet-assignment-window"));

    add(this.confirmationWindow = new ConfirmationWindow<AETGroup>("confirmation-window") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onConfirmation(AjaxRequestTarget target, AETGroup aetGroup) {
            userAccess.removeAETGroup(aetGroup);
            Auditlog.logSoftwareConfiguration(true, "AEGroup " + aetGroup + " removed.");
            target.addComponent(AETGroupListPanel.this);
            allAETGroups.setObject(userAccess.getAllAETGroups());
        }
    });

    int[] winSize = windowsizeMap.get("editAETGroup");
    add(new ModalWindowLink("toggle-aet-group-form-link", aetGroupWindow, winSize[0], winSize[1]) {
        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public Page createPage() {
                    return new CreateOrEditAETGroupPage(aetGroupWindow, allAETGroups, null);
                }
            });
            super.onClick(target);
        }
    }.add(new Image("toggle-aet-group-form-image", ImageManager.IMAGE_USER_AET_GROUP_ADD)
            .add(new ImageSizeBehaviour("vertical-align: middle;")))
            .add(new Label("aetgrouplist.add-aet-group-form.title",
                    new ResourceModel("aetgrouplist.add-aet-group-form.title")))
            .add(new TooltipBehaviour("aetgrouplist."))
            .add(new SecurityBehavior(getModuleName() + ":newAETGroupLink")));

    add((new Label("groupname", new ResourceModel("aetgrouplist.universalmatch.label"))
            .add(new AttributeModifier("title", true,
                    new ResourceModel("aetgrouplist.universalmatch.description")))));
    add(new Label("assigned-aets", new ResourceModel("aetgrouplist.universalmatch.text")));
}

From source file:org.dcm4chee.usr.ui.usermanagement.role.group.GroupListPanel.java

License:LGPL

public GroupListPanel(String id) {
    super(id);/*from ww  w .  ja v a2  s . c o  m*/

    winSize = UsrCfgDelegate.getInstance().getWindowSize("editGroup");

    userAccess = (UserAccess) JNDIUtils.lookup(UserAccess.JNDI_NAME);
    setOutputMarkupId(true);

    allGroups = new ListModel<Group>(getAllGroups());

    add(this.confirmationWindow = new ConfirmationWindow<Group>("confirmation-window") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onConfirmation(AjaxRequestTarget target, Group group) {
            userAccess.removeGroup(group);
            Auditlog.logSoftwareConfiguration(true, "Role Group " + group.getGroupname() + " removed.");
            target.addComponent(GroupListPanel.this);
            allGroups.setObject(getAllGroups());
        }
    });

    add(modalWindow = new ModalWindow("modal-window"));
    add(new ModalWindowLink("toggle-group-form-link", modalWindow, winSize[0], winSize[1]) {
        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public Page createPage() {
                    return new CreateOrEditGroupPage(modalWindow, allGroups, null);
                }
            });
            super.onClick(target);
        }
    }.add(new Image("toggle-group-form-image", ImageManager.IMAGE_USER_ROLE_GROUP_ADD)
            .add(new ImageSizeBehaviour("vertical-align: middle;")))
            .add(new Label("grouplist.add-group-form.title",
                    new ResourceModel("grouplist.add-group-form.title")))
            .add(new TooltipBehaviour("grouplist."))
            .add(new SecurityBehavior(getModuleName() + ":newGroupLink")));
}