Package org.apache.wicket.extensions.ajax.markup.html.modal

Examples of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow$PageCreator


        public MenuTabPanel(String id, JetspeedDocument document)
        {
            super(id, document);
            ITab tab = null;
            DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("_MenusRootNode_");
            final ModalWindow metaDataModalWindow;
            add(metaDataModalWindow = new ModalWindow("modalwindow"));
            // Adding menu tree node
            menuTreeRoot = new DefaultTreeModel(rootNode);
            controlMenuTabs(false);
            final AjaxTabbedPanel menusTab = new AjaxTabbedPanel("menuTabs", menuTabs);
            menuTree = new LinkTree("menuTree", new PropertyModel(this, "menuTreeRoot"))
            {
                @Override
                protected void onNodeLinkClicked(Object node, BaseTree tree,
                        AjaxRequestTarget target)
                {
                    Object userObject = ((DefaultMutableTreeNode) node).getUserObject();
                   
                    if (!(userObject instanceof MenuTreeNode))
                    {
                        return;
                    }
                   
                    MenuTreeNode menuNode = (MenuTreeNode) userObject;
               
                    if (menuNode.getName() != null && !menuNode.getName().equalsIgnoreCase("_MenusRootNode_"))
                    {
                        setMenuDefinition(menuNode.getDefinition());
                        controlMenuTabs(true);
                        menusTab.setSelectedTab(0);
                        target.addComponent(menusTab);
                    }
                }
            };
           
            if (getNodeType().equals(FOLDER_NODE_TYPE))
            {
                setMenuDefinition(getServiceLocator().getPageManager().newFolderMenuDefinition());
            }
            else
            {
                setMenuDefinition(getServiceLocator().getPageManager().newPageMenuDefinition());
            }
           
            getServiceLocator().getPageManager().newFolderMenuDefinition();
            // menusTab.setSelectedTab(0);
            getMenus(getDocument(), rootNode);
            menuTree.getTreeState().expandNode(rootNode);
            menuTree.setRootLess(true);
            add(new ContextImage("menusRootIcon", "images/tree/folder.gif"));
            add(menuTree);
            Form menuForm = new Form("menuForm");
            add(menuForm);
            add(new AjaxButton("newsave",new ResourceModel("add.menu"),menuForm)
            {
                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form)
                {
                    MenuDefinition def = null;
                    if (getNodeType().equals(FOLDER_NODE_TYPE))
                    {
                        def = getServiceLocator().getPageManager().newFolderMenuDefinition();
                    }
                    else
                    {
                        def = getServiceLocator().getPageManager().newPageMenuDefinition();
                    }
                    metaDataModalWindow.setContent(new MenuWindow(metaDataModalWindow.getContentId(), def, menusTab));
                    metaDataModalWindow.show(target);
                }
            });
            add(new AjaxButton("remove",new ResourceModel("common.remove"),menuForm)
            {
View Full Code Here


        public MenuIncludesPanel(String id, JetspeedDocument document,
                MenuDefinition definition)
        {
            super(id, document, definition);
            getMenuElements(definition, INCLUDES);
            final ModalWindow metaDataModalWindow;
            add(metaDataModalWindow = new ModalWindow("modalwindow"));
            final WebMarkupContainer ajaxPanel = new WebMarkupContainer(
                    "basePanel");
            ajaxPanel.setOutputMarkupId(true);
            ajaxPanel.add(new Label("nameLabel",new ResourceModel("common.name")));
            ajaxPanel.add(new Label("nestedLabel",new ResourceModel("menu.nest.label")));
            ajaxPanel.add(new ListView("menuData", new PropertyModel(this,
                    "menuOptions"))
            {

                public void populateItem(final ListItem listItem)
                {
                    final MenuIncludeDefinition option = (MenuIncludeDefinition) listItem
                            .getModelObject();
                    listItem.add(new Label("name", option.getName()));
                    listItem.add(new Label("nest", Boolean.toString(option
                            .isNest())));
                    AjaxLink editLink =new AjaxLink("edit")
                    {

                        @Override
                        public void onClick(AjaxRequestTarget target)
                        {
                            metaDataModalWindow.setContent(new IncludesWindow(
                                    metaDataModalWindow.getContentId(),option, ajaxPanel));
                            metaDataModalWindow.show(target);
                        }
                    };
                    editLink.add(new Label("editLabel",new ResourceModel("common.edit")));
                    listItem.add(editLink);
                    AjaxLink deleteLink = new AjaxLink("delete")
                    {

                        @Override
                        public void onClick(AjaxRequestTarget target)
                        {
                            menuActions(REMOVE_ACTION,option.getName(),new IncludesDefinitionBean());
                            target.addComponent(ajaxPanel);
                        }
                    };
                    deleteLink.add(new JavascriptEventConfirmation("onclick",new ResourceModel("action.delete.confirm")));
                    deleteLink.add(new Label("deleteLabel",new ResourceModel("common.delete")));
                    listItem.add(deleteLink);                   
                }
            });
            add(new AjaxLink("new")
            {

                @Override
                public void onClick(AjaxRequestTarget target)
                {
                    MenuIncludeDefinition includeDefinition = null;
                    if (getUserSelectedNode().getDocType() == FileType.Folder)
                    {
                        includeDefinition = getServiceLocator()
                                .getPageManager()
                                .newFolderMenuIncludeDefinition();
                    } else
                    {
                        includeDefinition = getServiceLocator()
                                .getPageManager()
                                .newPageMenuIncludeDefinition();
                    }
                    metaDataModalWindow.setContent(new IncludesWindow(
                            metaDataModalWindow.getContentId(),
                            includeDefinition, ajaxPanel));
                    metaDataModalWindow.show(target);
                }
            });
            add(ajaxPanel);
        }
View Full Code Here

        public MenuOptionsPanel(String id, JetspeedDocument document,
                MenuDefinition definition)
        {
            super(id, document, definition);
            getMenuElements(getMenuDefinition(), MenuElement.OPTION_ELEMENT_TYPE);
            final ModalWindow metaDataModalWindow;
            add(metaDataModalWindow = new ModalWindow("modalwindow"));
            final WebMarkupContainer ajaxPanel = new WebMarkupContainer(
                    "basePanel");
            ajaxPanel.setOutputMarkupId(true);
            ajaxPanel.add(new ListView("menuData", new PropertyModel(this,
                    "menuOptions"))
            {

                public void populateItem(final ListItem listItem)
                {
                    final MenuOptionsDefinition option = (MenuOptionsDefinition) listItem
                            .getModelObject();
                    listItem.add(new Label("option", option.getOptions()));
                    listItem.add(new Label("order", option.getOrder()));
                    listItem.add(new Label("path", Boolean.toString(option
                            .isPaths())));
                    listItem.add(new Label("regexp", Boolean.toString(option
                            .isRegexp())));
                    listItem.add(new AjaxLink("edit")
                    {

                        @Override
                        public void onClick(AjaxRequestTarget target)
                        {
                            metaDataModalWindow.setContent(new OptionsWindow(
                                    metaDataModalWindow.getContentId(),option, ajaxPanel));
                            metaDataModalWindow.show(target);
                            target.addComponent(ajaxPanel);
                        }
                    });
                    listItem.add(new AjaxLink("delete")
                    {

                        @Override
                        public void onClick(AjaxRequestTarget target)
                        {
                            menuActions(REMOVE_ACTION,option.getOptions(), new OptionsDefinitionBean());
                            target.addComponent(ajaxPanel);
                        }
                    }.add(new JavascriptEventConfirmation("onclick",
                            new ResourceModel("action.delete.confirm"))));
                }
            });
            add(new AjaxLink("new")
            {

                @Override
                public void onClick(AjaxRequestTarget target)
                {
                    MenuOptionsDefinition optionDefinition = null;
                    if (getUserSelectedNode().getDocType() == FileType.Folder)
                    {
                        optionDefinition = getServiceLocator().getPageManager()
                                .newFolderMenuOptionsDefinition();
                    } else
                    {
                        optionDefinition = getServiceLocator().getPageManager()
                                .newPageMenuOptionsDefinition();
                    }
                    metaDataModalWindow.setContent(new OptionsWindow(
                            metaDataModalWindow.getContentId(),
                            optionDefinition, ajaxPanel));
                    metaDataModalWindow.show(target);
                }
            });
            add(ajaxPanel);
        }
View Full Code Here

                return getRepo();
            }
        };
        final WebMarkupContainer tableGroup = new WebMarkupContainer(
                "tableGroup");
        final ModalWindow metaDataModalWindow = new ModalWindow("modalwindow");
        final PageableListView listview = new PageableListView("repositories",
                getRepo, 10)
        {
            @Override
            protected void populateItem(final ListItem item)
            {
                final Repository repo = (Repository) item.getModelObject();
                item.add(new Label("name", repo.getName()));
                item.add(new Label("url", repo.getConfigPath()));
                item.add(new AjaxLink("edit", item.getModel())
                {

                    @Override
                    public void onClick(AjaxRequestTarget target)
                    {
                        metaDataModalWindow.setContent(new RepositoryPanel(
                                metaDataModalWindow.getContentId(), repo,
                                tableGroup));
                        metaDataModalWindow.show(target);
                    }
                });
                item.add(new AjaxLink("remove", item.getModel()){

                    @Override
                    public void onClick(AjaxRequestTarget target)
                    {
                        try
                        {
                            getPortletRequest().getPreferences().reset(repo.getName());
                            getRepositoryManager().reload(RemotePortletAppDeployer.getReposList(getPortletRequest()));
                            target.addComponent(tableGroup);
                        } catch (ReadOnlyException e)
                        {
                            logger.error("The preference is read-only: {}", repo.getName());
                        }
                    }                   
                });
            }
        };
        listview.setOutputMarkupId(true);

        tableGroup.setOutputMarkupId(true);
        tableGroup.add(new PagingNavigator("navigator", listview));
        tableGroup.add(listview);
        add(metaDataModalWindow);       
        add(tableGroup);
        add(new AjaxLink("newRepo"){

            @Override
            public void onClick(AjaxRequestTarget target)
            {
                metaDataModalWindow.setContent(new RepositoryPanel(
                        metaDataModalWindow.getContentId(), new SimpleRepository("",""),
                        tableGroup));
                metaDataModalWindow.show(target);               
            }           
        });
    }
