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


Java AjaxRequestAttributes类代码示例

本文整理汇总了Java中org.apache.wicket.ajax.attributes.AjaxRequestAttributes的典型用法代码示例。如果您正苦于以下问题:Java AjaxRequestAttributes类的具体用法?Java AjaxRequestAttributes怎么用?Java AjaxRequestAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AjaxRequestAttributes类属于org.apache.wicket.ajax.attributes包,在下文中一共展示了AjaxRequestAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newAdditionalActions

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
public WebMarkupContainer newAdditionalActions(String id) {
	WebMarkupContainer actions = new Fragment(id, "actionsFrag", this);
	if (!symbols.isEmpty()) {
		actions.add(new CheckBox("outline", Model.of(isOutlineVisibleInitially())).add(new OnChangeAjaxBehavior() {

			@Override
			protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
				super.updateAjaxAttributes(attributes);
				attributes.setMethod(Method.POST);
			}

			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				toggleOutline(target);
			}
			
		}));
	} else {
		actions.add(new WebMarkupContainer("outline").setVisible(false));
	}
	return actions;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:SourceViewPanel.java

示例2: CheckBoxPanel

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
public CheckBoxPanel(String id, IModel<Boolean> model, final IModel<Boolean> enabled) {
    super(id);

    AjaxCheckBox check = new AjaxCheckBox(ID_CHECK, model) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            CheckBoxPanel.this.onUpdate(target);
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            CheckBoxPanel.this.updateAjaxAttributes(attributes);
        }
    };
    check.setOutputMarkupId(true);
    check.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return enabled.getObject();
        }
    });

    add(check);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:27,代码来源:CheckBoxPanel.java

示例3: createValueCheckbox

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
private Component createValueCheckbox(final String id, final String targetValue) {
    return new CheckBox(id, new FixedValueSetBooleanSelectionModel(AVAILABILITY_FIELD, availabilityLevels, targetValue, getModel()))
            .add(new OnChangeAjaxBehavior() {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    selectionChanged(target);
                }

                @Override
                protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
                    super.updateAjaxAttributes(attributes);

                    attributes.getAjaxCallListeners().add(new AjaxCallListener()
                            //disable checkboxes while updating via AJAX
                            .onBeforeSend("$('form#availability input').prop('disabled', true);")
                            //re-enable checkboxes afterwards
                            .onDone("$('form#availability input').prop('disabled', false);"));
                }

            });

}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:24,代码来源:AvailabilityFacetPanel.java

示例4: create

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
public AjaxLink<T> create(String wicketId, final IModel<T> parameter) {
	AjaxLink<T> link = new AjaxLink<T>(wicketId, parameter) {
		private static final long serialVersionUID = 1L;
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
			super.updateAjaxAttributes(attributes);
			action.updateAjaxAttributes(attributes, parameter);
		}
		@Override
		public void onClick(AjaxRequestTarget target) {
			action.execute(target, parameter);
		}
	};
	
	link.add(
			action.getActionAvailableCondition(parameter).thenShowInternal()
	);
	
	return link;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:22,代码来源:ActionColumnAjaxActionFactory.java

示例5: onInitialize

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
protected void onInitialize() {
	super.onInitialize();
	add(new AjaxEventBehavior(EVT_CLICK) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
			super.updateAjaxAttributes(attributes);
			ConfirmableAjaxBorder.this.updateAjaxAttributes(attributes);
		}

		@Override
		protected void onEvent(AjaxRequestTarget target) {
			if (isClickable()) {
				dialog.open(target);
			}
		}
	});
	addToBorder(form);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:ConfirmableAjaxBorder.java

示例6: updateAjaxAttributes

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	attributes.getAjaxCallListeners().add(new AjaxCallListener()
			// disable the button right away after clicking it
			// and mark on it if the window is unloading
			.onBefore(
					String.format(
							"$('#%s').prop('disabled', true);" +
									"$(window).on('beforeunload', function() {" +
									"$('#%s').data('unloading', true).prop('disabled', true)});",
							getMarkupId(), getMarkupId()))
			// if the page is unloading, keep it disabled, otherwise
			// add a slight delay in re-enabling it, just in case it succeeded
			// and there's a delay in closing a parent modal
			.onComplete(
					String.format("setTimeout(function() {" +
							"if (!$('#%s').data('unloading')) $('#%s').prop('disabled',false);" +
							"}, 1000)",
							getMarkupId(), getMarkupId())));
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:GbAjaxButton.java

