本文整理汇总了Java中org.rendersnake.HtmlCanvas.form方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlCanvas.form方法的具体用法?Java HtmlCanvas.form怎么用?Java HtmlCanvas.form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rendersnake.HtmlCanvas
的用法示例。
在下文中一共展示了HtmlCanvas.form方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
@Override
public HtmlCanvas getForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("NewWaitTrigger").class_(""));
html.form(id("newTriggersForm"));
html.input(id("type").name("type").class_("form-control m-t")
.hidden("true").value("Wait"));
html.input(class_("inputBox temperature form-control m-t")
.type("number").add("step", "any")
.add("placeholder", Messages.MINUTES)
.name(WAITTIMEMINS).value(""));
html.input(class_("inputBox temperature form-control m-t")
.type("number").add("step", "any")
.add("placeholder", Messages.SECS)
.name(WAITTIMESECS).value(""));
html.input(class_("inputBox form-control m-t")
.name(NOTES).value("")
.add("placeholder", Messages.NOTES)
.value(this.note));
html.button(name("submitWait")
.class_("btn btn-primary col-md-12")
.add("data-toggle", "clickover")
.onClick("submitNewTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例2: getEditForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
@Override
public HtmlCanvas getEditForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("EditWaitTrigger").class_(""));
html.form(id("editTriggersForm"));
html.input(id("type").name("type")
.hidden("true").value("Wait"));
html.input(id("type").name("position")
.hidden("position").value("" + this.position));
html.input(class_("inputBox temperature form-control")
.type("number").add("step", "any")
.add("placeholder", Messages.MINUTES)
.name(WAITTIMEMINS)
.value(Double.toString(this.minutes)));
html.input(class_("inputBox temperature form-control")
.type("number").add("step", "any")
.add("placeholder", Messages.SECS)
.name(WAITTIMESECS)
.value(Double.toString(this.seconds)));
html.input(class_("inputBox form-control")
.name(NOTES).value("")
.add("placeholder", Messages.NOTES)
.value(this.note));
html.button(name("submitWait")
.class_("btn col-md-12")
.add("data-toggle", "clickover")
.onClick("updateTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例3: logLevels
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
@GET
@Path("/logLevels/{instanceKey}")
public Response logLevels(@PathParam("instanceKey") @DefaultValue("") String instanceKey) {
try {
HtmlCanvas canvas = new HtmlCanvas();
canvas.form(HtmlAttributesFactory
.action("/ui/deployable/setLogLevel/" + instanceKey)
.method("post")
.id("setLogLevel-form"));
canvas.fieldset();
org.apache.logging.log4j.Logger rl = LogManager.getRootLogger();
if (rl instanceof Logger) {
LoggerContext rlContext = ((Logger) rl).getContext();
Collection<Logger> loggers = rlContext.getLoggers();
canvas.select(HtmlAttributesFactory.name("logger"));
for (Logger logger : loggers) {
try {
Class.forName(logger.getName());
String level = (logger.getLevel() == null) ? null : logger.getLevel().toString();
canvas.option(HtmlAttributesFactory.value(logger.getName())).content(level + "=" + logger.getName());
} catch (ClassNotFoundException e) {
LOG.warn("Failed to find class:{}", e.getLocalizedMessage());
}
}
canvas._select();
} else {
canvas.h1().content("Loggers unavailable, RootLogger is: " + rl.getClass().getName() + " expected: " + Logger.class.getName());
}
canvas.select(HtmlAttributesFactory.name("level"));
canvas.option(HtmlAttributesFactory.value("")).content("Inherit");
canvas.option(HtmlAttributesFactory.value("TRACE")).content("TRACE");
canvas.option(HtmlAttributesFactory.value("DEBUG")).content("DEBUG");
canvas.option(HtmlAttributesFactory.value("INFO")).content("INFO");
canvas.option(HtmlAttributesFactory.value("WARN")).content("WARN");
canvas.option(HtmlAttributesFactory.value("ERROR")).content("ERROR");
canvas.option(HtmlAttributesFactory.value("OFF")).content("OFF");
canvas._select();
canvas.input(HtmlAttributesFactory.type("submit").value("Change"))
._fieldset()
._form();
return Response.ok(canvas.toHtml(), MediaType.TEXT_HTML).build();
} catch (Exception x) {
LOG.warn("Failed to set logging level.", x);
return ResponseHelper.INSTANCE.errorResponse("Failed to set logging level.", x);
}
}
示例4: getForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* Get the Form HTML Canvas representing a temperature trigger.
* @return {@link org.rendersnake.HtmlCanvas} representing the input form.
* @throws IOException when the HTMLCanvas could not be created.
*/
@Override
public final HtmlCanvas getForm() throws IOException {
HtmlCanvas html = new HtmlCanvas(new PrettyWriter());
html.div(id("NewTempTrigger").class_(""));
html.form(id("newTriggersForm"));
html.input(id("type").name("type").class_("form-control m-t")
.hidden("true").value("Temperature"));
html.input(id("type").name("position").class_("form-control m-t")
.hidden("position").value("" + this.position));
html.input(class_("inputBox temperature form-control m-t")
.type("number").add("step", "any")
.add("placeholder", Messages.SET_POINT)
.name("targetTemperature").value(""));
html.input(class_("inputBox temperature form-control m-t")
.type("number").add("step", "any")
.add("placeholder", Messages.END_TEMP)
.name("exitTemperature").value(""));
html.input(class_("inputBox form-control m-t")
.name("method").value("")
.add("placeholder", Messages.METHOD));
html.input(class_("inputBox form-control m-t")
.name("stepType").value("")
.add("placeholder", Messages.TYPE));
// Add the on/off values
html.select(class_("form-control m-t").name("mode")
.id("mode"));
html.option(value(""))
.write("")
._option();
html.option(value(TemperatureTrigger.INCREASE))
.write(TemperatureTrigger.INCREASE)
._option();
html.option(value(TemperatureTrigger.DECREASE))
.write(TemperatureTrigger.DECREASE)
._option();
html._select();
html.button(name("submitTemperature")
.class_("btn btn-primary m-t col-md-12")
.add("data-toggle", "clickover")
.onClick("submitNewTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例5: getEditForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* Get the Form HTML Canvas representing a temperature trigger.
* @return {@link org.rendersnake.HtmlCanvas} representing the input form.
* @throws IOException when the HTMLCanvas could not be created.
*/
@Override
public final HtmlCanvas getEditForm() throws IOException {
HtmlCanvas html = new HtmlCanvas(new PrettyWriter());
html.div(id("EditTempTrigger").class_(""));
html.form(id("editTriggersForm"));
html.input(id("type").name("type")
.hidden("true").value("Temperature"));
html.input(id("type").name("position")
.hidden("position").value("" + this.position));
html.input(class_("inputBox temperature form-control")
.type("number").add("step", "any")
.add("placeholder", Messages.SET_POINT)
.value(this.targetTemp.toPlainString())
.name("targetTemperature"));
html.input(class_("inputBox temperature form-control")
.type("number").add("step", "any")
.add("placeholder", Messages.END_TEMP)
.value(this.targetTemp.toPlainString())
.name("exitTemperature"));
html.input(class_("inputBox form-control")
.name("method").value("")
.value(this.method)
.add("placeholder", Messages.METHOD));
html.input(class_("inputBox form-control")
.name("stepType").value("")
.value(this.type)
.add("placeholder", Messages.TYPE));
// Add the on/off values
html.select(class_("holo-spinner").name("mode")
.id("mode"));
html.option(value(""))
.write("")
._option();
html.option(value(TemperatureTrigger.INCREASE)
.selected_if(
this.mode.equals(TemperatureTrigger.INCREASE)))
.write(TemperatureTrigger.INCREASE)
._option();
html.option(value(TemperatureTrigger.DECREASE)
.selected_if(
this.mode.equals(TemperatureTrigger.DECREASE)))
.write(TemperatureTrigger.DECREASE)
._option();
html._select();
html.button(name("submitTemperature")
.class_("btn col-md-12")
.add("data-toggle", "clickover")
.onClick("updateTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例6: getForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* @return The HTML elements for this form.
* @throws IOException if the form could not be created.
*/
@Override
public final HtmlCanvas getForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("NewSwitchTrigger").class_(""));
html.form(id("newTriggersForm"));
html.input(id("type").name("type")
.hidden("true").value("Switch"));
// Add the Switches as a drop down list.
html.select(class_("holo-spinner").name("switchname")
.id("switchName"));
html.option(value(""))
.write(Messages.SWITCHES)
._option();
for (Switch tSwitch : LaunchControl.switchList) {
String tName = tSwitch.getName();
html.option(value(tName))
.write(tName)
._option();
}
html._select();
// Add the on/off values
html.select(class_("holo-spinner").name("activate")
.id("activate"));
html.option(value(""))
.write("")
._option();
html.option(value("on"))
.write(Messages.SWITCH_ON)
._option();
html.option(value("off"))
.write(Messages.SWITCH_OFF)
._option();
html._select();
html.button(name("submitSwitchTrigger")
.class_("btn col-md-12")
.add("data-toggle", "clickover")
.onClick("submitNewTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例7: getEditForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* @return The HTML elements for this form.
* @throws IOException if the form could not be created.
*/
@Override
public final HtmlCanvas getEditForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("EditSwitchTrigger").class_(""));
html.form(id("editTriggersForm"));
html.input(id("type").name("type").class_("form-control m-t")
.hidden("true").value("switch"));
html.input(id("type").name("position").class_("form-control m-t")
.hidden("position").value("" + this.position));
// Add the Switches as a drop down list.
html.select(class_("form-control m-t").name(SWITCHNAME)
.id("switchName"));
html.option(value(""))
.write(Messages.SWITCHES)
._option();
for (Switch tSwitch : LaunchControl.switchList) {
String tName = tSwitch.getName();
html.option(value(tName)
.selected_if(this.switchName.equals(tName)))
.write(tName)
._option();
}
html._select();
// Add the on/off values
html.select(class_("form-control m-t").name("activate")
.id("activate"));
html.option(value(""))
.write("")
._option();
html.option(value(Messages.SWITCH_ON)
.selected_if(this.activate.equals("on")))
.write("On")
._option();
html.option(value(Messages.SWITCH_OFF)
.selected_if(this.activate.equals("off")))
.write("Off")
._option();
html._select();
html.button(name("submitSwitchTrigger")
.class_("btn btn-primary col-md-12")
.add("data-toggle", "clickover")
.onClick("updateTriggerStep(this);"))
.write(Messages.EDIT)
._button();
html._form();
html._div();
return html;
}
示例8: getForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* @return The HTML elements for this form.
* @throws IOException if the form could not be created.
*/
@Override
public final HtmlCanvas getForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("NewTriggerTrigger").class_(""));
html.form(id("newTriggersForm"));
html.input(id("type").name("type").class_("form-control m-t")
.hidden("true").value("Profile"));
// Add the probe as a drop down list.
html.select(class_("form-control m-t").name(TARGET_NAME)
.id(TARGET_NAME));
html.option(value(""))
.write("Target Probe")
._option();
for (Temp tTemp: LaunchControl.tempList) {
String tName = tTemp.getName();
html.option(value(tName))
.write(tName)
._option();
}
html._select();
// Add the on/off values
html.select(class_("form-control m-t").name(ACTIVATE)
.id(ACTIVATE));
html.option(value(""))
.write("")
._option();
html.option(value(ACTIVATE))
.write(Messages.ACTIVATE)
._option();
html.option(value(DISABLE))
.write(Messages.DISABLE)
._option();
html._select();
html.button(name("submitTriggerTrigger")
.class_("btn btn-primary col-md-12")
.add("data-toggle", "clickover")
.onClick("submitNewTriggerStep(this);"))
.write(Messages.ADD_TRIGGER)
._button();
html._form();
html._div();
return html;
}
示例9: getEditForm
import org.rendersnake.HtmlCanvas; //导入方法依赖的package包/类
/**
* @return The HTML elements for this form.
* @throws IOException if the form could not be created.
*/
@Override
public final HtmlCanvas getEditForm() throws IOException {
HtmlCanvas html = new HtmlCanvas();
html.div(id("NewTriggerTrigger").class_(""));
html.form(id("newTriggersForm"));
html.input(id(TYPE).name(TYPE)
.hidden("true").value("Profile"));
html.input(id("type").name(POSITION)
.hidden(POSITION).value(this.position));
// Add the triggers as a drop down list.
html.select(class_("holo-spinner").name(TARGET_NAME)
.id(TARGET_NAME));
html.option(value(""))
.write("Target Probe")
._option();
for (Temp tTemp: LaunchControl.tempList) {
String tName = tTemp.getName();
html.option(value(tName))
.write(tName)
._option();
}
html._select();
// Add the on/off values
html.select(class_("holo-spinner").name(ACTIVATE)
.id(ACTIVATE));
html.option(value(""))
.write("")
._option();
html.option(value(ACTIVATE)
.selected_if(this.activate))
.write(Messages.ACTIVATE)
._option();
html.option(value(DISABLE)
.selected_if(!this.activate))
.write(Messages.DISABLE)
._option();
html._select();
html.button(name("submitTempTrigger")
.class_("btn col-md-12")
.add("data-toggle", "clickover")
.onClick("updateTriggerStep(this);"))
.write(Messages.EDIT)
._button();
html._form();
html._div();
return html;
}