本文整理汇总了Java中org.rendersnake.HtmlCanvas._tr方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlCanvas._tr方法的具体用法?Java HtmlCanvas._tr怎么用?Java HtmlCanvas._tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rendersnake.HtmlCanvas
的用法示例。
在下文中一共展示了HtmlCanvas._tr方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderTypes
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
private void renderTypes(ClassDoc[] classDocs, String title, PackagePage page, HtmlCanvas html) throws IOException {
if (classDocs.length > 0) {
Arrays.sort(classDocs);
html.h2().content(title);
html.table().tbody();
int lineCnt = 0;
for (ClassDoc classDoc : classDocs) {
if ((lineCnt++) % 2 == 0) {
html.tr(class_("alt-color"));
} else {
html.tr();
}
html.td().render(new ClassNameRenderable(generator, classDoc, ClassNameRenderable.LINK))._td();
html.td().render(new InlineTagsRenderer(generator, classDoc.firstSentenceTags(),
classDoc.position()))._td();
html._tr();
}
html._tbody()._table();
}
}
示例2: addTable
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* Add the table to the HTML canvas ready for rendering
*
* @param html html canvas
* @param tableRows table rows, these should all be the same lenght
* @param headers table headers
* @param title itle of the table
* @throws IOException if IO error occurs
*/
public void addTable(HtmlCanvas html, List<TableRow> tableRows, List<String> headers, String title)
throws IOException {
html.h2().content(title);
html.table();
html.tr();
for (String header : headers) {
html.th().content(header);
}
html._tr();
int i = 0;
for (TableRow row : tableRows) {
String clazz = (i % 2 == 0) ? "even" : "odd";
html.tr(class_(clazz));
for (String column : row.getCells()) {
html.td().content(column);
}
html._tr();
i++;
}
html._table();
}
示例3: createHTML
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* 生成表格
*/
public static String createHTML(List header, List data) throws IOException {
HtmlCanvas html = new HtmlCanvas();
html = html.html().body().table().tr();
// /写表格标题行
Iterator it = header.iterator();
while (it.hasNext()) {
Map head = (Map)it.next();
html =html.th().content(String.valueOf(head.get("title"))) ;
}
html =html._tr();
// //写表格数据
it = data.iterator();
while (it.hasNext()) {
List item = (List)(it.next());
html =html.tr();
Iterator sub = item.iterator();
while (sub.hasNext()) {
html =html.td().content(String.valueOf(sub.next())) ;
}
html =html._tr();
}
// close the table
html =html._table()._body()._html();
// get the html String
final String rendered = html.toHtml();
return rendered;
}
示例4: renderFermentation
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
public HtmlCanvas renderFermentation(HtmlCanvas html) throws IOException
{
if (currentRecipe.getFermentStepSize() > 0) {
html.div(id("recipeFermProfile"));
html.div(class_("lead")).write(Messages.FERMENT_PROFILE);
html._div();
html.table(id("fermentTable").class_("table table-striped table-bordered"));
html.tr();
html.th().write(Messages.NAME)._th();
html.th().write(Messages.TEMP)._th();
html.th().write(Messages.TIME)._th();
html._tr();
for (int i = 0; i < currentRecipe.getFermentStepSize(); i++) {
html.tr(id("fermStep-" + i));
html.td(id("ferm-Name")).write(currentRecipe.getFermentStepType(i))._td();
html.td(id("ferm-Temp")).write(String.format("%.2f", currentRecipe.getFermentStepTemp(i)) + currentRecipe.getFermentStepTempU(i))._td();
html.td(id("ferm-Time")).write(currentRecipe.getFermentStepTime(i) + " days")._td();
html._tr();
}
html._table();
html.select(name("tempprobe").class_("form-control"));
html.option(value("").selected_if(true))
.write("Select Probe")
._option();
for (PID entry: LaunchControl.pidList) {
html.option(value(entry.getName()))
.write(entry.getName())
._option();
}
html._select();
html.button(id("setFermProfile").class_("btn btn-default").onClick("setFermProfile(this)"))
.write(Messages.SET_FERM_PROFILE)._button();
html._div();
}
return html;
}
示例5: metricsUI
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
@GET
@Path("/metrics/ui")
public Response metricsUI() {
try {
final HtmlCanvas canvas = new HtmlCanvas();
canvas.h1().content("Counters: ");
HtmlAttributes tableAttributes = HtmlAttributesFactory
.class_("table")
.class_("table-striped")
.class_("table-bordered")
.class_("table-hover")
.class_("table-condensed");
canvas.table(tableAttributes);
canvas.tr();
canvas.td().content("Count");
canvas.td().content("Name");
canvas._tr();
MetricsHelper.INSTANCE.getCounters("").getAll((v) -> {
if (v != null) {
canvas.tr();
canvas.td().content(String.valueOf(v.getValue()));
canvas.td().content(v.getKey());
canvas._tr();
}
});
canvas._table();
canvas.hr();
canvas.h1().content("Timers: ");
tableAttributes = HtmlAttributesFactory
.class_("table")
.class_("table-striped")
.class_("table-bordered")
.class_("table-hover")
.class_("table-condensed");
canvas.table(tableAttributes);
canvas.tr();
canvas.td().content("Timer");
canvas.td().content("Name");
canvas._tr();
MetricsHelper.INSTANCE.getTimers("").getAll((v) -> {
if (v != null) {
canvas.tr();
canvas.td().content(String.valueOf(v.getValue()));
canvas.td().content(v.getKey());
canvas._tr();
}
});
canvas._table();
return Response.ok(canvas.toHtml(), MediaType.TEXT_HTML).build();
} catch (Exception x) {
LOG.warn("Failed build UI html.", x);
return ResponseHelper.INSTANCE.errorResponse("Failed build UI html.", x);
}
}
示例6: healthUI
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
@GET
@Path("/health/ui")
public Response healthUI() {
try {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
HtmlCanvas canvas = new HtmlCanvas();
List<HealthCheckResponse> checkHealth = healthCheckService.checkHealth();
//table table-striped table-bordered table-hover table-condensed
HtmlAttributes tableAttributes = HtmlAttributesFactory
.class_("table")
.class_("table-striped")
.class_("table-bordered")
.class_("table-hover")
.class_("table-condensed");
canvas.table(tableAttributes);
canvas.th();
canvas.tr();
canvas.td().content(String.valueOf("Health"));
canvas.td().content(String.valueOf("Name"));
canvas.td().content(String.valueOf("Status"));
canvas.td().content(String.valueOf("Description"));
canvas.td().content(String.valueOf("Resolution"));
canvas.td().content(String.valueOf("Age"));
canvas._tr();
canvas._th();
canvas.tbody();
long now = System.currentTimeMillis();
for (HealthCheckResponse response : checkHealth) {
if (-Double.MAX_VALUE != response.getHealth()) {
canvas.tr();
canvas.td(HtmlAttributesFactory.style("background-color:#" + getHEXTrafficlightColor(response.getHealth()) + ";"))
.content(String.valueOf(numberFormat.format(response.getHealth())));
canvas.td().content(String.valueOf(response.getName()));
canvas.td().content(String.valueOf(response.getStatus()));
canvas.td().content(String.valueOf(response.getDescription()));
canvas.td().content(String.valueOf(response.getResolution()));
canvas.td().content(String.valueOf(shortHumanReadableUptime(now - response.getTimestamp())));
canvas._tr();
}
}
canvas._tbody();
canvas._table();
return Response.ok(canvas.toHtml(), MediaType.TEXT_HTML).build();
} catch (Exception x) {
LOG.warn("Failed build UI html.", x);
return ResponseHelper.INSTANCE.errorResponse("Failed build UI html.", x);
}
}
示例7: closeRow
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
public void closeRow(HtmlCanvas html) throws IOException {
html._tr();
}
示例8: renderDryHops
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
public HtmlCanvas renderDryHops(HtmlCanvas html) throws IOException
{
// Do we have hop additions?
if (currentRecipe.getHopsListSize() > 0) {
// Show them!
html.div(id("recipeDryHops"));
html.div(class_("lead")).write(Messages.DRY_ADDITIONS);
html._div();
html.table(id("hopTable").class_("table table-striped table-bordered"));
html.tr(id("hopTitle"));
html.th().write(Messages.HOP)._th();
html.th().write(Messages.AMOUNT)._th();
html.th().write(Messages.ALPHA)._th();
html.th().write(Messages.TIME)._th();
html._tr();
for(int i = 0; i < currentRecipe.getHopsListSize(); i++) {
Hop currentHop = currentRecipe.getHop(i);
if (!currentHop.getAdd().equals(Hop.DRY)) {
continue;
}
html.tr(id("hopDry-" + i));
html.td(id("hop-Name")).write(currentHop.getName())._td();
html.td(id("hop-Amount")).write(currentHop.getAmount().toString())._td();
html.td(id("hop-Alpha")).write(String.format("%.2f", currentHop.getAlpha()))._td();
html.td(id("hop-Time")).write(SBStringUtils.formatTime(currentHop.getMinutes()))._td();
html._tr();
}
html._table();
html.select(name("tempprobe").class_("form-control"));
html.option(value("").selected_if(true))
.write("Select Probe")
._option();
for (Temp entry: LaunchControl.tempList) {
html.option(value(entry.getName()))
.write(entry.getName())
._option();
}
html._select();
html.button(id("setDryHopProfile").class_("btn btn-default").onClick("setDryHopProfile(this)"))
.write(Messages.SET_DRY_HOP_PROFILE)._button();
html._div();
}
return html;
}
示例9: renderHops
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/****
* Render the hops values for a HTML form
* @param html
* @return
* @throws IOException
*/
public HtmlCanvas renderHops(HtmlCanvas html) throws IOException
{
// Do we have hop additions?
if (currentRecipe.getHopsListSize() > 0) {
// Show them!
html.div(id("recipeBoilHops"));
html.div(class_("lead")).write(Messages.BOIL_ADDITIONS);
html._div();
html.table(id("hopTable").class_("table table-striped table-bordered"));
html.tr(id("hopTitle"));
html.th().write(Messages.HOP)._th();
html.th().write(Messages.AMOUNT)._th();
html.th().write(Messages.IBU)._th();
html.th().write(Messages.ALPHA)._th();
html.th().write(Messages.TIME)._th();
html._tr();
for(int i = 0; i < currentRecipe.getHopsListSize(); i++) {
if (!currentRecipe.getHop(i).getAdd().equals(Hop.BOIL)) {
continue;
}
html.tr(id("hopAdd-" + i));
html.td(id("hop-Name")).write(currentRecipe.getHop(i).getName())._td();
html.td(id("hop-Amount")).write(currentRecipe.getHop(i).getAmount().toString())._td();
html.td(id("hop-IBU")).write(String.format("%.2f", currentRecipe.getHop(i).getIBU()))._td();
html.td(id("hop-Alpha")).write(String.format("%.2f", currentRecipe.getHop(i).getAlpha()))._td();
html.td(id("hop-Time")).write(SBStringUtils.formatTime(currentRecipe.getHop(i).getMinutes()))._td();
html._tr();
}
html._table();
html.select(name("tempprobe").class_("form-control"));
html.option(value("").selected_if(true))
.write("Select Probe")
._option();
for (Temp entry: LaunchControl.tempList) {
html.option(value(entry.getName()))
.write(entry.getName())
._option();
}
html._select();
html.button(id("setBoilHopProfile").class_("btn btn-default").onClick("setBoilHopProfile(this)"))
.write(Messages.SET_BOIL_HOP_PROFILE)._button();
html._div();
}
return html;
}
示例10: renderMash
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
public HtmlCanvas renderMash(HtmlCanvas html) throws IOException
{
// Do we have mash steps?
if (currentRecipe.getMash() != null && currentRecipe.getMash().getStepSize() > 0) {
// Show them!
Mash mash = currentRecipe.getMash();
html.div(id("recipeMash"));
html.div(class_("lead")).write(Messages.MASH_PROFILE);
html._div();
html.table(id("mashTable").class_("table table-striped table-bordered"));
html.tr();
html.td().write(Messages.METHOD)._td();
html.td().write(Messages.TYPE)._td();
html.td().write(Messages.START)._td();
html.td().write(Messages.END_TEMP)._td();
html.td().write(Messages.TIME)._td();
html._tr();
for(int i = 0; i < mash.getStepSize(); i++) {
html.tr(id("mashStep-" + i));
html.td(id("step-Method")).write(mash.getStepMethod(i))._td();
html.td(id("step-Type")).write(mash.getStepType(i))._td();
html.td(id("step-startTemp")).write(String.format("%.2f", mash.getStepStartTemp(i)) + mash.getStepTempU(i))._td();
html.td(id("step-endTemp")).write(String.format("%.2f", mash.getStepEndTemp(i)) + mash.getStepTempU(i))._td();
html.td(id("step-time")).write(SBStringUtils.formatTime(mash.getStepMin(i)))._td();
html._tr();
}
html._table();
html.select(name("tempprobe").class_("form-control"));
html.option(value("").selected_if(true))
.write("Select Probe")
._option();
for (PID entry: LaunchControl.pidList) {
html.option(value(entry.getName()))
.write(entry.getName())
._option();
}
html._select();
html.button(id("setMashProfile").class_("btn btn-default").onClick("setMashProfile(this)"))
.write(Messages.SET_MASH_PROFILE)._button();
html._div();
}
return html;
}