Package org.exoplatform.portal.webui.page

Examples of org.exoplatform.portal.webui.page.UIPageSelector$SelectPageActionListener


            if (pageNode == null) {
                pageNode = selectedParent.addChild(nodeName);
                uiPageNodeForm.pageNode_ = pageNode;
            }

            UIPageSelector pageSelector = uiPageNodeForm.getChild(UIPageSelector.class);
            if (pageSelector.getPage() == null) {
                pageSelector.setValue(null);
            } else {
                PageContext pageContext = pageSelector.getPage();
                DataStorage storage = uiPageNodeForm.getApplicationComponent(DataStorage.class);
                PageService pageService = uiPageNodeForm.getApplicationComponent(PageService.class);
                if (pageService.loadPage(pageContext.getKey()) == null) {
                    pageService.savePage(pageContext);

                    //
                    Page page = new Page();
                    page.setOwnerType(pageContext.getKey().getSite().getTypeName());
                    page.setOwnerId(pageContext.getKey().getSite().getName());
                    page.setName(pageContext.getKey().getName());
                    String title = pageContext.getState().getDisplayName();
                    String[] accessPermission = pageContext.getState().getAccessPermissions() == null ? null : pageContext
                            .getState().getAccessPermissions()
                            .toArray(new String[pageContext.getState().getAccessPermissions().size()]);
                    if (title == null || title.trim().length() < 1) {
                        title = page.getName();
                    }
                    page.setTitle(title);
                    page.setShowMaxWindow(false);
                    page.setAccessPermissions(accessPermission);
                    page.setEditPermission(pageContext.getState().getEditPermission());
                    page.setModifiable(true);
                    if (page.getChildren() == null) {
                        page.setChildren(new ArrayList<ModelObject>());
                    }

                    storage.save(page);
                    pageSelector.setValue(page.getPageId());
                }
            }

            if (pageNode.getLabel() == null)
                pageNode.setLabel(pageNode.getName());
View Full Code Here


    }

    public static class ClearPageActionListener extends EventListener<UIPageNodeForm> {
        public void execute(Event<UIPageNodeForm> event) throws Exception {
            UIPageNodeForm uiForm = event.getSource();
            UIPageSelector pageSelector = uiForm.findFirstComponentOfType(UIPageSelector.class);
            pageSelector.setPage(null);
            event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
        }
View Full Code Here

    }

    public static class CreatePageActionListener extends EventListener<UIPageNodeForm> {
        public void execute(Event<UIPageNodeForm> event) throws Exception {
            UIPageNodeForm uiForm = event.getSource();
            UIPageSelector pageSelector = uiForm.findFirstComponentOfType(UIPageSelector.class);

            UIPortalApplication uiPortalApp = Util.getUIPortalApplication();

            UIFormInputSet uiInputSet = pageSelector.getChild(UIFormInputSet.class);
            List<UIComponent> children = uiInputSet.getChildren();
            /*********************************************************************/
            for (UIComponent uiChild : children) {
                if (uiChild instanceof UIFormInputBase) {
                    UIFormInputBase uiInput = (UIFormInputBase) uiChild;
                    if (!uiInput.isValid())
                        continue;
                    List<Validator> validators = uiInput.getValidators();
                    if (validators == null)
                        continue;
                    try {
                        for (Validator validator : validators)
                            validator.validate(uiInput);
                    } catch (MessageException ex) {
                        uiPortalApp.addMessage(ex.getDetailMessage());
                        return;
                    } catch (Exception ex) {
                        // TODO: This is a critical exception and should be handle in the UIApplication
                        uiPortalApp.addMessage(new ApplicationMessage(ex.getMessage(), null));
                        return;
                    }
                }
            }

            UserACL userACL = uiForm.getApplicationComponent(UserACL.class);

            String ownerId = uiForm.getOwner();
            String[] accessPermission = new String[1];
            accessPermission[0] = "*:" + ownerId;
            String editPermission = userACL.getMakableMT() + ":" + ownerId;

            if (SiteType.PORTAL.equals(uiForm.getOwnerType())) {
                UIPortal uiPortal = Util.getUIPortal();
                accessPermission = uiPortal.getAccessPermissions();
                editPermission = uiPortal.getEditPermission();
            }

            UIFormStringInput uiPageName = uiInputSet.getChildById("pageName");
            UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");

            PageState pageState = new PageState(uiPageTitle.getValue(), null, false, null,
                    accessPermission != null ? Arrays.asList(accessPermission) : null, editPermission);

            // check page is exist
            PageKey pageKey = PageKey.parse(uiForm.getOwnerType().getName() + "::" + ownerId + "::" + uiPageName.getValue());
            PageService pageService = uiForm.getApplicationComponent(PageService.class);
            PageContext existPage = pageService.loadPage(pageKey);
            if (existPage != null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
                return;
            }
            pageSelector.setPage(new PageContext(pageKey, pageState));
            event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
        }
View Full Code Here

                .addUIFormInput(new UIFormDateTimeInput(END_PUBLICATION_DATE, null, null).addValidator(DateTimeValidator.class));

        addUIFormInput(uiSettingSet);
        setSelectedTab(uiSettingSet.getId());

        UIPageSelector uiPageSelector = createUIComponent(UIPageSelector.class, null, null);
        uiPageSelector.configure("UIPageSelector", "pageRef");
        addUIFormInput(uiPageSelector);

        UIFormInputIconSelector uiIconSelector = new UIFormInputIconSelector("Icon", "icon");
        addUIFormInput(uiIconSelector);
        setActions(new String[] { "Save", "Back" });
View Full Code Here

    }

    public void processRender(WebuiRequestContext context) throws Exception {
        super.processRender(context);

        UIPageSelector uiPageSelector = getChild(UIPageSelector.class);
        if (uiPageSelector == null)
            return;
        UIPopupWindow uiPopupWindowPage = uiPageSelector.getChild(UIPopupWindow.class);
        if (uiPopupWindowPage == null)
            return;
        uiPopupWindowPage.processRender(context);
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.webui.page.UIPageSelector$SelectPageActionListener

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.