本文整理汇总了Java中org.apache.wicket.extensions.markup.html.form.DateTextField类的典型用法代码示例。如果您正苦于以下问题:Java DateTextField类的具体用法?Java DateTextField怎么用?Java DateTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateTextField类属于org.apache.wicket.extensions.markup.html.form包,在下文中一共展示了DateTextField类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDateTextField
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
/**
* Gets the DateTextField inside this datepicker wrapper.
*
* @return the date field
*/
public DateTextField getDateTextField()
{
DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() {
@Override
public void component(DateTextField arg0, IVisit<DateTextField> arg1) {
arg1.stop(arg0);
}
});
if (component == null) {
throw new WicketRuntimeException("BootstrapDateTimepicker didn't have any DateTextField child!");
}
return component;
}
示例2: testTagInjection
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testTagInjection() {
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour());
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester elem = TagTester.createTagByAttribute(doc, "wicket:id", "field");
assertEquals("en", elem.getAttribute("data-date-language"));
}
示例3: testCSSInjection
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testCSSInjection() {
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour());
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> css = TagTester.createTagsByAttribute(head.getValue(), "type", "text/css", false);
assertEquals(1, css.size());
assertEquals("link", css.get(0).getName());
assertTrue(css.get(0).getAttribute("href").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/datepicker(.*)\\.css"));
}
示例4: testNonInjectionInDisabledComponent
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testNonInjectionInDisabledComponent() {
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour());
}};
field.setEnabled(false);
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
assertNull(TagTester.createTagByAttribute(doc, "head"));
TagTester elem = TagTester.createTagByAttribute(doc, "wicket:id", "field");
assertNull(elem.getAttribute("data-date-language"));
}
示例5: testCSSInjection
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testCSSInjection()
{
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDateTimePickerBehaviour());
}
};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> css = TagTester.createTagsByAttribute(head.getValue(), "type", "text/css", false);
assertEquals(1, css.size());
assertEquals("link", css.get(0).getName());
assertTrue(css.get(0).getAttribute("href").matches("(.*)" + BootstrapDateTimePickerBehaviour.class.getName() + "/bootstrap-datetimepicker(.*)\\.css"));
}
示例6: testJSInjection
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testJSInjection()
{
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDateTimePickerBehaviour());
}
};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDateTimePickerBehaviour.class.getName() + "/moment-with-locales(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDateTimePickerBehaviour.class.getName() + "/bootstrap-datetimepicker(.*)\\.js"));
}
示例7: getDateTextField
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
/**
* Gets the DateTextField inside this datepicker wrapper.
*
* @return the date field
*/
public DateTextField getDateTextField(){
DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() {
@Override
public void component(DateTextField arg0, IVisit<DateTextField> arg1) {
arg1.stop(arg0);
}
});
if (component == null)
throw new WicketRuntimeException("BootstrapDatepicker didn't have any DateTextField child!");
return component;
}
示例8: testDatepickerLifecycle
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testDatepickerLifecycle() {
TestBootstrapDatepicker picker = new TestBootstrapDatepicker("picker");
startTest(picker);
getTester().assertComponent(picker.getPageRelativePath(), TestBootstrapDatepicker.class);
getTester().assertComponent(picker.getInnerField().getPageRelativePath(), DateTextField.class);
assertEquals(picker.getInnerField(), picker.getDateTextField());
}
示例9: testJSInjection
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testJSInjection() {
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour());
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertEquals(5, scripts.size());
for (int i = 0; i < 5; i++) {
assertEquals("script", scripts.get(i).getName());
}
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker-extension(.*)\\.js"));
assertTrue(scripts.get(2).getAttribute("src").matches("(.*)" + JQueryResourceReference.class.getName() + "(.*)/jquery(.*)\\.js"));
assertTrue(scripts.get(3).getAttribute("src").matches("(.*)" + AbstractDefaultAjaxBehavior.class.getName() + "(.*)/wicket-event-jquery(.*)\\.js"));
assertTrue(scripts.get(4).getValue().matches("(?s)(.*)Wicket.Event.add\\(window, \\\"domready\\\", function\\(event\\) \\{(.*)\\$\\(\"#" +
field.getMarkupId() + "\"\\).datepicker\\(\\);(.*);\\}\\);(.*)"));
}
示例10: testJSInjectionNonEnglishLocale
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testJSInjectionNonEnglishLocale() {
getTester().getSession().setLocale(Locale.FRENCH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour());
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertEquals(6, scripts.size());
for (int i = 0; i < 6; i++) {
assertEquals("script", scripts.get(i).getName());
}
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker-extension(.*)\\.js"));
assertTrue(scripts.get(2).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/locales/bootstrap-datepicker.fr(.*)\\.js"));
assertTrue(scripts.get(3).getAttribute("src").matches("(.*)" + JQueryResourceReference.class.getName() + "(.*)/jquery(.*)\\.js"));
assertTrue(scripts.get(4).getAttribute("src").matches("(.*)" + AbstractDefaultAjaxBehavior.class.getName() + "(.*)/wicket-event-jquery(.*)\\.js"));
assertTrue(scripts.get(5).getValue().matches("(?s)(.*)Wicket.Event.add\\(window, \\\"domready\\\", function\\(event\\) \\{(.*)\\$\\(\"#" +
field.getMarkupId() + "\"\\).datepicker\\(\\);(.*);\\}\\);(.*)"));
}
示例11: testJSInjectionOneSpecialDate
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testJSInjectionOneSpecialDate() {
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("deprecation")
@Override
public java.util.Collection<SpecialDate> getSpecialDates() {
return Arrays.asList(new SpecialDate(new Date(110, 11, 25), "holiday", "Christmas"));
};
});
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertEquals(5, scripts.size());
for (int i = 0; i < 5; i++) {
assertEquals("script", scripts.get(i).getName());
}
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker-extension(.*)\\.js"));
assertTrue(scripts.get(2).getAttribute("src").matches("(.*)" + JQueryResourceReference.class.getName() + "(.*)/jquery(.*)\\.js"));
assertTrue(scripts.get(3).getAttribute("src").matches("(.*)" + AbstractDefaultAjaxBehavior.class.getName() + "(.*)/wicket-event-jquery(.*)\\.js"));
assertTrue(scripts.get(4).getValue().matches("(?s)(.*)Wicket.Event.add\\(window, \\\"domready\\\", function\\(event\\) \\{(.*)\\$\\(\"#" +
field.getMarkupId() + "\"\\).datepicker\\(null, \\[" +
"\\{dt:new Date\\('2010-12-25'\\), css:'holiday', tooltip:'Christmas'\\}" +
"\\]\\);(.*);\\}\\);(.*)"));
}
示例12: testBehaviorEmptySpecialDates
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testBehaviorEmptySpecialDates() {
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public java.util.Collection<SpecialDate> getSpecialDates() {
return new ArrayList<SpecialDate>();
};
});
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertEquals(5, scripts.size());
for (int i = 0; i < 5; i++) {
assertEquals("script", scripts.get(i).getName());
}
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker-extension(.*)\\.js"));
assertTrue(scripts.get(2).getAttribute("src").matches("(.*)" + JQueryResourceReference.class.getName() + "(.*)/jquery(.*)\\.js"));
assertTrue(scripts.get(3).getAttribute("src").matches("(.*)" + AbstractDefaultAjaxBehavior.class.getName() + "(.*)/wicket-event-jquery(.*)\\.js"));
assertTrue(scripts.get(4).getValue().matches("(?s)(.*)Wicket.Event.add\\(window, \\\"domready\\\", function\\(event\\) \\{(.*)\\$\\(\"#" +
field.getMarkupId() + "\"\\).datepicker\\(\\);(.*);\\}\\);(.*)"));
}
示例13: TestBootstrapDatepicker
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
public TestBootstrapDatepicker(String id) {
super(id);
field = new DateTextField("input");
}
示例14: testBehaviorManySpecialDates
import org.apache.wicket.extensions.markup.html.form.DateTextField; //导入依赖的package包/类
@Test
public void testBehaviorManySpecialDates() {
getTester().getSession().setLocale(Locale.ENGLISH);
DateTextField field = new DateTextField("field") {
private static final long serialVersionUID = 1L;
{
add(new BootstrapDatePickerBehaviour() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("deprecation")
@Override
public java.util.Collection<SpecialDate> getSpecialDates() {
return Arrays.asList(
new SpecialDate(new Date(110, 11, 25), "holiday", "Christmas"),
new SpecialDate(new Date(110, 0, 1), "holiday", "New Year"));
};
});
}};
startFormComponentTest(field, "text");
String doc = getTester().getLastResponse().getDocument();
TagTester head = TagTester.createTagByAttribute(doc, "head");
assertNotNull(head);
List<TagTester> scripts = TagTester.createTagsByAttribute(head.getValue(), "type", "text/javascript", false);
assertEquals(5, scripts.size());
for (int i = 0; i < 5; i++) {
assertEquals("script", scripts.get(i).getName());
}
assertTrue(scripts.get(0).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker(.*)\\.js"));
assertTrue(scripts.get(1).getAttribute("src").matches("(.*)" + BootstrapDatePickerBehaviour.class.getName() + "/bootstrap-datepicker-extension(.*)\\.js"));
assertTrue(scripts.get(2).getAttribute("src").matches("(.*)" + JQueryResourceReference.class.getName() + "(.*)/jquery(.*)\\.js"));
assertTrue(scripts.get(3).getAttribute("src").matches("(.*)" + AbstractDefaultAjaxBehavior.class.getName() + "(.*)/wicket-event-jquery(.*)\\.js"));
assertTrue(scripts.get(4).getValue().matches("(?s)(.*)Wicket.Event.add\\(window, \\\"domready\\\", function\\(event\\) \\{(.*)\\$\\(\"#" +
field.getMarkupId() + "\"\\).datepicker\\(null, \\[" +
"\\{dt:new Date\\('2010-12-25'\\), css:'holiday', tooltip:'Christmas'\\}," +
"\\{dt:new Date\\('2010-01-01'\\), css:'holiday', tooltip:'New Year'\\}" +
"\\]\\);(.*);\\}\\);(.*)"));
}