本文整理汇总了Java中org.apache.wicket.ajax.attributes.AjaxRequestAttributes.setPreventDefault方法的典型用法代码示例。如果您正苦于以下问题:Java AjaxRequestAttributes.setPreventDefault方法的具体用法?Java AjaxRequestAttributes.setPreventDefault怎么用?Java AjaxRequestAttributes.setPreventDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.ajax.attributes.AjaxRequestAttributes
的用法示例。
在下文中一共展示了AjaxRequestAttributes.setPreventDefault方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAjaxAttributes
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
IAjaxCallListener listener = new AjaxCallListener() {
@Override
public CharSequence getPrecondition(Component component) {
//this javascript code evaluates wether an ajaxcall is necessary.
//Here only by keyocdes for F9 and F10
return "var keycode = Wicket.Event.keyCode(attrs.event);" +
"if ((keycode == 112) || (keycode == 113) || (keycode == 114) || (keycode == 115))" +
" return true;" +
"else" +
" return false;";
}
};
attributes.getAjaxCallListeners().add(listener);
//Append the pressed keycode to the ajaxrequest
attributes.getDynamicExtraParameters()
.add("var eventKeycode = Wicket.Event.keyCode(attrs.event);" +
"return {keycode: eventKeycode};");
//whithout setting, no keyboard events will reach any inputfield
attributes.setPreventDefault(true);
}
示例2: updateAjaxAttributes
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setMethod(Method.POST);
/* Allows all sort of things to work properly:
* * allows clicks on labels to work properly
* * makes the radio/check buttons properly change their visual aspect on IE.
*/
attributes.setPreventDefault(false);
if (choice) {
// For explanations, see: getUniqueEventName(), getCallbackScript(), postprocessConfiguration()
attributes.setEventNames(getUniqueEventName());
// Copied from AjaxFormChoiceComponentUpdatingBehavior
attributes.setSerializeRecursively(true);
attributes.getAjaxCallListeners().add(new AjaxCallListener() {
private static final long serialVersionUID = 1L;
@Override
public CharSequence getPrecondition(Component component) {
return String.format("return attrs.event.target.name === '%s'", getFormComponent().getInputName());
}
});
}
}
示例3: newAjaxPagingNavigationBehavior
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected AjaxPagingNavigationBehavior newAjaxPagingNavigationBehavior(IPageable pageable, String event) {
return new AjaxBootstrapPagingNavigationBehavior(this, pageable, event) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(true);
AjaxBootstrapPagingNavigationLink.this.updateAjaxAttributes(attributes);
}
};
}
示例4: updateAjaxAttributes
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(true);
}
示例5: updateAjaxAttributes
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(false);
attributes.getAjaxCallListeners().add(new AjaxCallListener().onPrecondition(CHECK_CTRL_ENTER_SCRIPT));
}