Package org.exoplatform.webui.core

Examples of org.exoplatform.webui.core.UIApplication


            String appName = event.getRequestContext().getRequestParameter(OBJECTID);
            UIApplicationForm uiApplicationForm = uiOrganizer.getChild(UIApplicationForm.class);
            if (uiApplicationForm != null) {
                Application app = uiApplicationForm.getApplication();
                if (app != null && app.getApplicationName().equals(appName)) {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.deleteApplicationInUse", null));
                    return;
                }
            }
            ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
            Application app = uiOrganizer.getApplication(appName);
View Full Code Here


            event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);

            String nodeID = context.getRequestParameter(UIComponent.OBJECTID);
            TreeNode node = uiNodeSelector.findNode(nodeID);
            if (Visibility.SYSTEM.equals(node.getVisibility())) {
                UIApplication uiApp = context.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-copyclone", null));
                return;
            }
            try {
                node = rebaseNode(node, Scope.ALL, uiNodeSelector);
                if (node == null)
View Full Code Here

                return;
            }
            TreeNode parentNode = childNode.getParent();

            if (Visibility.SYSTEM.equals(childNode.getVisibility())) {
                UIApplication uiApp = pcontext.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null));
                return;
            }
            uiNodeSelector.getUserNodeLabels().remove(childNode.getId());
            parentNode.removeChild(childNode);
            uiNodeSelector.selectNode(parentNode);
View Full Code Here

            category.setAccessPermissions(pers);
            ApplicationCategory existCategory = service.getApplicationCategory(category.getName());
            if (!isCreateNew) {
                if (existCategory == null) {
                    uiOrganizer.reload();
                    UIApplication uiApp = ctx.getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("category.msg.changeNotExist", null));
                    ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                    return;
                }
                category.setModifiedDate(new Date());
            } else {
                if (existCategory != null) {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UICategoryForm.msg.SameName", null));
                    if (uiOrganizer.getCategory(category.getName()) == null) {
                        uiOrganizer.initApplicationCategories();
                    }
                    return;
                }
View Full Code Here

            WebuiRequestContext ctx = event.getRequestContext();
            UIApplicationOrganizer uiOrganizer = uiForm.getParent();
            ApplicationRegistryService service = uiForm.getApplicationComponent(ApplicationRegistryService.class);
            Application application = uiForm.getApplication();
            if (service.getApplication(application.getId()) == null) {
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("application.msg.changeNotExist", null));
                uiOrganizer.reload();
                uiOrganizer.setSelectedCategory(application.getCategoryName());
                ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                return;
            }
