Search in sources :

Example 11 with SafeUri

use of com.google.gwt.safehtml.shared.SafeUri in project blogwt by billy1380.

the class HeaderPart method configureNavBar.

private void configureNavBar(boolean login) {
    if (login) {
        elNavRight.appendChild(elAccount);
    } else {
        elAccount.removeFromParent();
    }
    if (PropertyController.get().booleanProperty(PropertyHelper.DOWNLOAD_ENABLED, false) && login) {
        elNavRight.appendChild(elDownloads);
    } else {
        elDownloads.removeFromParent();
    }
    SafeUri href;
    if (PropertyController.get().booleanProperty(PropertyHelper.ALLOW_USER_REGISTRATION, false)) {
        if (login) {
            removeItem(PageTypeHelper.asHref(PageType.RegisterPageType));
        } else {
            href = PageTypeHelper.asHref(PageType.RegisterPageType);
            addItem(elNavRight, HeaderTemplates.INSTANCE.glyphItem("user", "Sign Up"), href);
        }
    }
    removeItem(PageTypeHelper.asHref(login ? PageType.LoginPageType : PageType.LogoutPageType));
    if (login || PropertyController.get().booleanProperty(PropertyHelper.SHOW_SIGN_IN, true)) {
        href = PageTypeHelper.asHref(login ? PageType.LogoutPageType : PageType.LoginPageType);
        addItem(elNavRight, HeaderTemplates.INSTANCE.glyphItem(login ? "log-out" : "log-in", login ? "Sign Out" : "Sign In"), href);
    }
    addAdminNav(login);
}
Also used : SafeUri(com.google.gwt.safehtml.shared.SafeUri)

Example 12 with SafeUri

use of com.google.gwt.safehtml.shared.SafeUri in project blogwt by billy1380.

the class PostSummaryCell method render.

@Override
public void render(Context context, Post value, SafeHtmlBuilder builder) {
    SafeUri link = PageTypeHelper.asHref(PageType.PostDetailPageType, PostHelper.getSlug(value));
    SafeHtml published = Templates.INSTANCE.notPublished(DateTimeHelper.ago(value.created));
    if (value.published != null) {
        published = Templates.INSTANCE.publishedDate(DateTimeHelper.ago(value.published));
    }
    String body = "Empty... :imp:";
    if (value.summary != null && value.summary.length() > 0) {
        body = value.summary;
    } else if (value.content != null && value.content.body != null && value.content.body.length() > 0) {
        body = value.content.body;
    }
    SafeHtml author = SafeHtmlUtils.EMPTY_SAFE_HTML;
    if (PropertyController.get().booleanProperty(PropertyHelper.POST_SHOW_AUTHOR, false)) {
        author = Templates.INSTANCE.author(UriUtils.fromString(value.author.avatar + "?s=" + UserHelper.AVATAR_HEADER_SIZE + "&default=retro"), UserHelper.handle(value.author));
    }
    RENDERER.render(builder, link, SafeHtmlUtils.fromTrustedString(PostHelper.makeHeading2(value.title)), SafeHtmlUtils.fromTrustedString(PostHelper.makeMarkup(body)), author, published, value.listed.booleanValue() ? SafeHtmlUtils.EMPTY_SAFE_HTML : Templates.INSTANCE.notVisible());
}
Also used : SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) SafeUri(com.google.gwt.safehtml.shared.SafeUri)

Aggregations

SafeUri (com.google.gwt.safehtml.shared.SafeUri)12 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 GWT (com.google.gwt.core.client.GWT)1 AnchorElement (com.google.gwt.dom.client.AnchorElement)1 Element (com.google.gwt.dom.client.Element)1 ImageElement (com.google.gwt.dom.client.ImageElement)1 PropertyController (com.willshex.blogwt.client.controller.PropertyController)1 Page (com.willshex.blogwt.shared.api.datatype.Page)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 BPMNViewDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition)1 ActivityShape (org.kie.workbench.common.stunner.cm.client.shape.ActivityShape)1 CaseManagementActivityShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementActivityShapeDef)1 ActivityView (org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView)1 DiagramRepresentation (org.kie.workbench.common.stunner.core.lookup.diagram.DiagramRepresentation)1 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)1 InOrder (org.mockito.InOrder)1