本文整理汇总了Java中org.apache.wicket.ajax.AbstractDefaultAjaxBehavior类的典型用法代码示例。如果您正苦于以下问题:Java AbstractDefaultAjaxBehavior类的具体用法?Java AbstractDefaultAjaxBehavior怎么用?Java AbstractDefaultAjaxBehavior使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractDefaultAjaxBehavior类属于org.apache.wicket.ajax包,在下文中一共展示了AbstractDefaultAjaxBehavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNamedFunctionStr
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
private static StringBuilder getNamedFunctionStr(String name, AbstractDefaultAjaxBehavior b, CallbackParameter... extraParameters) {
StringBuilder sb = new StringBuilder();
sb.append("function ").append(name).append("(");
boolean first = true;
for (CallbackParameter curExtraParameter : extraParameters) {
if (curExtraParameter.getFunctionParameterName() != null) {
if (first) {
first = false;
} else {
sb.append(',');
}
sb.append(curExtraParameter.getFunctionParameterName());
}
}
sb.append(") {\n");
sb.append(b.getCallbackFunctionBody(extraParameters));
sb.append("}\n");
return sb;
}
示例2: isPostMethodTypeBehavior
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
private boolean isPostMethodTypeBehavior(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes) {
if (behavior instanceof AjaxFormComponentUpdatingBehavior) {
// these also uses POST, but they set it after this method is called
return true;
}
if (behavior instanceof AjaxFormSubmitBehavior) {
AjaxFormSubmitBehavior fb = (AjaxFormSubmitBehavior) behavior;
Form form = fb.getForm();
String formMethod = form.getMarkupAttributes().getString("method");
if (formMethod == null || "POST".equalsIgnoreCase(formMethod) || form.getRootForm().isMultiPart()) {
// this will also use POST
return true;
}
}
return AjaxRequestAttributes.Method.POST.equals(attributes.getMethod());
}
示例3: onBind
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
/**
* @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onBind()
*/
@Override
protected void onBind()
{
// add empty AbstractDefaultAjaxBehavior to the component, to force
// rendering wicket-ajax.js reference if no other ajax behavior is on
// page
getComponent().add(new AbstractDefaultAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void respond(final AjaxRequestTarget target)
{
}
});
}
示例4: MenuConfig
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
/**
* @param id
*/
@SuppressWarnings("serial")
public MenuConfig(final String id, final Menu menu, final FavoritesMenu favoritesMenu)
{
super(id);
configureLink = new WebMarkupContainer("configureLink");
add(configureLink);
configureBehavior = new AbstractDefaultAjaxBehavior() {
@Override
protected void respond(final AjaxRequestTarget target)
{
final Request request = RequestCycle.get().getRequest();
final StringValue configuration = request.getPostParameters().getParameterValue("configuration");
final String xml = configuration.toString("");
if (log.isDebugEnabled() == true) {
log.debug(xml);
}
favoritesMenu.readFromXml(xml);
favoritesMenu.storeAsUserPref();
}
};
add(configureBehavior);
add(new MenuConfigContent("content", menu));
}
示例5: BratSuggestionVisualizer
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
public BratSuggestionVisualizer(String id,
IModel<UserAnnotationSegment> aModel)
{
super(id, aModel);
String username;
if (getModelObject().getAnnotatorState().getMode().equals(Mode.AUTOMATION)
|| getModelObject().getAnnotatorState().getMode().equals(Mode.CORRECTION)) {
username = "Suggestion";
}
else {
username = getModelObject().getUsername();
}
Label label = new Label("username", username);
add(label);
controller = new AbstractDefaultAjaxBehavior()
{
private static final long serialVersionUID = 1133593826878553307L;
@Override
protected void respond(AjaxRequestTarget aTarget)
{
try {
onSelectAnnotationForMerge(aTarget);
}
catch (UIMAException | ClassNotFoundException | IOException
| AnnotationException e) {
aTarget.addChildren(getPage(), IFeedback.class);
error("Error: " + e.getMessage());
}
}
};
add(controller);
}
示例6: getLoadingComponent
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
/**
* @param markupId The components markupid.
* @return The component to show while the real component is being created.
*/
public Component getLoadingComponent(final String markupId) {
IRequestHandler handler = new ResourceReferenceRequestHandler(
AbstractDefaultAjaxBehavior.INDICATOR);
return new Label(markupId, "<img alt=\"Loading...\" src=\"" +
RequestCycle.get().urlFor(handler) + "\"/>").setEscapeModelStrings(false);
}
示例7: getLoadingComponent
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
/**
* @param markupId The components markupid.
* @return The component to show while the real component is being created.
*/
public Component getLoadingComponent(String markupId) {
Label indicator = new Label(markupId, "<img src=\"" + RequestCycle.get().urlFor(AbstractDefaultAjaxBehavior.INDICATOR, null) + "\"/>");
indicator.setEscapeModelStrings(false);
indicator.add(new AttributeModifier("title", new Model("...")));
return indicator;
}
示例8: init
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
private void init() {
setOutputMarkupId(true);
// render chart by ajax, uppon request
chartRenderAjaxBehavior = new AbstractDefaultAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void respond(AjaxRequestTarget target) {
//log.debug("chartRenderAjaxBehavior.Responding for "+ getId());
renderImage(target, true);
}
@Override
public boolean isEnabled(Component component) {
return state < 2;
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);
attributes.setChannel(new AjaxChannel(getId()));
}
};
add(chartRenderAjaxBehavior);
// fields for maximized chart size
setDefaultModel(new CompoundPropertyModel(this));
form = new Form("chartForm");
form.add(new HiddenField("maxWidth"));
form.add(new HiddenField("maxHeight"));
add(form);
}
示例9: getLoadingComponent
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
/**
* @param markupId
* The components markupid.
* @return The component to show while the real component is being created.
*/
public Component getLoadingComponent(String markupId) {
Label indicator = new Label(markupId, "<img src=\"" + RequestCycle.get().urlFor(AbstractDefaultAjaxBehavior.INDICATOR, null) + "\"/>");
indicator.setEscapeModelStrings(false);
indicator.add(new AttributeModifier("title", new Model("...")));
return indicator;
}
示例10: testJSInjection
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的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\\(\\);(.*);\\}\\);(.*)"));
}
示例11: testJSInjectionNonEnglishLocale
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的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\\(\\);(.*);\\}\\);(.*)"));
}
示例12: testJSInjectionOneSpecialDate
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的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'\\}" +
"\\]\\);(.*);\\}\\);(.*)"));
}
示例13: testBehaviorEmptySpecialDates
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的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\\(\\);(.*);\\}\\);(.*)"));
}
示例14: SearchFieldPanel
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
public SearchFieldPanel(String id) {
super(id);
add(textField = new TextField<String>("input", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return searchString;
}
}));
textField.setOutputMarkupId(true);
ajaxBehavior = new AbstractDefaultAjaxBehavior() {
@Override
protected void respond(AjaxRequestTarget target) {
IRequestParameters req = RequestCycle.get().getRequest().getRequestParameters();
searchString = req.getParameterValue("searchString").toString();
if (searchString != null) {
searchString = searchString.trim();
}
if ("".equals(searchString)) {
searchString = null;
}
onSearch(target, searchString);
}
};
add(ajaxBehavior);
}
示例15: updateAjaxAttributes
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; //导入依赖的package包/类
@Override
public void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes) {
// Rien à faire de particulier.
}