View Full Code Here

    public static class SaveActionListener extends EventListener<UIPageNodeForm> {
        public void execute(Event<UIPageNodeForm> event) throws Exception {
            WebuiRequestContext ctx = event.getRequestContext();
            UIPageNodeForm uiPageNodeForm = event.getSource();
            UIApplication uiPortalApp = ctx.getUIApplication();
            TreeNode pageNode = uiPageNodeForm.getPageNode();
            boolean isVisible = uiPageNodeForm.getUICheckBoxInput(VISIBLE).isChecked();
            boolean isShowPubDate = uiPageNodeForm.getUICheckBoxInput(SHOW_PUBLICATION_DATE).isChecked();
            boolean isSystemVisibility = false;
            if (pageNode != null)
                isSystemVisibility = pageNode.getVisibility() == Visibility.SYSTEM;

            if (isVisible && isShowPubDate && !isSystemVisibility) {
                Calendar currentCalendar = Calendar.getInstance();
                currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH),
                        currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
                Date currentDate = currentCalendar.getTime();

                Calendar startCalendar = uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.START_PUBLICATION_DATE)
                        .getCalendar();
                Date startDate = startCalendar != null ? startCalendar.getTime() : currentDate;
                Calendar endCalendar = uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.END_PUBLICATION_DATE)
                        .getCalendar();
                Date endDate = endCalendar != null ? endCalendar.getTime() : null;

                // Case 1: current date after start date
                if (currentDate.after(startDate)) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeStartDate", args,
                            ApplicationMessage.WARNING));
                    return;

                // Case 2: start date after end date
                } else if ((endCalendar != null) && (startCalendar != null) && (startDate.after(endDate))) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.startDateBeforeEndDate", args,
                            ApplicationMessage.WARNING));
                    return;

                // Case 3: start date is null and current date after end date
                } else if ((endCalendar != null) && (currentDate.after(endDate))) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeEndDate", args,
                            ApplicationMessage.WARNING));
                    return;
                }

            }

            UIFormStringInput nameInput = uiPageNodeForm.getUIStringInput("name");
            String nodeName = nameInput.getValue();

            TreeNode selectedParent = (TreeNode) uiPageNodeForm.getSelectedParent();
            if (pageNode == null && selectedParent.getChild(nodeName) != null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.SameName", null));
                return;
            }

            // Add node that need to be rebased to context
            if (pageNode == null) {
View Full Code Here

            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIRegisterInputSet registerInput = registerForm.getChild(UIRegisterInputSet.class);

            if (registerInput.save(userHandler, context)) {
                // TODO: Add Account Activating feature
                UIApplication uiApp = context.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIRegisterForm.registerWithSuccess.message", null));

                // Send mail to administrator after successful registration of user
                PostRegistrationService postRegistrationService = uiApp.getApplicationComponent(PostRegistrationService.class);
                User user = (User) context.getAttribute(ATTR_USER);
                postRegistrationService.sendMailAfterSuccessfulRegistration(user);
            }

            // Invalidate the capcha
View Full Code Here

            String name = "gadget" + url.hashCode();
            UIGadgetManagement uiManagement = uiForm.getParent();
            // check url exist
            boolean urlExist = checkUrlExist(uiManagement.getGadgets(), url);
            if (urlExist == true) {
                UIApplication uiApp = context.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIAddGadget.label.urlExist", null));
                return;
            }
            Gadget gadget;
            try {
                gadget = GadgetUtil.toGadget(name, url, false);
            } catch (Exception e) {
                UIApplication uiApp = context.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIAddGadget.label.urlError", new String[] { url }));
                return;
            }
            service.saveGadget(gadget);
            uiManagement.initData();
            uiManagement.setSelectedGadget(name);
View Full Code Here

                }
            }

            String typedUsername = userNameInput.getValue();
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIApplication uiApp = context.getUIApplication();
            if (usernameIsUsed(typedUsername, orgService)) {
                uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-exist", new String[] { typedUsername },
                        ApplicationMessage.WARNING));
            } else {
                uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-not-exist", new String[] { typedUsername },
                        ApplicationMessage.INFO));
            }
        }
View Full Code Here

            //
            Gadget gadget = service.getGadget(gadgetName);

            if (isEdit) {
                if (gadget == null) {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("gadget.msg.changeNotExist", null, ApplicationMessage.WARNING));
                    uiManagement.reload();
                    return;
                }
            } else {
                // If gadget is null we need to create it first
                if (gadget == null) {
                    gadget = new Gadget();
                    gadget.setName(gadgetName);

                    // Those data will be taken from the gadget XML anyway
                    gadget.setDescription("");
                    gadget.setThumbnail("");
                    gadget.setLocal(true);
                    gadget.setTitle("");
                    gadget.setReferenceUrl("");

                    // Save gadget with empty data first
                    service.saveGadget(gadget);
                } else {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UIGadgetEditor.gadget.msg.gadgetIsExist", null,
                            ApplicationMessage.WARNING));
                    return;
                }
            }
            //
            Source source = new Source(gadgetName, "application/xml");
            source.setTextContent(text);
            source.setLastModified(Calendar.getInstance());

            try {
                sourceStorage.saveSource(gadget, source);
                uiManagement.removeChild(UIGadgetEditor.class);
                // This will update the source and also update the gadget related
                // cached meta data
                // from the source
                uiManagement.initData();
                uiManagement.setSelectedGadget(gadget.getName());
                event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);

                // Send request to invalidate the cache to Shindig
                String gadgetServerUrl = GadgetUtil.getGadgetServerUrl();
                String gadgetUrl = GadgetUtil.reproduceUrl(gadget.getUrl(), gadget.isLocal());
                String metadataUrl = gadgetServerUrl + (gadgetServerUrl.endsWith("/") ? "" : "/") + "metadata";
                String queryString = "{\"context\":{\"ignoreCache\":\"true\"},\"gadgets\":[" + "{\"url\":\"" + gadgetUrl
                        + "\"}]}";
                event.getRequestContext().getJavascriptManager().require("SHARED/base")
                        .addScripts("ajaxRequest('POST', '" + metadataUrl + "', true, '" + queryString + "');");
            } catch (UnsupportedEncodingException e) {
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIGadgetEditor.msg.unsupportedEncoding",
                        new Object[] { e.getMessage() }, ApplicationMessage.ERROR));
                return;
            }
        }
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.core.UIApplication

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.