Example usage for com.google.gwt.safehtml.shared UriUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared UriUtils fromSafeConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared UriUtils fromSafeConstant.

Prototype

public static SafeUri fromSafeConstant(String s) 

Source Link

Document

Returns a SafeUri constructed from a value that is fully under the control of the program, e.g., a constant.

Usage

From source file:com.centretown.parts.client.place.NameTokens.java

License:Apache License

public static final SafeUri getHome() {
    return UriUtils.fromSafeConstant(HOME);
}

From source file:com.centretown.parts.client.place.NameTokens.java

License:Apache License

public static final SafeUri getUser() {
    return UriUtils.fromSafeConstant(SESSION);
}

From source file:com.centretown.parts.client.place.NameTokens.java

License:Apache License

public static final SafeUri getUsers() {
    return UriUtils.fromSafeConstant(USERS);
}

From source file:com.codenvy.plugin.angularjs.core.client.editor.AngularJSCompletionProposal.java

License:Open Source License

@Override
public Element getAdditionalProposalInfo() {
    // if it's an angular directive, return a link to the documentation
    if (!name.startsWith("ng-")) {
        return null;
    }//from  w  w  w .  ja v a2 s.  co m
    // convert the name ng-xxxx into ngXxxx
    String directiveName = "ng".concat(name.substring(3, 4).toUpperCase()).concat(name.substring(4));
    String link = "http://docs.angularjs.org/api/ng/directive/".concat(directiveName);
    final SafeUri linkUri = UriUtils.fromSafeConstant(link);

    final Element result = Elements.createDivElement();
    result.setInnerHTML(TEMPLATE.additionalInfo(linkUri, link).asString());
    return result;
}

From source file:com.seanchenxi.gwt.serenity.client.view.impl.SerenityLayoutImpl.java

License:Apache License

public SerenityLayoutImpl() {
    SerenityResources.COMMON.commonCSS().ensureInjected();
    initWidget(UIBINDER.createAndBindUi(this));
    getElement().setId("main");
    resource.style().ensureInjected();/*from   w  w  w.  j a va  2  s  . c  o  m*/
    header.setText(SerenityResources.MSG.page_Title());
    header.setSubText(SerenityResources.MSG.page_subTitle());
    header.getElement().setId("header");
    sidebarContainer.getElement().setId("sidebar");
    contentListContainer.getElement().setId("contents");
    SafeHtmlBuilder shb = new SafeHtmlBuilder();
    shb.append(FOOTER_TEMPLATE.copyright(
            DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.YEAR).format(new Date()),
            UriUtils.fromSafeConstant(SerenityUtil.getWpBaseUrl()), Window.Location.getHost()));
    shb.append(FOOTER_TEMPLATE.poweredBy(UriUtils.fromSafeConstant(SerenityResources.MSG.wordpress_URL()),
            SerenityResources.MSG.wordpress_URL(), SerenityUtil.getWpNaming()));
    footer.setHTML(shb.toSafeHtml());
    footer.getElement().setId("footer");
}

From source file:com.seanchenxi.serenity.client.view.impl.SerenityLayoutImpl.java

License:Apache License

public SerenityLayoutImpl() {
    SerenityResources.COMMON.commonCSS().ensureInjected();
    initWidget(UIBINDER.createAndBindUi(this));
    resource.style().ensureInjected();/*from   w w w  . j  a  v a2s  .com*/
    header.setText(SerenityResources.MSG.page_Title());
    header.setSubText(SerenityResources.MSG.page_subTitle());
    SafeHtmlBuilder shb = new SafeHtmlBuilder();
    shb.append(FOOTER_TEMPLATE.copyright(
            DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.YEAR).format(new Date()),
            UriUtils.fromSafeConstant(SerenityUtil.getWpBaseUrl()), Window.Location.getHost()));
    shb.append(FOOTER_TEMPLATE.poweredBy(UriUtils.fromSafeConstant(SerenityResources.MSG.wordpress_URL()),
            SerenityResources.MSG.wordpress_URL(), SerenityUtil.getWpNaming()));
    footer.setHTML(shb.toSafeHtml());
}

From source file:fr.onevu.gwt.uibinder.test.client.FakeBundle.java

License:Apache License

public SafeUri aSafeUri() {
    return UriUtils.fromSafeConstant(anUnsafeUri());
}

From source file:org.jboss.ci.tracker.client.widgets.BuildList.java

License:Open Source License

