Package org.exoplatform.portal.webui.application

Examples of org.exoplatform.portal.webui.application.UIGadget


         UIDashboard uiDashboard = event.getSource();
         String objectId = context.getRequestParameter(OBJECTID);
         String minimized = context.getRequestParameter("minimized");

         UIDashboardContainer uiDashboardCont = uiDashboard.getChild(UIDashboardContainer.class);
         UIGadget uiGadget = uiDashboard.getChild(UIDashboardContainer.class).getUIGadget(objectId);
         if (uiGadget.isLossData())
         {
            UIPortalApplication uiApp = Util.getUIPortalApplication();
            uiApp.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
            uiDashboardCont.removeUIGadget(uiGadget.getId());
            context.addUIComponentToUpdateByAjax(uiDashboard);
         }
         else
         {
            uiGadget.getProperties().setProperty("minimized", minimized);
         }
         uiDashboardCont.save();
         context.addUIComponentToUpdateByAjax(uiGadget);
      }
View Full Code Here


         WebuiRequestContext context = event.getRequestContext();
         UIDashboard uiDashboard = event.getSource();
         String objectId = context.getRequestParameter(OBJECTID);
         String maximize = context.getRequestParameter("maximize");
         UIDashboardContainer uiDashboardCont = uiDashboard.getChild(UIDashboardContainer.class);
         UIGadget uiGadget = uiDashboardCont.getUIGadget(objectId);
         if (uiGadget == null || uiGadget.isLossData())
         {
            UIPortalApplication uiApp = Util.getUIPortalApplication();
            uiApp.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
            if (uiGadget != null)
               uiDashboardCont.removeUIGadget(uiGadget.getId());
            uiDashboardCont.save();
            context.addUIComponentToUpdateByAjax(uiDashboard);
            return;
         }
        
         //TODO nguyenanhkien2a@gmail.com
         //We need to expand unminimized state of uiGadget to view all body of gadget, not just a title with no content
         uiGadget.getProperties().setProperty("minimized", "false");
         uiDashboardCont.save();
        
         if (maximize.equals("maximize"))
         {
            uiGadget.setView(UIGadget.CANVAS_VIEW);
            uiDashboard.setMaximizedGadget(uiGadget);
         }
         else
         {
            uiGadget.setView(UIGadget.HOME_VIEW);
            uiDashboard.setMaximizedGadget(null);
         }
      }