View Full Code Here

    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);

        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);
View Full Code Here

        container = new WebMarkupContainer("container");
        container.setOutputMarkupId(true);
        add(container);

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

        paginatorRows = prefMan.getPaginatorRows(getWebRequest(), Constants.PREF_PROPAGATION_TASKS_PAGINATOR_ROWS);

        columns = new ArrayList<IColumn<TaskTO, String>>();
View Full Code Here

        ownerContainer = new WebMarkupContainer("ownerContainer");
        ownerContainer.setOutputMarkupId(true);
        this.add(ownerContainer);

        final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
        userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
        this.add(userOwnerSelectWin);
        final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin");
        roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal");
        this.add(roleOwnerSelectWin);
        final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin");
        parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        parentSelectWin.setCookieName("create-parentSelect-modal");
        this.add(parentSelectWin);

        if (templateMode) {
            parentFragment = new Fragment("parent", "parentFragment", this);

            parentModel = new ParentModel(roleTO);
            final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel);
            parent.setReadOnly(true);
            parent.setOutputMarkupId(true);
            parentFragment.add(parent);
            final IndicatingAjaxLink parentSelect = new IndicatingAjaxLink("parentSelect") {

                private static final long serialVersionUID = -7978723352517770644L;

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

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
                                    ParentSelectPayload.class);
                        }
                    });
                    parentSelectWin.show(target);
                }
            };
            parentFragment.add(parentSelect);
            final IndicatingAjaxLink parentReset = new IndicatingAjaxLink("parentReset") {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    parentModel.setObject(null);
                    target.add(parent);
                }
            };
            parentFragment.add(parentReset);
        } else {
            parentFragment = new Fragment("parent", "emptyFragment", this);
        }
        parentFragment.setOutputMarkupId(true);
        this.add(parentFragment);

        final AjaxTextFieldPanel name =
                new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "name"));

        final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
        this.add(jexlHelp);

        final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
        this.add(questionMarkJexlHelp);

        if (!templateMode) {
            name.addRequiredLabel();
            questionMarkJexlHelp.setVisible(false);
        }
        this.add(name);

        userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
        final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
        userOwner.setReadOnly(true);
        userOwner.setOutputMarkupId(true);
        ownerContainer.add(userOwner);
        final IndicatingAjaxLink userOwnerSelect = new IndicatingAjaxLink("userOwnerSelect") {

            private static final long serialVersionUID = -7978723352517770644L;

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

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
                    }
                });
                userOwnerSelectWin.show(target);
            }
        };
        ownerContainer.add(userOwnerSelect);
        final IndicatingAjaxLink userOwnerReset = new IndicatingAjaxLink("userOwnerReset") {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                userOwnerModel.setObject(null);
                target.add(userOwner);
            }
        };
        ownerContainer.add(userOwnerReset);

        roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE);
        final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel);
        roleOwner.setReadOnly(true);
        roleOwner.setOutputMarkupId(true);
        ownerContainer.add(roleOwner);
        final IndicatingAjaxLink roleOwnerSelect = new IndicatingAjaxLink("roleOwnerSelect") {

            private static final long serialVersionUID = -7978723352517770644L;

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

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
                                RoleOwnerSelectPayload.class);
                    }
                });
                parentSelectWin.show(target);
            }
        };
        ownerContainer.add(roleOwnerSelect);
        final IndicatingAjaxLink roleOwnerReset = new IndicatingAjaxLink("roleOwnerReset") {
View Full Code Here

        add(form);
        add(new FeedbackPanel("feedback"));

        // Modal window for self registration
        final ModalWindow editProfileModalWin = new ModalWindow("selfRegModal");
        editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        editProfileModalWin.setInitialHeight(SELF_REG_WIN_HEIGHT);
        editProfileModalWin.setInitialWidth(SELF_REG_WIN_WIDTH);
        editProfileModalWin.setCookieName("self-reg-modal");
        add(editProfileModalWin);

        Fragment selfRegFrag;
        if (isSelfRegistrationAllowed()) {
            selfRegFrag = new Fragment("selfRegistration", "selfRegAllowed", this);

            final AjaxLink selfRegLink = new ClearIndicatingAjaxLink("link", getPageReference()) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new UserRequestModalPage(Login.this.getPageReference(), editProfileModalWin,
                                    new UserTO(), UserModalPage.Mode.SELF);
                        }
                    });

                    editProfileModalWin.show(target);
                }
            };
            selfRegLink.add(new Label("linkTitle", getString("selfRegistration")));

            Panel panel = new LinkPanel("selfRegistration", new ResourceModel("selfRegistration"));
