本文整理汇总了Java中play.twirl.api.Html类的典型用法代码示例。如果您正苦于以下问题:Java Html类的具体用法?Java Html怎么用?Java Html使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Html类属于play.twirl.api包,在下文中一共展示了Html类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderDisplay
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderDisplay(II18nMessagesPlugin i18nMessagesPlugin) {
if (value != null && !value.equals("")) {
String label = value;
String[] values = value.split("/");
if (values.length > 1) {
label = values[values.length - 1];
}
return views.html.framework_views.parts.formats.display_url.render(value, label, this.customAttributeDefinition.isNewWindow());
}
return views.html.framework_views.parts.formats.display_object.render(value, false);
}
示例2: renderFormField
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderFormField(II18nMessagesPlugin i18nMessagesPlugin, IUserSessionManagerPlugin userSessionManagerPlugin,
IImplementationDefinedObjectService implementationDefinedObjectService, Field field, boolean displayDescription) {
String description = "";
if (displayDescription) {
description = Msg.get(customAttributeDefinition.description);
}
String uid = userSessionManagerPlugin.getUserSessionId(Controller.ctx());
return views.html.framework_views.parts.checkboxlist.render(field, Msg.get(customAttributeDefinition.name), description,
customAttributeDefinition.getValueHoldersCollectionFromNameForDynamicMultiItemCustomAttribute(i18nMessagesPlugin, uid), true, false,
customAttributeDefinition.isRequired());
}
示例3: renderFormField
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderFormField(II18nMessagesPlugin i18nMessagesPlugin, IUserSessionManagerPlugin userSessionManagerPlugin,
IImplementationDefinedObjectService implementationDefinedObjectService, Field field, boolean displayDescription) {
String description = "";
if (displayDescription) {
description = Msg.get(customAttributeDefinition.description);
}
if (!customAttributeDefinition.isAutoComplete()) {
String uid = userSessionManagerPlugin.getUserSessionId(Controller.ctx());
return views.html.framework_views.parts.dropdownlist.render(field, Msg.get(customAttributeDefinition.name),
customAttributeDefinition.getValueHoldersCollectionFromNameForDynamicSingleItemCustomAttribute(i18nMessagesPlugin, "%", uid), description,
true, customAttributeDefinition.isRequired(), false, false);
}
return views.html.framework_views.parts.autocomplete.render(field, Msg.get(customAttributeDefinition.name), description,
implementationDefinedObjectService.getRouteForDynamicSingleCustomAttributeApi().url(),
customAttributeDefinition.getContextParametersForDynamicApi());
}
示例4: showUploadMemberResult
import play.twirl.api.Html; //导入依赖的package包/类
private Result showUploadMemberResult(List<UploadResult> failedUploads, Forum forum) {
HtmlTemplate htmlTemplate = getBaseHtmlTemplate(forum);
Html content;
if (failedUploads.size() > 0) {
content = uploadResultView.render(failedUploads);
} else {
content = messageView.render(Messages.get("forum.member.upload.text.success"));
}
htmlTemplate.setContent(content);
htmlTemplate.setMainTitle(Messages.get("forum.member.upload.text.result"));
htmlTemplate.markBreadcrumbLocation(Messages.get("forum.text.members"), routes.ForumMemberController.viewMembers(forum.getId()));
return renderTemplate(htmlTemplate);
}
示例5: viewPostVersions
import play.twirl.api.Html; //导入依赖的package包/类
@Authenticated(value = GuestView.class)
@Transactional
public Result viewPostVersions(long threadPostId) throws ThreadPostNotFoundException {
ThreadPost threadPost = threadPostService.findThreadPostById(threadPostId);
Forum forum = threadPost.getThread().getParentForum();
if (!forum.containModule(ForumModules.THREAD)) {
return redirect(org.iatoki.judgels.raguel.forum.routes.ForumController.viewForums(forum.getId()));
}
if (!isCurrentUserAllowedToEnterForum(forum)) {
return redirect(org.iatoki.judgels.raguel.forum.routes.ForumController.viewForums(forum.getId()));
}
HtmlTemplate htmlTemplate = getBaseHtmlTemplate(forum);
Html content = listPostContentsView.render(threadPost);
htmlTemplate.setContent(content);
htmlTemplate.setMainTitle(Messages.get("forum.thread.post.text.versions"));
htmlTemplate.setMainBackButton(Messages.get("commons.button.backTo1", threadPost.getThread().getName()), routes.ThreadPostController.viewThreadPosts(threadPost.getThread().getId()));
htmlTemplate.markBreadcrumbLocation(threadPost.getThread().getName(), routes.ThreadPostController.viewThreadPosts(threadPost.getThread().getId()));
return renderTemplate(htmlTemplate);
}
示例6: renderTemplate
import play.twirl.api.Html; //导入依赖的package包/类
@Test
public void renderTemplate() throws InstantiationException, IllegalAccessException {
Request requestMock = mock(Request.class);
Context.current.set(new Context(1l, mock(RequestHeader.class), requestMock, //
Collections.<String, String>emptyMap(), // sessionData
Collections.<String, String>emptyMap(), // flashData
Collections.<String, Object>emptyMap()));
when(requestMock.username()).thenReturn("nom_de_test");
Html html = views.html.index.render("Your new application is ready.");
assertThat(contentType(html)).isEqualTo("text/html");
assertThat(contentAsString(html)).contains("Your new application is ready.");
assertThat(contentAsString(html)).contains("Bonjour nom_de_test!");
}
示例7: getNotifications
import play.twirl.api.Html; //导入依赖的package包/类
/**
* Returns all notifications for current user.
*
* @return Html rendered instance
*/
@Transactional(readOnly = true)
public static Html getNotifications() {
Account account = Component.currentAccount();
if (account == null) {
return new Html("Das wird nichts");
}
List<Notification> list = null;
try {
list = NotificationManager.findByAccountIdUnread(account.id);
} catch (Throwable throwable) { throwable.printStackTrace(); }
List<Integer> countedNotifications = NotificationController.countNotifications(list);
return views.html.Notification.menuitem.render(list, countedNotifications.get(0),
NotificationManager.countUnreadNotificationsForAccountId(account.id)
);
}
示例8: refuelsForTrip
import play.twirl.api.Html; //导入依赖的package包/类
/**
* Produces the correct html file for the given 'flow'
*/
static Html refuelsForTrip(TripAndCar trip, Form<RefuelData> form, Iterable<Refuel> refuels, boolean ownerFlow) {
// must be used in injected context
if (ownerFlow) {
DataAccessContext context = DataAccess.getInjectedContext();
ReservationDAO dao = context.getReservationDAO();
return refuelsForTripOwner.render(
form,
addImageTypes(context.getFileDAO(), refuels),
trip,
dao.getNextTripId(trip.getId()),
dao.getPreviousTripId(trip.getId())
);
} else {
return refuelsForTripDriver.render(form, refuels, trip);
}
}
示例9: showProject
import play.twirl.api.Html; //导入依赖的package包/类
public static Result showProject(String projectName) {
final Project project = ProjectDao.open(projectName);
if (project == null) {
return notFound(String.format("Project %s does not exist.", projectName));
}
String pageTitle = "pgMatching";
Html topBar = project_main_topbar.render(projectName);
Html topNav = common_topnav.render(project);
Html content = project_main.render(project, statusMessage);
List<Call> dynamicJs = new ArrayList<Call>();
dynamicJs.add(controllers.project.routes.ProjectController.javascriptRoutes());
dynamicJs.add(controllers.routes.Assets.at("javascripts/project/project.js"));
List<Call> dynamicCss = new ArrayList<Call>();
dynamicCss.add(controllers.routes.Assets.at("stylesheets/project/project.css"));
Html page = common_main.render(
pageTitle, topBar, topNav, content, dynamicCss, dynamicJs);
return ok(page);
}
示例10: step2
import play.twirl.api.Html; //导入依赖的package包/类
public Result step2(String next, String linkId) {
ProviderLink link = providerLinkRepository.findById(linkId);
if(link != null && link.getUserId() == null){
String remoteUserEmail = link.getRemoteUserEmail();
if(remoteUserEmail != null && userRepository.findByEmail(remoteUserEmail) != null){
flash("warning", "The email "+ remoteUserEmail +" is already registered with us and it is probably yours. To use "+link.getProviderKey()+" login feature with this account, please first login then use the connection on your profile.");
return redirect(routes.LoginController.get(next));
}
int state = remoteUserEmail != null ? 3 : 2;
return ok(template.render(state, authorizationServerManager.getProvider(link.getProviderKey()).getDisplayName(), remoteUserEmail, linkId, formFactory.form(RegistrationDto.class), next, Html.apply(config.getString("tos.text"))));
} else {
flash("error", "Invalid authentication, please try again");
return redirect(routes.RegisterController.step1(next));
}
}
示例11: formWithMessage
import play.twirl.api.Html; //导入依赖的package包/类
private Html formWithMessage(@Nullable final String message) {
return new Html(
"<html>"
+ " <head><title>" + pageTitle + "</title></head>"
+ " <body>"
+ " <p>Type your name</p>"
+ " <p class=\"message\">" + Optional.ofNullable(message).orElse("") + "</p>"
+ " <form action=\"" + exercises.playbasics.routes.MyController.process5().url() + "\" method=\"post\">"
+ " <input name=\"name\" type=\"text\" />"
+ " <button type=\"submit\">Submit</button>"
+ " </form>"
+ " </body>"
+ "</html>");
}
示例12: renderFormField
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderFormField(II18nMessagesPlugin i18nMessagesPlugin, IUserSessionManagerPlugin userSessionManagerPlugin,
IImplementationDefinedObjectService implementationDefinedObjectService, Field field, boolean displayDescription) {
String description = "";
if (displayDescription) {
description = customAttributeDefinition.description;
}
return views.html.framework_views.parts.fileupload_field.render(field, customAttributeDefinition.name, description, null, null);
}
示例13: renderDisplay
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderDisplay(II18nMessagesPlugin i18nMessagesPlugin) {
if (value.equals("#attachment")) {
return views.html.framework_views.parts.formats.display_image_from_file_attachment.render(ImageCustomAttributeValue.class, this.id);
} else {
return views.html.framework_views.parts.formats.display_image.render(value);
}
}
示例14: renderDisplay
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderDisplay(II18nMessagesPlugin i18nMessagesPlugin) {
DefaultSelectableValueHolder<Long> valueHolder = null;
if (value != null) {
valueHolder = new DefaultSelectableValueHolder<Long>(value, customAttributeDefinition.getNameFromValue(i18nMessagesPlugin, value));
}
return views.html.framework_views.parts.formats.display_value_holder.render(valueHolder, true);
}
示例15: renderFormField
import play.twirl.api.Html; //导入依赖的package包/类
@Override
public Html renderFormField(II18nMessagesPlugin i18nMessagesPlugin, IUserSessionManagerPlugin userSessionManagerPlugin,
IImplementationDefinedObjectService implementationDefinedObjectService, Field field, boolean displayDescription) {
String description = "";
if (displayDescription) {
description = customAttributeDefinition.description;
}
return views.html.framework_views.parts.url_input.render(field, customAttributeDefinition.name, description, customAttributeDefinition.isRequired(),
displayDescription);
}