本文整理匯總了Java中com.webfirmframework.wffweb.tag.html.attribute.global.Id類的典型用法代碼示例。如果您正苦於以下問題:Java Id類的具體用法?Java Id怎麽用?Java Id使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Id類屬於com.webfirmframework.wffweb.tag.html.attribute.global包,在下文中一共展示了Id類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testFindOneTagAssignableToTagThrowsInvalidTagException
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test (expected = InvalidTagException.class)
public void testFindOneTagAssignableToTagThrowsInvalidTagException() {
Html html = new Html(null) {{
new Head(this) {{
new TitleTag(this){{
new NoTag(this, "some title");
}};
}};
new Body(this, new Id("one")) {{
new Div(this);
}};
}};
html.appendChild(new Div(null));
TagRepository.findOneTagAssignableToTag(NoTag.class, html);
}
示例2: testFindOneTagAssignableToTagThrowsInvalidTagException2
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test (expected = InvalidTagException.class)
public void testFindOneTagAssignableToTagThrowsInvalidTagException2() {
Html html = new Html(null) {{
new Head(this) {{
new TitleTag(this){{
new NoTag(this, "some title");
}};
}};
new Body(this, new Id("one")) {{
new Div(this);
}};
}};
html.appendChild(new Div(null));
TagRepository.findOneTagAssignableToTag(Blank.class, html);
}
示例3: testBlankAbstractHtmlCollectionOfAbstractHtml
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testBlankAbstractHtmlCollectionOfAbstractHtml() {
Div div = new Div(null, new Id("one")) {
{
List<Div> children = new LinkedList<Div>();
children.add(new Div(null, new Id("two")));
new Blank(this, children);
}
};
Assert.assertEquals("<div id=\"one\"><div id=\"two\"></div></div>",
div.toHtmlString());
// fail("Not yet implemented");
}
示例4: testAddChildAbstractHtml
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testAddChildAbstractHtml() {
Div div = new Div(null, new Id("one")) {
{
Blank blank = new Blank(this);
Div child = new Div(null, new Id("two")) {
{
new Div(this, new Id("three"));
}
};
blank.addChild(child);
}
};
Assert.assertEquals("<div id=\"one\"><div id=\"two\"><div id=\"three\"></div></div></div>",
div.toHtmlString());
// fail("Not yet implemented");
}
示例5: testNoTagAbstractHtmlCollectionOfAbstractHtml
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testNoTagAbstractHtmlCollectionOfAbstractHtml() {
Div div = new Div(null, new Id("one")) {
{
List<Div> children = new LinkedList<Div>();
children.add(new Div(null, new Id("two")));
new NoTag(this, children);
}
};
Assert.assertEquals("<div id=\"one\"><div id=\"two\"></div></div>",
div.toHtmlString());
// fail("Not yet implemented");
}
示例6: testAddChildAbstractHtml
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testAddChildAbstractHtml() {
Div div = new Div(null, new Id("one")) {
{
NoTag noTag = new NoTag(this);
Div child = new Div(null, new Id("two")) {
{
new Div(this, new Id("three"));
}
};
noTag.addChild(child);
}
};
Assert.assertEquals(
"<div id=\"one\"><div id=\"two\"><div id=\"three\"></div></div></div>",
div.toHtmlString());
// fail("Not yet implemented");
}
示例7: testGetIdBasedJsObject
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testGetIdBasedJsObject() {
final Form form = new Form(null) {
{
new Input(this, new Id("name1"));
new Div(this, new Id("excluded")){{new Input(this, new Id("name2"));}};
new Input(this, new Id("name3"));
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name5"), new Type(Type.TEXT));}};
new Div(this){{new Input(this, new Id("name6"), new Type(Type.CHECKBOX));}};
new Div(this){{new Input(this, new Id("name7"), new Type(Type.RADIO));}};
new TextArea(this, new Id("included"));
}
};
final String jsObjectForNames = form.getIdBasedJsObject();
Assert.assertEquals("{name1:document.getElementById('name1').value,name3:document.getElementById('name3').value,included:document.getElementById('included').value,name7:document.getElementById('name7').checked,name6:document.getElementById('name6').checked,name5:document.getElementById('name5').value,name4:document.getElementById('name4').value,name2:document.getElementById('name2').value}", jsObjectForNames);
}
示例8: testGetIdBasedJsObjectPlus
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testGetIdBasedJsObjectPlus() {
final Form form = new Form(null) {
{
new Button(this, new Id("name1"));
new Div(this, new Id("excluded")){{new Input(this, new Id("name2"));}};
new Input(this, new Id("name3"));
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name4"));}};
new Div(this){{new Input(this, new Id("name5"), new Type(Type.TEXT));}};
new Div(this){{new Input(this, new Id("name6"), new Type(Type.CHECKBOX));}};
new Div(this){{new Input(this, new Id("name7"), new Type(Type.RADIO));}};
new TextArea(this, new Id("included"));
}
};
final String jsObjectForNames = form.getIdBasedJsObjectPlus(Arrays.asList(TagNameConstants.BUTTON));
Assert.assertEquals("{name1:document.getElementById('name1').value,name3:document.getElementById('name3').value,included:document.getElementById('included').value,name7:document.getElementById('name7').checked,name6:document.getElementById('name6').checked,name5:document.getElementById('name5').value,name4:document.getElementById('name4').value,name2:document.getElementById('name2').value}", jsObjectForNames);
}
示例9: testMultipleAttributesToHtmlString
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testMultipleAttributesToHtmlString() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
final String expectedString = "<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
final String expectedString1 = "<html id=\"htmlId\" hidden style=\"color:red;width:15px;\"></html>";
final String expectedString2 = "<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString())
&& !expectedString1.equals(html.toHtmlString())
&& !expectedString2.equals(html.toHtmlString())
&& !expectedString3.equals(html.toHtmlString())
&& !expectedString4.equals(html.toHtmlString())
&& !expectedString5.equals(html.toHtmlString())) {
Assert.fail("testMultipleAttributesToHtmlString 1 to 5");
}
if (html.toHtmlString().contains("\0")) {
System.out.println("yes contains");
}
}
示例10: testMetaInfoTags
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testMetaInfoTags() throws Exception {
final Div div = new Div(null, new Id("1")) {
/**
*
*/
private static final long serialVersionUID = 1L;
Br br = new Br(this);
Link link = new Link(this);
Meta meta = new Meta(this);
Div div = new Div(this, new Id("2"));
Head head = new Head(null);
Base base = new Base(null);
};
final String expectedString = "<div id=\"1\"><br/><link/><meta/><div id=\"2\"></div></div>";
assertEquals(expectedString, div.toHtmlString());
}
示例11: testToHtmlString
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testToHtmlString() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
html.setPrependDocType(true);
final String expectedString = "<!DOCTYPE html>\n<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
//in oracle jdk 1.8 it comes as expectedString2
final String expectedString2 = "<!DOCTYPE html>\n<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<!DOCTYPE html>\n<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString())
&& !expectedString2.equals(html.toHtmlString())
&& !expectedString3.equals(html.toHtmlString())
&& !expectedString4.equals(html.toHtmlString())
&& !expectedString5.equals(html.toHtmlString())) {
Assert.fail("testToHtmlString could not match expectedString 1 to 5");
}
}
示例12: testToHtmlStringWithCharset1
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testToHtmlStringWithCharset1() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
html.setPrependDocType(true);
final String expectedString = "<!DOCTYPE html>\n<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
//in oracle jdk 1.8 it comes as expectedString2
final String expectedString2 = "<!DOCTYPE html>\n<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<!DOCTYPE html>\n<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString(StandardCharsets.UTF_8))
&& !expectedString2.equals(html.toHtmlString(StandardCharsets.UTF_8))
&& !expectedString3.equals(html.toHtmlString(StandardCharsets.UTF_8))
&& !expectedString4.equals(html.toHtmlString(StandardCharsets.UTF_8))
&& !expectedString5.equals(html.toHtmlString(StandardCharsets.UTF_8))) {
Assert.fail("testToHtmlStringWithCharset1 could not match expectedString 1 to 5");
}
}
示例13: testToHtmlStringWithCharset2
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testToHtmlStringWithCharset2() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
html.setPrependDocType(true);
final String expectedString = "<!DOCTYPE html>\n<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
//in oracle jdk 1.8 it comes as expectedString2
final String expectedString2 = "<!DOCTYPE html>\n<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<!DOCTYPE html>\n<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString(StandardCharsets.UTF_8.name()))
&& !expectedString2.equals(html.toHtmlString(StandardCharsets.UTF_8.name()))
&& !expectedString3.equals(html.toHtmlString(StandardCharsets.UTF_8.name()))
&& !expectedString4.equals(html.toHtmlString(StandardCharsets.UTF_8.name()))
&& !expectedString5.equals(html.toHtmlString(StandardCharsets.UTF_8.name()))) {
Assert.fail("testToHtmlStringWithCharset2 could not match expectedString 1 to 5");
}
}
示例14: testToHtmlStringWithCharset3
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testToHtmlStringWithCharset3() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
html.setPrependDocType(true);
final String expectedString = "<!DOCTYPE html>\n<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
//in oracle jdk 1.8 it comes as expectedString2
final String expectedString2 = "<!DOCTYPE html>\n<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<!DOCTYPE html>\n<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString(true, StandardCharsets.UTF_8))
&& !expectedString2.equals(html.toHtmlString(true, StandardCharsets.UTF_8))
&& !expectedString3.equals(html.toHtmlString(true, StandardCharsets.UTF_8))
&& !expectedString4.equals(html.toHtmlString(true, StandardCharsets.UTF_8))
&& !expectedString5.equals(html.toHtmlString(true, StandardCharsets.UTF_8))) {
Assert.fail("testToHtmlStringWithCharset3 could not match expectedString 1 to 5");
}
}
示例15: testToHtmlStringWithCharset4
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; //導入依賴的package包/類
@Test
public void testToHtmlStringWithCharset4() throws Exception {
final Html html = new Html(null, new Hidden(null), new Id("htmlId"),
new Style("color:red;width:15px"));
html.setPrependDocType(true);
final String expectedString = "<!DOCTYPE html>\n<html id=\"htmlId\" style=\"color:red;width:15px;\" hidden></html>";
//in oracle jdk 1.8 it comes as expectedString2
final String expectedString2 = "<!DOCTYPE html>\n<html hidden id=\"htmlId\" style=\"color:red;width:15px;\"></html>";
final String expectedString3 = "<!DOCTYPE html>\n<html hidden style=\"color:red;width:15px;\" id=\"htmlId\"></html>";
final String expectedString4 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" hidden id=\"htmlId\"></html>";
final String expectedString5 = "<!DOCTYPE html>\n<html style=\"color:red;width:15px;\" id=\"htmlId\" hidden></html>";
if (!expectedString.equals(html.toHtmlString(true, StandardCharsets.UTF_8.name()))
&& !expectedString2.equals(html.toHtmlString(true, StandardCharsets.UTF_8.name()))
&& !expectedString3.equals(html.toHtmlString(true, StandardCharsets.UTF_8.name()))
&& !expectedString4.equals(html.toHtmlString(true, StandardCharsets.UTF_8.name()))
&& !expectedString5.equals(html.toHtmlString(true, StandardCharsets.UTF_8.name()))) {
Assert.fail("testToHtmlStringWithCharset3 could not match expectedString 1 to 5");
}
}