View Full Code Here

    private int userRequestPaginatorRows;

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

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

        setupApproval();
        setupUserRequest();
    }
View Full Code Here

            final String pageId,
            final PageReference pageRef) {

        super(id);

        final ModalWindow bulkModalWin = new ModalWindow("bulkModal");
        bulkModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        bulkModalWin.setInitialHeight(600);
        bulkModalWin.setInitialWidth(900);
        bulkModalWin.setCookieName("bulk-modal");
        add(bulkModalWin);

        bulkModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

            private static final long serialVersionUID = 8804221891699487149L;

            @Override
            public void onClose(final AjaxRequestTarget target) {
                final EventDataWrapper data = new EventDataWrapper();
                data.setTarget(target);
                data.setRows(rowsPerPage);

                send(pageRef.getPage(), Broadcast.BREADTH, data);

                final AbstractBasePage page = (AbstractBasePage) pageRef.getPage();

                if (page.isModalResult()) {
                    // reset modal result
                    page.setModalResult(false);
                    // set operation succeeded
                    getSession().info(getString("operation_succeeded"));
                    // refresh feedback panel
                    target.add(page.getFeedbackPanel());
                }
            }
        });

        Fragment fragment = new Fragment("tablePanel", "bulkAvailable", this);
        add(fragment);

        bulkActionForm = new Form("groupForm");
        fragment.add(bulkActionForm);

        group = new CheckGroup<T>("checkgroup", new ArrayList<T>());
        bulkActionForm.add(group);

        columns.add(0, new CheckGroupColumn<T, S>(group));
        dataTable = new AjaxFallbackDefaultDataTable("dataTable", columns, dataProvider, rowsPerPage);
        group.add(dataTable);

        fragment.add(new ClearIndicatingAjaxButton("bulkActionLink", bulkActionForm, pageRef) {
            private static final long serialVersionUID = 382302811235019988L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                bulkModalWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690941L;

                    @Override
                    public Page createPage() {
                        return new BulkActionModalPage(
                                getPage().getPageReference(),
                                bulkModalWin,
                                new ArrayList<T>(group.getModelObject()),
                                columns,
                                actions,
                                bulkActionExecutor,
                                itemIdFiled,
                                pageId);
                    }
                });

                bulkModalWin.show(target);
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow$PageCreator

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.