本文整理汇总了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;
}
示例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);
}
示例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);"));
}
});
}
示例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;
}
示例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);
}
示例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())));
}
示例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());
}
示例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);
}
示例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));
}
示例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));
}
示例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());
}
}
示例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}");
}
示例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);
}
示例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);
}
示例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);
}