当前位置: 首页>>代码示例>>Java>>正文


Java AjaxRequestAttributes.setPreventDefault方法代码示例

本文整理汇总了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);
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:27,代码来源:KeyPressBehavior.java

示例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());
			}
		});
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:29,代码来源:FormComponentChangeAjaxEventBehavior.java

示例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);
		}
	};
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:13,代码来源:AjaxBootstrapPagingNavigationLink.java

示例4: updateAjaxAttributes

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入方法依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	attributes.setPreventDefault(true);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:PreventDefaultAjaxLink.java

示例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));
}
 
开发者ID:PhantomYdn,项目名称:wicket-console,代码行数:7,代码来源:CtrlEnterSubmitBehavior.java


注:本文中的org.apache.wicket.ajax.attributes.AjaxRequestAttributes.setPreventDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。