private void initDatagrid() {

    TextColumn<BuildDto> nameColumn = new TextColumn<BuildDto>() {
        @Override/* ww w.j a va2s. co  m*/
        public String getValue(BuildDto object) {
            return object.getName();
        }
    };

    Column urlColumn = new Column<BuildDto, SafeHtml>(new SafeHtmlCell()) {

        @Override
        public SafeHtml getValue(BuildDto object) {
            SafeUri href = UriUtils.fromSafeConstant(object.getUrl());
            return cell.anchor(href, object.getUrl());
        }
    };

    dataGrid.setColumnWidth(nameColumn, 40, Style.Unit.PX);
    dataGrid.addColumn(nameColumn, "Name");

    dataGrid.setColumnWidth(urlColumn, 40, Style.Unit.PX);
    dataGrid.addColumn(urlColumn, "URL");

    selectionModel = new MultiSelectionModel<BuildDto>(keyProvider);

    dataGrid.addDomHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            List<BuildDto> buildList = getSelectedBuilds();

            for (BuildDto buildDto : buildList) {
                buildListParamBuildListBridge.setBuildAndDisplayParamBuilds(buildDto);
            }
        }
    }, DoubleClickEvent.getType());

    dataGrid.setSelectionModel(selectionModel);
    updateDataGrid();
}

From source file:org.jboss.ci.tracker.client.widgets.JobList.java

License:Open Source License

private void initDatagrid() {
    Column urlColumn = new Column<JobDto, SafeHtml>(new SafeHtmlCell()) {

        @Override//from w w  w  .ja v a 2  s .  co m
        public SafeHtml getValue(JobDto object) {
            SafeUri href = UriUtils.fromSafeConstant(object.getUrl());
            return cell.anchor(href, object.getUrl());
        }
    };

    TextColumn<JobDto> nameColumn = new TextColumn<JobDto>() {
        @Override
        public String getValue(JobDto object) {
            return object.getName();
        }
    };

    Header<String> nameHeader = new Header<String>(new TextCell()) {
        @Override
        public String getValue() {
            List<JobDto> items = dataGrid.getVisibleItems();
            return "Name";
        }
    };

    dataGrid.addColumn(nameColumn, new SafeHtmlHeader(new SafeHtml() {

        @Override
        public String asString() {
            return "Name";
        }
    }));

    dataGrid.setColumnWidth(nameColumn, 40, Style.Unit.PCT);
    dataGrid.addColumn(urlColumn, "URL");
    dataGrid.setColumnWidth(urlColumn, 60, Style.Unit.PCT);

    selectionModel = new SingleSelectionModel<JobDto>(keyProvider);

    dataGrid.addDomHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(DoubleClickEvent event) {

            List<JobDto> jobList = getSelectedJobs();

            for (JobDto jobDto : jobList) {
                jobListBuildListBridge.setJobAndDisplayBuilds(jobDto);
            }
        }
    }, DoubleClickEvent.getType());

    dataGrid.setSelectionModel(selectionModel);

    updateDataGrid();
}

From source file:org.jboss.ci.tracker.client.widgets.ParamBuildList.java

License:Open Source License

private void initDatagrid() {

    TextColumn<ParameterizedBuildDto> nameColumn = new TextColumn<ParameterizedBuildDto>() {
        @Override/*from   ww  w .  j  a va 2s .  c o  m*/
        public String getValue(ParameterizedBuildDto object) {
            return object.getName();

        }
    };

    TextColumn<ParameterizedBuildDto> labelColumn = new TextColumn<ParameterizedBuildDto>() {
        @Override
        public String getValue(ParameterizedBuildDto object) {
            String label = object.getUrl().substring(0, object.getUrl().lastIndexOf("/"));
            label = label.substring(0, label.lastIndexOf("/"));
            label = label.substring(label.lastIndexOf("/") + 1, label.length());
            return label;
        }
    };

    Column urlColumn = new Column<ParameterizedBuildDto, SafeHtml>(new SafeHtmlCell()) {

        @Override
        public SafeHtml getValue(ParameterizedBuildDto object) {
            SafeUri href = UriUtils.fromSafeConstant(object.getUrl());
            return cell.anchor(href, object.getUrl());
        }
    };

    dataGrid.setColumnWidth(nameColumn, 15, Style.Unit.PX);
    dataGrid.addColumn(nameColumn, "Name");

    dataGrid.setColumnWidth(labelColumn, 25, Style.Unit.PX);
    dataGrid.addColumn(labelColumn, "Parameterization");

    dataGrid.setColumnWidth(urlColumn, 40, Style.Unit.PX);
    dataGrid.addColumn(urlColumn, "URL");

    selectionModel = new SingleSelectionModel<ParameterizedBuildDto>(keyProvider);

    dataGrid.addDomHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            List<ParameterizedBuildDto> paramBuilds = getSelectedParamBuilds();

            for (ParameterizedBuildDto paramBuild : paramBuilds) {
                paramBuildResultListBridge.setParamBuildAndDisplayResults(paramBuild);
            }
        }
    }, DoubleClickEvent.getType());

    dataGrid.setSelectionModel(selectionModel);
    updateDataGrid();
}