示例7: isPostMethodTypeBehavior

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的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());
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:19,代码来源:MidPointApplication.java

示例8: 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

示例9: addBackButton

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
public void addBackButton(final AjaxAction ajaxAction) {
    addLeftButton(new AjaxButton(newButtonId(), Model.of("Back")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            ajaxAction.invoke(target);
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            attributes.setChannel(new AjaxChannel("PopupButton", AjaxChannel.Type.ACTIVE));
        };

    }.setDefaultFormProcessing(false));
}
 
开发者ID:jkrasnay,项目名称:panelized,代码行数:17,代码来源:DialogPanel.java

示例10: addCloseButton

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
public void addCloseButton(IModel<String> label) {
    addButton(new AjaxButton(newButtonId(), label) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            hide(target);
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            attributes.setChannel(new AjaxChannel("PopupButton", AjaxChannel.Type.ACTIVE));
        };

    }.setDefaultFormProcessing(false));
}
 
开发者ID:jkrasnay,项目名称:panelized,代码行数:17,代码来源:DialogPanel.java

示例11: testStoresAttributesInAjaxRequest

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Test
public void testStoresAttributesInAjaxRequest() {
    ImmutableMap<String, String> attributes = ImmutableMap.of(
            "test1", "A", "test2", "B", "test3", "C"
    );
    TestAjaxBehavior behavior = new TestAjaxBehavior(attributes);
    final AjaxRequestAttributes requestAttributes = new AjaxRequestAttributes();

    behavior.updateAjaxAttributes(requestAttributes);

    for (java.util.Map.Entry<String, String> entry : attributes.entrySet()) {
        Object actual = requestAttributes.getExtraParameters().get(entry.getKey());
        assertThat(actual).isNotNull();
        assertThat(actual).isEqualTo(entry.getValue());
    }
}
 
开发者ID:DrunkenPandaFans,项目名称:wicket-leaflet,代码行数:17,代码来源:LeafletAjaxBehaviorTest.java

示例12: updateAjaxAttributes

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	
	attributes.getDynamicExtraParameters().add("return {"
			+ "'fromList': fromList, "
			+ "'toList': toList, "
			+ "'fromItem': fromItem, "
			+ "'toItem': toItem}");
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:11,代码来源:SortBehavior.java

示例13: updateAjaxAttributes

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);

	attributes.setMethod(Method.POST);
	
	String script = String.format(""
			+ "return {mouseX: $('#%s').data('mouseX'), mouseY: $('#%s').data('mouseY')};", 
			getMarkupId(), getMarkupId());
	attributes.getDynamicExtraParameters().add(script);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:12,代码来源:DropdownLink.java

示例14: initPrevious

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
private void initPrevious() {
    WebMarkupContainer previous = new WebMarkupContainer(ID_PREVIOUS);
    previous.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isPreviousEnabled() ? "" : "disabled";
        }
    }));
    add(previous);
    AjaxLink previousLink = new AjaxLink(ID_PREVIOUS_LINK) {

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            previousPerformed(target);
        }
    };
    previousLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return isPreviousEnabled();
        }
    });
    previous.add(previousLink);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:32,代码来源:NavigatorPanel.java

示例15: initFirst

import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; //导入依赖的package包/类
private void initFirst() {
    WebMarkupContainer first = new WebMarkupContainer(ID_FIRST);
    first.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isFirstEnabled() ? "" : "disabled";
        }
    }));
    add(first);
    AjaxLink firstLink = new AjaxLink(ID_FIRST_LINK) {

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            firstPerformed(target);
        }
    };
    firstLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return BooleanUtils.isTrue(showPageListingModel.getObject()) && isFirstEnabled();
        }
    });
    first.add(firstLink);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:32,代码来源:NavigatorPanel.java


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