本文整理汇总了Java中org.apache.ecs.html.Input.setType方法的典型用法代码示例。如果您正苦于以下问题:Java Input.setType方法的具体用法?Java Input.setType怎么用?Java Input.setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ecs.html.Input
的用法示例。
在下文中一共展示了Input.setType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSimpleProperty
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createSimpleProperty(SimplePropertyElement<?> e) {
// <input type="text" wicket:id="vertrag.Vertragsnummer" />
final String inputType;
if (e.isNumberType()) {
inputType = "text";
} else if (e.isFileType()) {
if (e.isReadonlyFileType())
inputType = Input.button; // Download link
else
inputType = Input.file;
} else {
inputType = Input.text;
}
Input input = new Input();
input.addAttribute(ATTR_WICKET_ID, e.getWicketId());
input.setID(e.getWicketId());
input.setType(inputType);
return wrapInputComponent(e, input);
}
示例2: makeUsername
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
protected Element makeUsername(WebSession s)
{
ElementContainer ec = new ElementContainer();
StringBuffer script = new StringBuffer();
script.append("<STYLE TYPE=\"text/css\"> ");
script.append(".blocklabel { margin-top: 8pt; }");
script.append(".myClass { color:red;");
script.append(" font-weight: bold;");
script.append("padding-left: 1px;");
script.append("padding-right: 1px;");
script.append("background: #DDDDDD;");
script.append("border: thin black solid; }");
script.append("LI { margin-top: 10pt; }");
script.append("</STYLE>");
ec.addElement(new StringElement(script.toString()));
ec.addElement(new StringElement("User ID: "));
Input username = new Input(Input.TEXT, "username", "");
ec.addElement(username);
String userInput = s.getParser().getRawParameter("username", "");
ec.addElement(new BR());
ec.addElement(new BR());
String formattedInput = "<span class='myClass'>" + userInput + "</span>";
ec.addElement(new Div(SELECT_ST + formattedInput));
Input b = new Input();
b.setName("Submit");
b.setType(Input.SUBMIT);
b.setValue("Submit");
ec.addElement(new PRE(b));
return ec;
}
示例3: createFileInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createFileInput(final UploadButtonModelElement e) {
final Input input = new Input();
input.addAttribute(IHtmlElement.ATTR_WICKET_ID, e.getWicketId());
input.setType(UploadButtonHtmlElement.INPUT_TYPE_FILE);
if (e.getBeanPathElement().getAccessor().getRawType().isIterable()
|| e.getBeanPathElement().getAccessor().getRawType().isArray()) {
input.addAttribute("multiple", "multiple");
}
//file input is actually a button not a form-control
return wrapButtonInputInFormGroup(e, input);
}
示例4: createCheckboxProperty
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createCheckboxProperty(CheckboxPropertyElement<?> e) {
// <input type="checkbox" wicket:id="vertrag.Vertragsnummer" />
Input input = new Input();
input.addAttribute(ATTR_WICKET_ID, e.getWicketId());
input.setID(e.getWicketId());
input.setType(Input.checkbox);
return wrapCheckboxComponent(e, input);
}
示例5: createContent
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
protected Element createContent(WebSession s)
{
ElementContainer ec = new ElementContainer();
if (s.getRequest().getMethod().equalsIgnoreCase("POST"))
{
makeSuccess(s);
}
String lineSep = System.getProperty("line.separator");
String script = "<script>" + lineSep + "function validate() {" + lineSep
+ "var keyField = document.getElementById('key');" + lineSep + "var url = '" + getLink()
+ "&from=ajax&key=' + encodeURIComponent(keyField.value);" + lineSep
+ "if (typeof XMLHttpRequest != 'undefined') {" + lineSep + "req = new XMLHttpRequest();" + lineSep
+ "} else if (window.ActiveXObject) {" + lineSep + "req = new ActiveXObject('Microsoft.XMLHTTP');"
+ lineSep + " }" + lineSep + " req.open('GET', url, true);" + lineSep
+ " req.onreadystatechange = callback;" + lineSep + " req.send(null);" + lineSep + "}" + lineSep
+ "function callback() {" + lineSep + " if (req.readyState == 4) { " + lineSep
+ " if (req.status == 200) { " + lineSep + " var message = req.responseText;" + lineSep
+ " var messageDiv = document.getElementById('MessageDiv');" + lineSep + " try {" + lineSep
+ " eval(message);" + lineSep + " " + lineSep
+ " messageDiv.innerHTML = 'Correct licence Key.' " + lineSep + " }" + lineSep
+ " catch(err)" + lineSep + " { " + lineSep + " messageDiv.innerHTML = 'Wrong license key.'"
+ lineSep + "} " + lineSep + " }}}" + lineSep + "</script>" + lineSep;
ec.addElement(new StringElement(script));
ec.addElement(new BR().addElement(new H1().addElement("Welcome to WebGoat Registration Page:")));
ec.addElement(new BR()
.addElement("Please enter the license key that was emailed to you to start using the application."));
ec.addElement(new BR());
ec.addElement(new BR());
Table t1 = new Table().setCellSpacing(0).setCellPadding(0).setBorder(0).setWidth("70%").setAlign("center");
TR tr = new TR();
tr.addElement(new TD(new StringElement("License Key: ")));
Input input1 = new Input(Input.TEXT, KEY, "");
input1.setID(KEY);
input1.addAttribute("onkeyup", "validate();");
tr.addElement(new TD(input1));
t1.addElement(tr);
tr = new TR();
tr.addElement(new TD(" ").setColSpan(2));
t1.addElement(tr);
tr = new TR();
Input b = new Input();
b.setType(Input.SUBMIT);
b.setValue("Activate!");
b.setName("SUBMIT");
b.setID("SUBMIT");
b.setDisabled(true);
tr.addElement(new TD(" "));
tr.addElement(new TD(b));
t1.addElement(tr);
ec.addElement(t1);
Div div = new Div();
div.addAttribute("name", "MessageDiv");
div.addAttribute("id", "MessageDiv");
ec.addElement(div);
return ec;
}
示例6: makeField
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param labeltext
* Description of the Parameter
* @param name
* Description of the Parameter
* @param value
* Description of the Parameter
* @param size
* Description of the Parameter
* @return Description of the Return Value
*/
public static TR makeField(String labeltext, String name, String value, int size)
{
Input field = new Input().setName(name).setValue(value).setSize(size).setMaxlength(size);
// double check in case someone means to make a * starred out password field
if (name.equals(PASSWORD))
{
field.setType(Input.PASSWORD);
}
return (makeField(labeltext, value, field));
}
示例7: createTextInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createTextInput(final TextInputModelElement e) {
final Input input = new Input();
input.addAttribute(IHtmlElement.ATTR_WICKET_ID, e.getWicketId());
input.setType(TextInputHtmlElement.INPUT_TYPE_TEXT);
return wrapFormControlInputInFormGroup(e, input);
}
示例8: createDateInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createDateInput(final DateInputModelElement e) {
final Input input = new Input();
input.addAttribute(IHtmlElement.ATTR_WICKET_ID, e.getWicketId());
input.setType(DateInputHtmlElement.INPUT_TYPE_DATE);
return wrapFormControlInputInFormGroup(e, input);
}
示例9: createNumberInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createNumberInput(final NumberInputModelElement e) {
final Input input = new Input();
input.addAttribute(IHtmlElement.ATTR_WICKET_ID, e.getWicketId());
input.setType(NumberInputHtmlElement.INPUT_TYPE_NUMBER);
return wrapFormControlInputInFormGroup(e, input);
}
示例10: createCheckBoxInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
public Element createCheckBoxInput(final CheckBoxInputModelElement e) {
final Input input = new Input();
input.addAttribute(IHtmlElement.ATTR_WICKET_ID, e.getWicketId());
input.setType(CheckBoxInputHtmlElement.INPUT_TYPE_CHECKBOX);
return wrapCheckBoxInFormGroup(e, input);
}
示例11: makeButton
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param text
* Description of the Parameter
* @return Description of the Return Value
*/
public static Element makeButton(String text)
{
Input b = new Input();
b.setType(Input.SUBMIT);
b.setValue(text);
b.setName(Input.SUBMIT);
return (b);
}
示例12: makeOnClickInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param text
* Description of the Parameter
* @param clickAction
* Description of the Parameter
* @param type
* Description of the Parameter
* @return Description of the Return Value
*/
public static Input makeOnClickInput(String text, String clickAction, String type)
{
Input b = new Input();
b.setType(type);
b.setValue(text);
b.setOnClick(clickAction);
return (b);
}