Examples of UserLayoutChannelDescription


Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

   * @param destinationElementId the ID of the channel to insert the new channel before or append after
   * @throws PortalException
   */
  private final void addChannel(Element newChannel, String position, String destinationElementId) throws PortalException
  {
      IUserLayoutChannelDescription channel=new UserLayoutChannelDescription(newChannel);
      if(isTab(destinationElementId)) {
          // create a new column and move channel there
          IUserLayoutNodeDescription newColumn=ulm.addNode(createFolder("Column"),destinationElementId,null);
          ulm.addNode(channel,newColumn.getId(),null);
      } else if(isColumn(destinationElementId)) {
          // move the channel into the column
          ulm.addNode(channel,destinationElementId,null);
      } else {
          // assume that destinationElementId is that of a sibling channel
          String siblingId=null;
          if(position.equals("before")) {
              siblingId=destinationElementId;
          }
          ulm.addNode(channel,ulm.getParentId(destinationElementId),siblingId);
      }

      // Make sure ChannelManager knows about the new channel
      pcs.getChannelManager().instantiateChannel(channel.getId());

      ulm.saveUserLayout();
  }
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

    public IUserLayoutNodeDescription createNodeDescription( int nodeType ) throws PortalException {
            switch ( nodeType ) {
              case IUserLayoutNodeDescription.FOLDER:
                return new UserLayoutFolderDescription();
              case IUserLayoutNodeDescription.CHANNEL:
                return new UserLayoutChannelDescription();
              default:
                return null;
            }
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

        Document root = plfChan.getOwnerDocument();
       
        // TODO figure out how the line below is supposed to take place in
        // the latest codebase via the interface rather than the implemention
        // class.
        UserLayoutChannelDescription newChanDef = (UserLayoutChannelDescription) newChan;
        newChanDef.addParameterChildren( plfChan, root );
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

        {
            return new UserLayoutFolderDescription();
        }
        else
        {
            return new UserLayoutChannelDescription();
        }
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

            throw new PortalException("Failed to obtain channel definition using fname: " + fname);
        }
    }
   
    protected IUserLayoutChannelDescription createUserLayoutChannelDescription(String nodeId, IPortletDefinition chanDef) {
        IUserLayoutChannelDescription ulnd = new UserLayoutChannelDescription();

        ulnd.setId(nodeId);
        ulnd.setName(chanDef.getName());
        ulnd.setUnremovable(true);
        ulnd.setImmutable(true);
        ulnd.setHidden(false);
        ulnd.setTitle(chanDef.getTitle());
        ulnd.setDescription(chanDef.getDescription());
        ulnd.setChannelPublishId("" + chanDef.getPortletDefinitionId().getStringId());
        ulnd.setChannelTypeId("" + chanDef.getType().getId());
        ulnd.setFunctionalName(chanDef.getFName());
        ulnd.setTimeout(chanDef.getTimeout());
       
        Set<IPortletDefinitionParameter> parms = chanDef.getParameters();
        for ( IPortletDefinitionParameter parm : parms )
        {
            ulnd.setParameterValue(parm.getName(),parm.getValue());
        }
       
        return ulnd;
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

        IUserInstance ui = userInstanceManager.getUserInstance(request);

        UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
        IUserLayoutManager ulm = upm.getUserLayoutManager();
       
        IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(portletDefinitionRegistry.getPortletDefinition(channelId));
       
        final Locale locale = RequestContextUtils.getLocale(request);
       
        //get favorite tab
        String favoriteTabNodeId = FavoritesUtils.getFavoriteTabNodeId(ulm.getUserLayout());

        if(favoriteTabNodeId != null) {
            //add portlet to favorite tab
            IUserLayoutNodeDescription node = addNodeToTab(ulm, channel, favoriteTabNodeId);

            if (node == null) {
                return new ModelAndView("jsonView",
                        Collections.singletonMap("response",
                                getMessage("error.add.portlet.in.tab", "Can''t add a new favorite", locale)));
            }

            try {
                // save the user's layout
                ulm.saveUserLayout();
            } catch (Exception e) {
                log.warn("Error saving layout", e);
                return new ModelAndView("jsonView",
                        Collections.singletonMap("response",
                                getMessage("error.persisting.layout.change", "Can''t add a new favorite", locale)));
            }

            //document success for notifications
            Map<String, String> model = new HashMap<String, String>();
            final String channelTitle = channel.getTitle();
            model.put("response",
                    getMessage("favorites.added.favorite", channelTitle,
                            "Added " + channelTitle + " as a favorite.", locale));
            model.put("newNodeId", node.getId());
            return new ModelAndView("jsonView", model);
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

            //search for the favorite to delete
            EqualPredicate nameEqlPredicate = new EqualPredicate(functionalName);
            Object result = CollectionUtils.find(favoritePortlets, new BeanPredicate("functionalName",nameEqlPredicate));
           
            if(result != null && result instanceof UserLayoutChannelDescription) {
                UserLayoutChannelDescription channelDescription = (UserLayoutChannelDescription)result;
                try {
                    if (!ulm.deleteNode(channelDescription.getChannelSubscribeId())) {
                        log.warn("Error deleting the node" + channelId + "from favorites for user " + (upm.getPerson() == null ? "unknown" : upm.getPerson().getID()));
                        response.setStatus(HttpServletResponse.SC_ACCEPTED);
                        return new ModelAndView("jsonView", Collections.singletonMap("response", getMessage("error.remove.favorite", "Can''t remove favorite", locale)));
                    }
                    // save the user's layout
View Full Code Here

Examples of org.jasig.portal.layout.node.UserLayoutChannelDescription

    String sourceId = request.getParameter("channelID");
    String method = request.getParameter("position");

    IPortletDefinition definition = portletDefinitionRegistry.getPortletDefinition(sourceId);

        IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(definition);

    IUserLayoutNodeDescription node = null;
    if (isTab(ulm, destinationId)) {
            node = addNodeToTab(ulm,channel, destinationId);

    } else if (isColumn(ulm, destinationId)) {
      // move the channel into the column
      node = ulm.addNode(channel, destinationId, null);
    } else {
      // If we're moving this element before another one, we need
      // to know what the target is. If there's no target, just
      // assume we're moving it to the very end of the column.
      String siblingId = null;
      if (method.equals("insertBefore"))
        siblingId = destinationId;

      // move the node as requested and save the layout
      node = ulm.addNode(channel, ulm.getParentId(destinationId),
          siblingId);
    }

    final Locale locale = RequestContextUtils.getLocale(request);

    if (node == null) {
      return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.add.portlet.in.tab", "Can''t add a new channel", locale)));
    }

    String nodeId = node.getId();

    try {
      // save the user's layout
            ulm.saveUserLayout();
            if(addedWindowState!=null){
                IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(request, channel.getFunctionalName());
                portletWindow.setWindowState(addedWindowState);
                this.portletWindowRegistry.storePortletWindow(request, portletWindow);
            }
        } catch (Exception e) {
            log.warn("Error saving layout", e);
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.