Here are the examples of the java api play.twirl.api.Html taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
11 Examples
19
Source : LazyHtml.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public Html render(int level) {
Html content = baseContent;
for (HtmlTransformation transformation : transformations) {
content = transformation.apply(content);
}
return content;
}
19
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public void setWarning(Html warning) {
this.warning = warning;
}
19
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public void setContent(Html content) {
this.content = new LazyHtml(content);
}
18
Source : LazyHtml.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public final clreplaced LazyHtml {
private final Html baseContent;
private final List<HtmlTransformation> transformations;
public LazyHtml(Html baseContent) {
this.baseContent = baseContent;
this.transformations = Lists.newArrayList();
}
public void appendLayout(HtmlTransformation transformation) {
transformations.add(transformation);
}
public Html render() {
return render(0);
}
public Html render(int level) {
Html content = baseContent;
for (HtmlTransformation transformation : transformations) {
content = transformation.apply(content);
}
return content;
}
}
18
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public final clreplaced HtmlTemplate {
private Http.Request req;
private LazyHtml content;
private String pagereplacedle;
private String mainreplacedle;
private String secondaryreplacedle;
private String description;
private Html warning;
private final List<InternalLink> breadcrumbLocations;
private final List<InternalLink> sidebarMenus;
private final List<InternalLink> categoryTabs;
private final List<InternalLink> mainTabs;
private final List<InternalLink> secondaryTabs;
private final List<InternalLink> tertiaryTabs;
private final List<InternalLink> mainButtons;
private final List<InternalLink> secondaryButtons;
private final List<Html> upperSidebarWidgets;
private final List<Html> lowerSidebarWidgets;
private final List<Html> additionalScripts;
private InternalLink mainBackButton;
private boolean singleColumn;
private boolean reverseBreadcrumbs;
public HtmlTemplate(Http.Request req) {
this.req = req;
this.breadcrumbLocations = Lists.newArrayList();
this.sidebarMenus = Lists.newArrayList();
this.categoryTabs = Lists.newArrayList();
this.mainTabs = Lists.newArrayList();
this.secondaryTabs = Lists.newArrayList();
this.tertiaryTabs = Lists.newArrayList();
this.mainButtons = Lists.newArrayList();
this.secondaryButtons = Lists.newArrayList();
this.upperSidebarWidgets = Lists.newArrayList();
this.lowerSidebarWidgets = Lists.newArrayList();
this.additionalScripts = Lists.newArrayList();
this.singleColumn = false;
this.reverseBreadcrumbs = false;
}
public Http.Request getRequest() {
return req;
}
public void setContent(Html content) {
this.content = new LazyHtml(content);
}
public void transformContent(HtmlTransformation transformation) {
this.content.appendLayout(transformation);
}
public LazyHtml getContent() {
return content;
}
public void setSingleColumn() {
this.singleColumn = true;
}
public void setTwoColumns() {
this.singleColumn = false;
}
public boolean isSingleColumn() {
return singleColumn;
}
public void setPagereplacedle(String pagereplacedle) {
this.pagereplacedle = pagereplacedle;
}
public String getPagereplacedle() {
return pagereplacedle;
}
public void setMainreplacedle(String mainreplacedle) {
this.mainreplacedle = mainreplacedle;
this.pagereplacedle = mainreplacedle;
}
public String getMainreplacedle() {
return mainreplacedle;
}
public boolean hasMainreplacedle() {
return mainreplacedle != null;
}
public void setSecondaryreplacedle(String mainreplacedle) {
this.secondaryreplacedle = mainreplacedle;
}
public String getSecondaryreplacedle() {
return secondaryreplacedle;
}
public boolean hreplacedecondaryreplacedle() {
return secondaryreplacedle != null;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public boolean hasDescription() {
return description != null;
}
public void setWarning(Html warning) {
this.warning = warning;
}
public Html getWarning() {
return warning;
}
public boolean hasWarning() {
return warning != null;
}
public void markBreadcrumbLocation(String label, Call target) {
breadcrumbLocations.add(new InternalLink(label, target));
}
public List<InternalLink> getBreadcrumbLinks() {
List<InternalLink> breadcrumbLocationsCopy = ImmutableList.copyOf(this.breadcrumbLocations);
if (reverseBreadcrumbs) {
breadcrumbLocationsCopy = Lists.reverse(breadcrumbLocationsCopy);
}
return breadcrumbLocationsCopy;
}
public void addSidebarMenu(String label, Call target) {
sidebarMenus.add(new InternalLink(label, target));
}
public List<InternalLink> getSidebarMenus() {
return ImmutableList.copyOf(sidebarMenus);
}
public void addCategoryTab(String label, Call target) {
categoryTabs.add(new InternalLink(label, target));
}
public List<InternalLink> getCategoryTabs() {
return ImmutableList.copyOf(categoryTabs);
}
public boolean hasCategoryTabs() {
return !categoryTabs.isEmpty();
}
public void addMainTab(String label, Call target) {
mainTabs.add(new InternalLink(label, target));
}
public List<InternalLink> getMainTabs() {
return ImmutableList.copyOf(mainTabs);
}
public boolean hasMainTabs() {
return !mainTabs.isEmpty();
}
public void addSecondaryTab(String label, Call target) {
secondaryTabs.add(new InternalLink(label, target));
}
public List<InternalLink> getSecondaryTabs() {
return ImmutableList.copyOf(secondaryTabs);
}
public boolean hreplacedecondaryTabs() {
return !secondaryTabs.isEmpty();
}
public void addTertiaryTab(String label, Call target) {
tertiaryTabs.add(new InternalLink(label, target));
}
public List<InternalLink> getTertiaryTabs() {
return ImmutableList.copyOf(tertiaryTabs);
}
public boolean hasTertiaryTabs() {
return !tertiaryTabs.isEmpty();
}
public void addMainButton(String label, Call target) {
mainButtons.add(new InternalLink(label, target));
}
public List<InternalLink> getMainButtons() {
return ImmutableList.copyOf(mainButtons);
}
public void addSecondaryButton(String label, Call target) {
secondaryButtons.add(new InternalLink(label, target));
}
public List<InternalLink> getSecondaryButtons() {
return ImmutableList.copyOf(secondaryButtons);
}
public void setMainBackButton(String label, Call target) {
this.mainBackButton = new InternalLink(label, target);
}
public InternalLink getMainBackButton() {
return mainBackButton;
}
public void addUpperSidebarWidget(Html widget) {
upperSidebarWidgets.add(widget);
}
public List<Html> getUpperSidebarWidgets() {
return ImmutableList.copyOf(upperSidebarWidgets);
}
public void addLowerSidebarWidget(Html widget) {
lowerSidebarWidgets.add(widget);
}
public List<Html> getLowerSidebarWidgets() {
return ImmutableList.copyOf(lowerSidebarWidgets);
}
public void addAdditionalScript(Html script) {
additionalScripts.add(script);
}
public List<Html> getAdditionalScripts() {
return ImmutableList.copyOf(additionalScripts);
}
}
18
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public void addAdditionalScript(Html script) {
additionalScripts.add(script);
}
18
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public void addLowerSidebarWidget(Html widget) {
lowerSidebarWidgets.add(widget);
}
18
Source : HtmlTemplate.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
public void addUpperSidebarWidget(Html widget) {
upperSidebarWidgets.add(widget);
}
17
Source : BundleItemController.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
private Result showCreateItem(Http.Request req, Problem problem, String itemType, Html html, long page, String orderBy, String orderDir, String filterString) {
HtmlTemplate template = getBaseHtmlTemplate(req);
template.setContent(html);
template.markBreadcrumbLocation("Create item", routes.BundleItemController.createItem(problem.getId(), itemType, page, orderBy, orderDir, filterString));
template.setPagereplacedle("Problem - Bundle - Items - Create");
return renderTemplate(template, problem);
}
16
Source : BundleItemController.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
private Result showEdireplacedem(Http.Request req, Problem problem, String language, BundleItem item, Html html, Set<String> allowedLanguages) {
HtmlTemplate template = getBaseHtmlTemplate(req);
template.setContent(html);
appendStatementLanguageSelection(template, language, allowedLanguages, org.iatoki.judgels.sandalphon.problem.base.routes.ProblemController.switchLanguage(problem.getId()));
template.markBreadcrumbLocation("Update item", routes.BundleItemController.edireplacedem(problem.getId(), item.getJid()));
template.setPagereplacedle("Problem - Bundle - Item - Update");
return renderTemplate(template, problem);
}
15
Source : AbstractJudgelsController.java
with GNU General Public License v2.0
from ia-toki
with GNU General Public License v2.0
from ia-toki
protected static Result getResult(LazyHtml content, int statusCode) {
HtmlCompressor htmlCompressor = new HtmlCompressor();
Html compressedContent = new Html(htmlCompressor.compress(content.render().body()));
switch(statusCode) {
case Http.Status.OK:
return Results.ok(compressedContent);
case Http.Status.NOT_FOUND:
return Results.notFound(compressedContent);
default:
return Results.badRequest(compressedContent);
}
}