Package org.jasig.portal.layout.node

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


        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


    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

    }
   
    protected String determineDatabaseChannelSubscribeId(String layoutNodeId) {
        //Find the referenced Node in the user's layout
        final IUserLayoutManager userLayoutManager = this.getUserLayoutManager();
        final IUserLayoutChannelDescription channelNode = (IUserLayoutChannelDescription)userLayoutManager.getNode(layoutNodeId);
       
        //Lookup the IportletDefinition for the node
        final String portletPublishId = channelNode.getChannelPublishId();
        final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinition(portletPublishId);

        //Generate the subscribe ID used for the database
        return this.getPersistentLayoutNodeId(portletDefinition.getPortletDefinitionId());
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.layout.node.IUserLayoutChannelDescription

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.