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

Examples of org.eurekastreams.web.client.ui.common.stream.renderers.content.ContentSegment


        Widget authorName = RenderUtilities.renderEntityName(author, "");
        authorName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageCommentAuthor());
        body.add(authorName);

        // parse the comment content
        ContentSegment segments = new ContentParser().split(comment.getBody().trim());
        boolean oversize = truncate && isTooLong(segments);

        // build/display the comment content, truncating if too long
        final ComplexPanel textContainer = new FlowPanel();
        textContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageCommentText());
        body.add(textContainer);

        // render only up to the limit
        Widget shortTextWidget = null;
        int size = 0;
        ContentSegment segment = segments;
        for (; segment != null; segment = segment.getNext())
        {
            // check for when to stop
            if (oversize && !segment.isTag())
            {
                int spaceLeft = TRUNCATE_LENGTH - size;
                int contentLength = segment.getContent().length();
                if (contentLength > spaceLeft)
                {
                    if (segment.isText())
                    {
                        String shortText = getTruncatedText(segment.getContent(), spaceLeft);
                        if (shortText != null)
                        {
                            shortTextWidget = new InlineLabel(shortText);
                            textContainer.add(shortTextWidget);
                        }
                    }
                    break;
                }
                size += contentLength;
            }

            contentRenderer.renderSegment(segment, textContainer, searchLinkBuilder);
        }
        final ContentSegment remainingSegments = segment;
        final Widget shortTextToReplace = shortTextWidget;

        // if too long, add a ... and "show more" link
        if (oversize)
        {
View Full Code Here


        activityContent = activityContent.replace("%EUREKA:ACTORNAME%", actorDisplayName);

        ComplexPanel widget = new FlowPanel();
        widget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageBody());

        ContentSegment segmentList = parser.split(activityContent);
        renderer.renderList(segmentList, widget, new ActivityStreamSearchLinkBuilder(activity));

        return widget;
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.web.client.ui.common.stream.renderers.content.ContentSegment

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.