Package org.exoplatform.navigation.webui

Examples of org.exoplatform.navigation.webui.TreeNode


        if (node.getId().equals(rootNode.getId())) {
            tree.setChildren(null);
            tree.setSibbling(node.getChildren());
            tree.setParentSelected(node);
        } else {
            TreeNode parentNode = node.getParent();
            tree.setChildren(node.getChildren());
            tree.setSibbling(parentNode.getChildren());
            tree.setParentSelected(parentNode);
        }
        return node;
    }
View Full Code Here


            userPortal.saveNode(getRootNode().getNode(), getRootNode());
            DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
            Map<String, Map<Locale, State>> i18nizedLabels = this.userNodeLabels;

            for (String treeNodeId : i18nizedLabels.keySet()) {
                TreeNode node = findNode(treeNodeId);
                if (node != null) {
                    Map<Locale, State> labels = i18nizedLabels.get(treeNodeId);
                    if (labels != null && labels.size() > 0) {
                        descriptionService.setDescriptions(node.getNode().getId(), labels);
                    }
                }

            }
        } catch (NavigationServiceException ex) {
View Full Code Here

            return rebaseNode(node, selector.getScope(), selector);
        }

        protected TreeNode rebaseNode(TreeNode node, Scope scope, UINavigationNodeSelector selector) throws Exception {
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            TreeNode rebased = selector.rebaseNode(node, scope);
            if (rebased == null) {
                selector.getUserNodeLabels().remove(node.getId());

                context.getUIApplication().addMessage(
                        new ApplicationMessage("UINavigationNodeSelector.msg.staleData", null, ApplicationMessage.WARNING));
View Full Code Here

        public void execute(Event<UITree> event) throws Exception {
            WebuiRequestContext context = event.getRequestContext();
            UINavigationNodeSelector uiNodeSelector = event.getSource().getParent();

            String nodeID = context.getRequestParameter(OBJECTID);
            TreeNode node = uiNodeSelector.findNode(nodeID);

            try {
                node = rebaseNode(node, uiNodeSelector);
            } catch (NavigationServiceException ex) {
                handleError(ex.getError(), uiNodeSelector);
View Full Code Here

            WebuiRequestContext context = event.getRequestContext();
            UIRightClickPopupMenu uiPopupMenu = event.getSource();
            UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);

            String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
            TreeNode node;
            if (ParameterValidation.isNullOrEmpty(nodeID)) {
                node = uiNodeSelector.getSelectedNode();
                if (node == null) {
                    node = uiNodeSelector.getRootNode();
                }
View Full Code Here

            UIPortalApplication uiApp = Util.getUIPortalApplication();
            UIRightClickPopupMenu popupMenu = event.getSource();
            UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);

            String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
            TreeNode node = uiNodeSelector.findNode(nodeID);
            try {
                node = rebaseNode(node, uiNodeSelector);
                if (node == null)
                    return;
            } catch (NavigationServiceException ex) {
                handleError(ex.getError(), uiNodeSelector);
                return;
            }

            UserPortalConfigService userService = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);

            // get selected page
            String pageId = node.getPageRef();
            PageContext pageContext = (pageId != null) ? userService.getPageService().loadPage(PageKey.parse(pageId)) : null;
            if (pageContext != null) {
                UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
                if (!userACL.hasEditPermission(pageContext)) {
                    uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[] { pageId }, 1));
                    return;
                }

                uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
                // uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
                // uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor",
                // null);

                UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
                uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);

                UIPortalComposer portalComposer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class)
                        .setRendered(true);
                portalComposer.setShowControl(true);
                portalComposer.setEditted(false);
                portalComposer.setCollapse(false);
                portalComposer.setId("UIPageEditor");
                portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");

                uiToolPanel.setShowMaskLayer(false);
                uiToolPanel.setWorkingComponent(UIPage.class, null);
                UIPage uiPage = (UIPage) uiToolPanel.getUIComponent();

                if (pageContext.getState().getDisplayName() == null)
                    pageContext.getState().builder().displayName(node.getLabel());

                Page page = userService.getDataStorage().getPage(pageId);
                pageContext.update(page);

                // convert Page to UIPage
View Full Code Here

            UIPageNodeForm uiPageNodeForm = event.getSource();
            UIGroupNavigationManagement uiGroupNavigation = uiPageNodeForm.getAncestorOfType(UIGroupNavigationManagement.class);
            UINavigationManagement navigationManager = uiGroupNavigation.naviManager;

            UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
            TreeNode selectedParent = (TreeNode) uiPageNodeForm.getSelectedParent();
            selector.selectNode(selectedParent);

            UIPopupWindow uiNavigationPopup = uiGroupNavigation.getChild(UIPopupWindow.class);
            uiNavigationPopup.setUIComponent(navigationManager);
            uiNavigationPopup.setWindowSize(400, 400);
            uiNavigationPopup.setRendered(true);
            event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());

            TreeNode pageNode = uiPageNodeForm.getPageNode();
            if (pageNode != null) {
                selector.getUserNodeLabels().put(pageNode.getId(), pageNode.getI18nizedLabels());
            }
            selector.createEvent("NodeModified", Phase.PROCESS, event.getRequestContext()).broadcast();
        }