View Full Code Here

        } else if (model instanceof Application) {
            Application application = (Application) model;

            if (dashboard && application.getType() == ApplicationType.GADGET) {
                Application<Gadget> ga = (Application<Gadget>) application;
                UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
                uiGadget.setStorageId(application.getStorageId());
                toUIGadget(uiGadget, ga);
                uiComponent = uiGadget;
            } else {
                UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
                uiPortlet.setStorageId(application.getStorageId());
View Full Code Here

         Application application = (Application)model;

         if (dashboard && application.getType() == ApplicationType.GADGET)
         {
            Application<Gadget> ga = (Application<Gadget>)application;
            UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
            uiGadget.setStorageId(application.getStorageId());
            toUIGadget(uiGadget, ga);
            uiComponent = uiGadget;
         }
         else
         {
View Full Code Here

            if (!url.matches(URLValidator.URL_REGEX)) {
                uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
                return;
            }
            Gadget gadget;
            UIGadget uiGadget;

            // TODO check the way we create the unique ID, is it really unique?
            try {
                String name = "gadget" + url.hashCode();
                gadget = GadgetUtil.toGadget(name, url, false);
                service.saveGadget(gadget);
                uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);
                uiGadget.setState(new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>(gadget.getName()));
            } catch (Exception e) {
                String aggregatorId = uiDashboard.getAggregatorId();
                gadget = service.getGadget(aggregatorId);
                // TODO make sure it's an rss feed
                // TODO make sure that we did not add it already
                uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);

                org.exoplatform.portal.pom.spi.gadget.Gadget contentState = new org.exoplatform.portal.pom.spi.gadget.Gadget();
                contentState.addUserPref("{'rssurl':'" + url + "'}");
                TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget> applicationState = new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>(
                        gadget.getName(), contentState);

                uiGadget.setState(applicationState);
            }

            uiContainer.addUIGadget(uiGadget, 0, 0);
            uiContainer.save();
            uiForm.reset();
View Full Code Here

        addChild(UIDashboardContainer.class, null, null);
    }

    @Override
    public void processRender(WebuiRequestContext context) throws Exception {
        UIGadget uiGadget = this.getMaximizedGadget();
        if (uiGadget != null) {
            if (context.getAttribute(APP_NOT_EXIST) != null || context.getAttribute(UIGadget.SAVE_PREF_FAIL) != null) {
                this.setMaximizedGadget(null);
            }
        }
View Full Code Here

            UIDashboard uiDashboard = event.getSource();
            String objectId = context.getRequestParameter(OBJECTID);
            String minimized = context.getRequestParameter("minimized");

            UIDashboardContainer uiDashboardCont = uiDashboard.getChild(UIDashboardContainer.class);
            UIGadget uiGadget = uiDashboard.getChild(UIDashboardContainer.class).getUIGadget(objectId);
            if (uiGadget.isLossData()) {
                UIPortalApplication uiApp = Util.getUIPortalApplication();
                uiApp.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
                context.setAttribute(APP_NOT_EXIST, true);
                context.addUIComponentToUpdateByAjax(uiDashboard);
            } else {
                uiGadget.getProperties().setProperty("minimized", minimized);
                uiDashboardCont.save();
                if (context.getAttribute(UIDashboardContainer.SAVE_FAIL) != null) {
                    return;
                }
                Util.getPortalRequestContext().setResponseComplete(true);
View Full Code Here

            WebuiRequestContext context = event.getRequestContext();
            UIDashboard uiDashboard = event.getSource();
            String objectId = context.getRequestParameter(OBJECTID);
            String maximize = context.getRequestParameter("maximize");
            UIDashboardContainer uiDashboardCont = uiDashboard.getChild(UIDashboardContainer.class);
            UIGadget uiGadget = uiDashboardCont.getUIGadget(objectId);
            if (uiGadget == null || uiGadget.isLossData()) {
                UIPortalApplication uiApp = Util.getUIPortalApplication();
                uiApp.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
                context.setAttribute(APP_NOT_EXIST, true);
                context.addUIComponentToUpdateByAjax(uiDashboard);
                return;
            }

            // TODO nguyenanhkien2a@gmail.comá
            // We need to expand unminimized state of uiGadget to view all body of
            // gadget, not just a title with no content
            uiGadget.getProperties().setProperty("minimized", "false");
            uiDashboardCont.save();

            if (maximize.equals("maximize") && context.getAttribute(UIDashboardContainer.SAVE_FAIL) == null) {
                uiGadget.setView(UIGadget.CANVAS_VIEW);
                uiDashboard.setMaximizedGadget(uiGadget);
            } else {
                uiGadget.setView(UIGadget.HOME_VIEW);
                uiDashboard.setMaximizedGadget(null);
            }
        }
View Full Code Here

     */
    public UIGadget getUIGadget(final String gadgetId) {
        List<UIContainer> columns = getColumns();
        for (int iCol = 0; iCol < getColumns().size(); iCol++) {
            for (int iRow = 0; iRow < columns.get(iCol).getChildren().size(); iRow++) {
                UIGadget gadget = (UIGadget) columns.get(iCol).getChild(iRow);
                if (gadgetId.equals(gadget.getId())) {
                    return gadget;
                }
            }
        }
        return null;
View Full Code Here

     * @return <code>UIGadget</code> which deleted<br>
     *         <code>null</code> otherwise
     * @see UIGadget
     */
    public UIGadget removeUIGadget(final String gadgetId) {
        UIGadget gadget = getUIGadget(gadgetId);
        if (gadget != null) {
            UIContainer uiContainer = gadget.getParent();
            gadget.setParent(null);
            uiContainer.getChildren().remove(gadget);
        }
        return gadget;
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.webui.application.UIGadget

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.