Package org.exoplatform.application.gadget

Examples of org.exoplatform.application.gadget.Gadget


      {
         if (ApplicationType.GADGET.equals(app.getType()))
         {
            try
            {
               Gadget gadget;
               gadget = gadgetService.getGadget(app.getApplicationName());
               if (gadget != null)
                  app.setIconURL(gadget.getThumbnail());
            }
            catch (Exception e)
            {
            }
         }
View Full Code Here


            }
         }
         service.removeGadget(name);
         WebAppController webController = uiManagement.getApplicationComponent(WebAppController.class);
         webController.removeApplication(GadgetApplication.EXO_GADGET_GROUP + "/" + name);
         Gadget gadget = uiManagement.getGadget(name);
         if (gadget.isLocal())
         {
            // get dir path of gadget
            String gadgetUrl = gadget.getUrl();
            String[] gaggetUrlPart = gadgetUrl.split("/");
            String dirPath = gaggetUrlPart[gaggetUrlPart.length - 2];
            SourceStorage sourceStorage = uiManagement.getApplicationComponent(SourceStorage.class);
            sourceStorage.removeSource(dirPath + "/" + name + ".xml");
         }
View Full Code Here

   {
      GadgetRegistry registry = getRegistry();
      List<Gadget> gadgets = new ArrayList<Gadget>();
      for (GadgetDefinition def : registry.getGadgets())
      {
         Gadget gadget = loadGadget(def);
         gadgets.add(gadget);
      }
      if (sortComparator != null)
      {
         Collections.sort(gadgets, sortComparator);
View Full Code Here

         RemoteGadgetData remoteData = (RemoteGadgetData)data;
         url = remoteData.getURL();
      }

      //
      Gadget gadget = new Gadget();
      gadget.setName(def.getName());
      gadget.setDescription(def.getDescription());
      gadget.setLocal(def.isLocal());
      gadget.setTitle(def.getTitle());
      gadget.setReferenceUrl(def.getReferenceURL());
      gadget.setThumbnail(def.getThumbnail());
      gadget.setUrl(url);
      return gadget;
   }
View Full Code Here

         {
            String gadgetName = urlPref.replaceFirst(LOCAL_STRING, "");
            ExoContainer container = ExoContainerContext.getCurrentContainer();
            GadgetRegistryService gadgetService =
               (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
            Gadget gadget = gadgetService.getGadget(gadgetName);
            if (gadget != null)
            {
               return GadgetUtil.reproduceUrl(gadget.getUrl(), gadget.isLocal());
            }
         }
         catch (Exception e)
         {
            log.warn("Failure retrieving gadget from url!");
View Full Code Here

     *
     * @return url of gadget application, such as "http://www.google.com/ig/modules/horoscope.xml"
     */
    public String getUrl() {
        if (url_ == null) {
            Gadget gadget = getApplication();
            url_ = GadgetUtil.reproduceUrl(gadget.getUrl(), gadget.isLocal());
        }
        return url_;
    }
View Full Code Here

            GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
            for (String p : accessPermission) {
                if (userACL.hasPermission(p)) {
                    if (ApplicationType.GADGET.equals(app.getType())) {
                        try {
                            Gadget gadget;
                            gadget = gadgetService.getGadget(app.getApplicationName());
                            if (gadget != null)
                                app.setIconURL(gadget.getThumbnail());
                        } catch (Exception e) {
                        }
                    }
                    apps.add(app);
                    break;
View Full Code Here

public class GadgetUtil {

    private static final Logger log = LoggerFactory.getLogger(GadgetUtil.class);

    public static Gadget toGadget(String name, String path, boolean isLocal) throws Exception {
        Gadget gadget = new Gadget();
        gadget.setName(name);
        gadget.setUrl(path);
        gadget.setLocal(isLocal);
        Map<String, String> metaData = getMapMetadata(reproduceUrl(path, isLocal));
        if (metaData.containsKey("errors"))
            throw new Exception("error on the server: " + metaData.get("errors"));
        String title = metaData.get("directoryTitle");
        if (title == null || title.trim().length() < 1)
            title = metaData.get("title");
        if (title == null || title.trim().length() < 1)
            title = gadget.getName();
        gadget.setTitle(title);
        gadget.setDescription(metaData.get("description"));
        gadget.setReferenceUrl(metaData.get("titleUrl"));
        gadget.setThumbnail(metaData.get("thumbnail"));
        return gadget;
    }
View Full Code Here

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

    public static class CancelActionListener extends EventListener<UIAddGadget> {

        public void execute(Event<UIAddGadget> event) throws Exception {
            UIAddGadget uiForm = event.getSource();
            UIGadgetManagement uiManagement = uiForm.getParent();
            Gadget selectedGadget = uiManagement.getSelectedGadget();
            if (selectedGadget != null) {
                uiManagement.setSelectedGadget(selectedGadget.getName());
            } else
                uiManagement.reload();
            event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
        }
View Full Code Here

TOP

Related Classes of org.exoplatform.application.gadget.Gadget

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.