Examples of GadgetRegistryService


Examples of org.exoplatform.application.gadget.GadgetRegistryService

        return getGadgetServerUrl();
    }

    private static String getGadgetServerURI() {
        ExoContainer container = ExoContainerContext.getCurrentContainer();
        GadgetRegistryService gadgetService = (GadgetRegistryService) container
                .getComponentInstanceOfType(GadgetRegistryService.class);
        return gadgetService.getHostName();
    }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

    public void importExoGadgets() throws Exception {
        ContentRegistry registry = getContentRegistry();

        //
        ExoContainer container = ExoContainerContext.getCurrentContainer();
        GadgetRegistryService gadgetService = (GadgetRegistryService) container
                .getComponentInstanceOfType(GadgetRegistryService.class);
        List<Gadget> eXoGadgets = gadgetService.getAllGadgets();

        //
        if (eXoGadgets != null) {
            ArrayList<String> permissions = new ArrayList<String>();
            permissions.add(UserACL.EVERYONE);
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

    public static class AddActionListener extends EventListener<UIAddGadget> {

        public void execute(Event<UIAddGadget> event) throws Exception {
            UIAddGadget uiForm = event.getSource();
            WebuiRequestContext context = event.getRequestContext();
            GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
            String url = uiForm.getUIStringInput(FIELD_URL).getValue();
            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);
            context.addUIComponentToUpdateByAjax(uiManagement);
        }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

        public void execute(Event<UIGadgetEditor> event) throws Exception {
            UIGadgetEditor uiForm = event.getSource();
            UIGadgetManagement uiManagement = uiForm.getParent();
            String gadgetName;
            String text = uiForm.getUIFormTextAreaInput(UIGadgetEditor.FIELD_SOURCE).getValue();
            GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
            SourceStorage sourceStorage = uiForm.getApplicationComponent(SourceStorage.class);
            boolean isEdit = uiForm.isEdit();
            if (isEdit) {
                gadgetName = uiForm.getSourceFullName();
            } else {
                gadgetName = uiForm.getUIStringInput(UIGadgetEditor.FIELD_NAME).getValue();
            }

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

Examples of org.exoplatform.application.gadget.GadgetRegistryService

            return;
        }
        Collections.sort(applications, new Util.ApplicationComparator());

        // Correct IconUrl of gadget
        GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
        for (Application app : applications) {
            if (ApplicationType.GADGET.equals(app.getType())) {
                Gadget gadget = gadgetService.getGadget(app.getApplicationName());
                if (gadget != null)
                    app.setIconURL(gadget.getThumbnail());
            }
        }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

        if (ApplicationType.PORTLET == type) {
            return createApplicationsFromPortlets(false);
        } else if (ApplicationType.WSRP_PORTLET == type) {
            return createApplicationsFromPortlets(true);
        } else if (ApplicationType.GADGET == type) {
            GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
            List<Gadget> gadgets = gadgetService.getAllGadgets();
            List<Application> applications = new ArrayList<Application>(gadgets.size());
            for (Gadget gadget : gadgets) {
                Application app = new Application();
                app.setApplicationName(gadget.getName());
                app.setType(ApplicationType.GADGET);
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

            setSelectedGadget(gadgets_.get(0));
        }
    }

    public void initData() throws Exception {
        GadgetRegistryService service = getApplicationComponent(GadgetRegistryService.class);
        gadgets_ = service.getAllGadgets(new Util.GadgetComparator());
    }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

        public void execute(Event<UIGadgetManagement> event) throws Exception {
            UIGadgetManagement uiManagement = event.getSource();
            WebuiRequestContext ctx = event.getRequestContext();
            String name = ctx.getRequestParameter(OBJECTID);
            GadgetRegistryService service = uiManagement.getApplicationComponent(GadgetRegistryService.class);
            if (service.getGadget(name) == null) {
                uiManagement.reload();
                ctx.addUIComponentToUpdateByAjax(uiManagement);
                return;
            }
            UIGadgetEditor uiEditor = uiManagement.getChild(UIGadgetEditor.class);
            if (uiEditor != null) {
                Source source = uiEditor.getSource();
                if (source != null && name.equals(uiEditor.getSourceName())) {
                    UIApplication uiApp = ctx.getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UIGadgetManagement.msg.deleteGadgetInUse", null));
                    return;
                }
            }
            service.removeGadget(name);
            WebAppController webController = uiManagement.getApplicationComponent(WebAppController.class);
            webController.removeApplication(EXO_GADGET_GROUP + "/" + name);
            Gadget gadget = uiManagement.getGadget(name);
            if (gadget.isLocal()) {
                // get dir path of gadget
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

        public void execute(Event<UIGadgetInfo> event) throws Exception {
            UIGadgetInfo uiInfo = event.getSource();
            WebuiRequestContext ctx = event.getRequestContext();
            UIGadgetManagement uiManagement = uiInfo.getParent();
            Gadget gadget = uiInfo.getGadget();
            GadgetRegistryService service = uiInfo.getApplicationComponent(GadgetRegistryService.class);
            if (service.getGadget(gadget.getName()) == null) {
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIGadgetInfo.msg.gadgetNotExist", null));
                uiManagement.reload();
                return;
            }
            service.saveGadget(GadgetUtil.toGadget(gadget.getName(), gadget.getUrl(), gadget.isLocal()));
            uiManagement.initData();
            uiManagement.setSelectedGadget(gadget.getName());
            ctx.addUIComponentToUpdateByAjax(uiManagement);
        }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

        public void execute(Event<UIGadgetInfo> event) throws Exception {
            UIGadgetInfo uiInfo = event.getSource();
            Gadget gadget = uiInfo.getGadget();

            UIGadgetManagement uiManagement = uiInfo.getParent();
            GadgetRegistryService service = uiInfo.getApplicationComponent(GadgetRegistryService.class);
            if (service.getGadget(gadget.getName()) == null) {
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIGadgetInfo.msg.gadgetNotExist", null));
                uiManagement.reload();
                return;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.