View Full Code Here

            UIPageNodeForm uiPageNodeForm = event.getSource();
            UISiteManagement uiSiteManagement = uiPageNodeForm.getAncestorOfType(UISiteManagement.class);
            UINavigationManagement navigationManager = uiSiteManagement.naviManager;

            UINavigationNodeSelector selector = navigationManager.getChild(UINavigationNodeSelector.class);
            TreeNode selectedParent = (TreeNode) uiPageNodeForm.getSelectedParent();
            selector.setScope(uiSiteManagement.getScope());
            selector.selectNode(selectedParent);

            WebuiRequestContext context = event.getRequestContext();
            UIPopupWindow uiNavigationPopup = uiSiteManagement.getChild(UIPopupWindow.class);
            uiNavigationPopup.setUIComponent(navigationManager);
            uiNavigationPopup.setWindowSize(400, 400);
            context.addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());

            TreeNode pageNode = uiPageNodeForm.getPageNode();
            if (pageNode != null) {
                selector.getUserNodeLabels().put(pageNode.getId(), pageNode.getI18nizedLabels());
            }
            selector.createEvent("NodeModified", Phase.PROCESS, context).broadcast();
        }
View Full Code Here

    }

    public void invokeGetBindingBean(Object bean) throws Exception {
        super.invokeGetBindingBean(bean);

        TreeNode pageNode = (TreeNode) bean;

        String icon = pageNode.getIcon();
        if (icon == null || icon.length() < 0)
            icon = "Default";
        getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
        getUIStringInput(LABEL).setValue(pageNode.getLabel());
        Map<Locale, Described.State> i18nizedLabels = pageNode.getI18nizedLabels();
        if (i18nizedLabels != null) {
            for (Locale key : i18nizedLabels.keySet()) {
                String locale = key.getCountry() != "" ? key.getLanguage() + "_" + key.getCountry() : key.getLanguage();
                cachedLabels.put(locale, i18nizedLabels.get(key));
            }
        }

        if (cachedLabels.get(selectedLocale) != null) {
            getUIStringInput(I18N_LABEL).setValue(cachedLabels.get(selectedLocale).getName());
        }

        if (pageNode.getVisibility() == Visibility.SYSTEM) {
            UIFormInputSet uiSettingSet = getChildById("PageNodeSetting");
            uiSettingSet.removeChildById(VISIBLE);
            uiSettingSet.removeChildById(SHOW_PUBLICATION_DATE);
            uiSettingSet.removeChildById(START_PUBLICATION_DATE);
            uiSettingSet.removeChildById(END_PUBLICATION_DATE);
        } else {
            Visibility visibility = pageNode.getVisibility();
            boolean isVisible = visibility == null
                    || EnumSet.of(Visibility.DISPLAYED, Visibility.TEMPORAL).contains(visibility);
            getUICheckBoxInput(VISIBLE).setChecked(isVisible);
            getUICheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(Visibility.TEMPORAL.equals(visibility));
            setShowCheckPublicationDate(isVisible);
            Calendar cal = Calendar.getInstance();
            if (pageNode.getStartPublicationTime() != -1) {
                cal.setTime(new Date(pageNode.getStartPublicationTime()));
                getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
            } else
                getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
            if (pageNode.getEndPublicationTime() != -1) {
                cal.setTime(new Date(pageNode.getEndPublicationTime()));
                getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
            } else
                getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
        }

        boolean isExtendedMode = true;
        if (pageNode.getNode().getLabel() != null && pageNode.getNode().getLabel().trim().length() > 0) {
            isExtendedMode = false;
        }

        getUICheckBoxInput(SWITCH_MODE).setChecked(isExtendedMode);
        this.switchLabelMode(isExtendedMode);
View Full Code Here

        this.switchLabelMode(isExtendedMode);
    }

    public void invokeSetBindingBean(Object bean) throws Exception {
        super.invokeSetBindingBean(bean);
        TreeNode node = (TreeNode) bean;

        if (node.getVisibility() != Visibility.SYSTEM) {
            Visibility visibility;
            if (getUICheckBoxInput(VISIBLE).isChecked()) {
                UICheckBoxInput showPubDate = getUICheckBoxInput(SHOW_PUBLICATION_DATE);
                visibility = showPubDate.isChecked() ? Visibility.TEMPORAL : Visibility.DISPLAYED;
            } else {
                visibility = Visibility.HIDDEN;
            }
            node.setVisibility(visibility);

            if (getUICheckBoxInput(VISIBLE).isChecked() && getUICheckBoxInput(SHOW_PUBLICATION_DATE).isChecked()) {
                Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
                Date date = (cal != null) ? cal.getTime() : null;
                node.setStartPublicationTime(date == null ? -1 : date.getTime());
                cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
                date = (cal != null) ? cal.getTime() : null;
                node.setEndPublicationTime(date == null ? -1 : date.getTime());
            } else {
                node.setStartPublicationTime(-1);
                node.setEndPublicationTime(-1);
            }
        }

        cachedLabels.put(getUIFormSelectBox(LANGUAGES).getValue(), new Described.State(getUIStringInput(I18N_LABEL).getValue(),
                null));
        Map<Locale, Described.State> labels = new HashMap<Locale, Described.State>(cachedLabels.size());
        getUIFormSelectBox(LANGUAGES).getValue();
        for (String strLocale : cachedLabels.keySet()) {
            Locale locale;
            if (strLocale.contains("_")) {
                String[] arr = strLocale.split("_");
                if (arr.length > 2) {
                    locale = new Locale(arr[0], arr[1], arr[2]);
                } else {
                    locale = new Locale(arr[0], arr[1]);
                }
            } else {
                locale = new Locale(strLocale);
            }

            labels.put(locale, cachedLabels.get(strLocale));
        }

        node.setI18nizedLabels(labels);

        if (getUICheckBoxInput(SWITCH_MODE).getValue().toString().equals("true"))
            node.setLabel(null);
        else if (node.getLabel() == null)
            node.setLabel(node.getName());
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.navigation.webui.TreeNode

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.