Package org.eurekastreams.web.client.ui.common.stream.renderers.verb

Examples of org.eurekastreams.web.client.ui.common.stream.renderers.verb.VerbRenderer


        Panel mainPanel = new FlowPanel();
        mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamMessageItem());
        mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listItem());
        mainPanel.addStyleName(state.toString());

        VerbRenderer verbRenderer = verbDictionary.get(msg.getVerb());
        verbRenderer.setup(objectDictionary, msg, state, showRecipientInThisInstance);

        boolean doManageFlagged = showManageFlagged && !state.equals(State.READONLY) && msg.isDeletable();

        // left column items
        Panel leftColumn = null;
        if (doManageFlagged)
        {
            leftColumn = new FlowPanel();
            leftColumn.addStyleName(StaticResourceBundle.INSTANCE.coreCss().leftColumn());
            mainPanel.add(leftColumn);
        }

        // avatar
        Widget avatar = verbRenderer.getAvatar();
        if (avatar != null)
        {
            Panel parent = leftColumn == null ? mainPanel : leftColumn;
            parent.add(avatar);
        }

        if (doManageFlagged)
        {
            leftColumn.add(buildManageFlaggedControls(msg, mainPanel));
        }

        FlowPanel msgContent = new FlowPanel();
        msgContent.addStyleName(StaticResourceBundle.INSTANCE.coreCss().description());
        mainPanel.add(msgContent);

        FlowPanel xPanel = new FlowPanel();
        xPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageXPanel());
        msgContent.add(xPanel);

        FlowPanel xPanelOptions = new FlowPanel();
        xPanel.add(xPanelOptions);

        // Delete
        if (!state.equals(State.READONLY) && msg.isDeletable())
        {
            Label deleteLink = new Label("Delete");
            xPanelOptions.add(deleteLink);

            setupDeleteClickHandler(deleteLink, msg, mainPanel);
        }

        CommentsListPanel commentsPanel = null;
        if (!state.equals(State.READONLY))
        {
            commentsPanel = new CommentsListPanel(msg.getCommentCount(), msg.getEntityId(), msg.isCommentable(),
                    !singleView);
        }

        // row for who posted
        Panel sourceMetaData = new FlowPanel();
        sourceMetaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataSource());
        for (StatefulRenderer itemRenderer : verbRenderer.getSourceMetaDataItemRenderers())
        {
            Widget metaDataItem = itemRenderer.render();
            if (metaDataItem != null)
            {
                sourceMetaData.add(metaDataItem);
            }
        }
        msgContent.add(sourceMetaData);

        // content
        FlowPanel nonMetaData = new FlowPanel();
        nonMetaData.addStyleName(state.toString());

        Widget content = verbRenderer.getContent();
        if (content != null)
        {
            nonMetaData.add(content);
            msgContent.add(nonMetaData);
        }

        // additional metadata
        FlowPanel metaData = new FlowPanel();
        metaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataAdditional());
        for (StatefulRenderer itemRenderer : verbRenderer.getMetaDataItemRenderers())
        {
            Widget metaDataItem = itemRenderer.render();
            if (metaDataItem != null)
            {
                metaData.add(metaDataItem);
            }
        }
        if (metaData.getWidgetCount() > 0)
        {
            msgContent.add(metaData);
        }

        // timestamp and actions
        Panel timestampActions = new FlowPanel();
        timestampActions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageTimestampActionsArea());

        // Hijack this property and use to show lock icon for private activity.
        if (!msg.isShareable())
        {
            Label lockIcon = new Label("");
            lockIcon.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privateIcon());
            timestampActions.add(lockIcon);
        }

        String date = new DateFormatter(new Date()).timeAgo(msg.getPostedTime());
        Widget dateLink;
        if (createPermalink)
        {
            String permalinkUrl = activityLinkBuilder.buildActivityPermalink(msg.getId(), msg.getDestinationStream()
                    .getType(), msg.getDestinationStream().getUniqueIdentifier());
            dateLink = new InlineHyperlink(date, permalinkUrl);
        }
        else
        {
            dateLink = new InlineLabel(date);
        }
        dateLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageTimestampLink());
        timestampActions.add(dateLink);

        if (msg.getAppName() != null)
        {
            String appSource = msg.getAppSource();
            if (appSource != null)
            {
                FlowPanel viaPanel = new FlowPanel();
                viaPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().viaMetadata());
                viaPanel.add(new InlineLabel("via "));
                viaPanel.add(new Anchor(msg.getAppName(), appSource));
                timestampActions.add(viaPanel);
            }
            else
            {
                InlineLabel viaLine = new InlineLabel("via " + msg.getAppName());
                viaLine.addStyleName(StaticResourceBundle.INSTANCE.coreCss().viaMetadata());
                timestampActions.add(viaLine);
            }
            // TODO: If appSource is not supplied, the link should go to the respective galleries for apps and plugins.
            // However, the app galery requires knowing the start page tab id, and the worthwhile plugin gallery is only
            // available to coordinators.
        }

        if (verbRenderer.getAllowLike())
        {
            LikeCountWidget likeCount = new LikeCountWidget(msg.getEntityId(), msg.getLikeCount(), msg.getLikers(),
                    msg.isLiked());
            timestampActions.add(likeCount);
        }
View Full Code Here


        Panel mainPanel = new FlowPanel();
        mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamMessageItem());
        mainPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listItem());
        mainPanel.addStyleName(State.READONLY.toString());

        VerbRenderer verbRenderer = verbDictionary.get(msg.getVerb());
        verbRenderer.setup(objectDictionary, msg, State.DEFAULT, false);

        // left column items
        Panel leftColumn = null;

        // avatar
        Widget avatar = verbRenderer.getAvatar();
        if (avatar != null)
        {
            Panel parent = leftColumn == null ? mainPanel : leftColumn;
            parent.add(avatar);
        }

        FlowPanel msgContent = new FlowPanel();
        msgContent.addStyleName(StaticResourceBundle.INSTANCE.coreCss().description());
        mainPanel.add(msgContent);

        // row for who posted
        Panel sourceMetaData = new FlowPanel();
        sourceMetaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataSource());
        for (StatefulRenderer itemRenderer : verbRenderer.getSourceMetaDataItemRenderers())
        {
            Widget metaDataItem = itemRenderer.render();
            if (metaDataItem != null)
            {
                sourceMetaData.add(metaDataItem);
            }
        }
        msgContent.add(sourceMetaData);

        // content
        FlowPanel nonMetaData = new FlowPanel();
        nonMetaData.addStyleName(State.READONLY.toString());

        Widget content = verbRenderer.getContent();
        if (content != null)
        {
            nonMetaData.add(content);
            msgContent.add(nonMetaData);
        }

        // additional metadata
        FlowPanel metaData = new FlowPanel();
        metaData.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageMetadataAdditional());
        for (StatefulRenderer itemRenderer : verbRenderer.getMetaDataItemRenderers())
        {
            Widget metaDataItem = itemRenderer.render();
            if (metaDataItem != null)
            {
                metaData.add(metaDataItem);
View Full Code Here

TOP

Related Classes of org.eurekastreams.web.client.ui.common.stream.renderers.verb.VerbRenderer

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.