本文整理汇总了Java中org.apache.wicket.ajax.AjaxRequestTarget类的典型用法代码示例。如果您正苦于以下问题:Java AjaxRequestTarget类的具体用法?Java AjaxRequestTarget怎么用?Java AjaxRequestTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AjaxRequestTarget类属于org.apache.wicket.ajax包,在下文中一共展示了AjaxRequestTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: respond
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
String feedbackHtml;
TestResult result = test();
if (result.isSuccessful()) {
feedbackHtml = String.format(
"<div class='test-feedback alert alert-success'>%s</div>",
HtmlEscape.escapeHtml5(result.getMessage()));
} else {
feedbackHtml = String.format(
"<div class='test-feedback alert alert-danger'>%s</div>",
HtmlEscape.escapeHtml5(result.getMessage()));
}
feedbackHtml = StringUtils.replace(feedbackHtml, "\n", "<br>");
target.appendJavaScript(String.format("var $button = $('#%s');"
+ "$button.removeAttr('disabled');"
+ "$button.val($button[0].prevValue);"
+ "$button.html($button[0].prevHtml);"
+ "$button.closest('form').append('%s');"
+ "$button.removeClass('ajax-indicator');",
getComponent().getMarkupId(), JavaScriptEscape.escapeJavaScript(feedbackHtml)));
}
示例2: onModeChange
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
public void onModeChange(AjaxRequestTarget target, Mode mode) {
/*
* User might be changing blob name when adding a file, and onModeChange will be called.
* In this case, we only need to re-create blob content
*/
if (mode != Mode.ADD || state.mode != Mode.ADD) {
state.mode = mode;
pushState(target);
if (state.mode == Mode.VIEW || state.mode == Mode.EDIT || state.mode == Mode.ADD) {
newBlobNavigator(target);
newBlobOperations(target);
}
}
newBlobContent(target);
resizeWindow(target);
}
示例3: selectRevision
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
private void selectRevision(AjaxRequestTarget target, String revision) {
try {
if (projectModel.getObject().getRevCommit(revision, false) != null) {
onSelect(target, revision);
} else {
feedbackMessage = "Can not find commit of revision " + revision + "";
target.add(feedback);
}
} catch (Exception e) {
// revision selector might be closed in onSelect handler
if (findPage() != null) {
feedbackMessage = Throwables.getRootCause(e).getMessage();
target.add(feedback);
} else {
Throwables.propagate(e);
}
}
}
示例4: onInitialize
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new ProjectPicker("projectPicker", new AffinalProjectsModel(projectId), projectId) {
@Override
protected void onSelect(AjaxRequestTarget target, Project project) {
projectId = project.getId();
revision = project.getDefaultBranch();
newRevisionPicker(target);
AffinalRevisionPicker.this.onSelect(target, project, revision);
}
});
newRevisionPicker(null);
setOutputMarkupId(true);
}
示例5: onSelect
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void onSelect(AjaxRequestTarget target, UserFacade user) {
PullRequest request = requestModel.getObject();
ReviewInvitation invitation = null;
for(ReviewInvitation each: request.getReviewInvitations()) {
if (each.getUser().equals(user)) {
invitation = each;
break;
}
}
if (invitation == null) {
invitation = new ReviewInvitation();
invitation.setRequest(request);
invitation.setUser(GitPlex.getInstance(UserManager.class).load(user.getId()));
request.getReviewInvitations().add(invitation);
}
invitation.setType(ReviewInvitation.Type.MANUAL);
invitation.setDate(new Date());
request.clearQualityStatus();
if (!request.isNew())
GitPlex.getInstance(ReviewInvitationManager.class).invite(invitation);
}
示例6: render
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
public Component render(String componentId) {
return new ActionTabLink(componentId, this) {
@Override
protected WebMarkupContainer newLink(String id, ActionTab tab) {
return new AjaxLink<Void>("link") {
@Override
public void onClick(AjaxRequestTarget target) {
selectTab(this);
}
};
}
};
}
示例7: newOptions
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected WebMarkupContainer newOptions(String id) {
sourceFormat = new SourceFormatPanel(id, null, new OptionChangeCallback() {
@Override
public void onOptioneChange(AjaxRequestTarget target) {
String script = String.format("gitplex.server.sourceView.onTabSizeChange(%s);", sourceFormat.getTabSize());
target.appendJavaScript(script);
}
}, new OptionChangeCallback() {
@Override
public void onOptioneChange(AjaxRequestTarget target) {
String script = String.format("gitplex.server.sourceView.onLineWrapModeChange('%s');", sourceFormat.getLineWrapMode());
target.appendJavaScript(script);
}
});
return sourceFormat;
}
示例8: onPopState
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void onPopState(AjaxRequestTarget target, Serializable data) {
super.onPopState(target, data);
State popState = (State) data;
if (!popState.blobIdent.revision.equals(state.blobIdent.revision)) {
state = popState;
newSearchResult(target, null);
onResolvedRevisionChange(target);
} else {
state = popState;
newBlobNavigator(target);
newBlobOperations(target);
newBlobContent(target);
resizeWindow(target);
}
}
示例9: onInitialize
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
setOutputMarkupId(true);
add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (selection != null) {
onSelect(target, selection);
selection = null;
}
String script = String.format("$('#%s').select2('data', null);", getMarkupId());
target.appendJavaScript(script);
}
});
}
示例10: onEvent
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof AjaxRequestTarget) {
AjaxRequestTarget target = (AjaxRequestTarget) event.getPayload();
if (target.getComponents().contains(this)) {
// if this component is being repainted by ajax, directly, we
// must destroy Select2 so it removes
// its elements from DOM
target.prependJavaScript(JQuery.execute("$('#%s').select2('destroy');", getJquerySafeMarkupId()));
}
}
}
示例11: newBlobContent
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
private void newBlobContent(@Nullable AjaxRequestTarget target) {
PrioritizedComponentRenderer mostPrioritizedRenderer = null;
for (BlobRendererContribution contribution: GitPlex.getExtensions(BlobRendererContribution.class)) {
PrioritizedComponentRenderer renderer = contribution.getRenderer(this);
if (renderer != null) {
if (mostPrioritizedRenderer == null || mostPrioritizedRenderer.getPriority() > renderer.getPriority())
mostPrioritizedRenderer = renderer;
}
}
Component blobContent = Preconditions.checkNotNull(mostPrioritizedRenderer).render(BLOB_CONTENT_ID);
if (target != null) {
replace(blobContent);
target.add(blobContent);
} else {
add(blobContent);
}
}
示例12: newAddReplyContainer
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
private WebMarkupContainer newAddReplyContainer() {
WebMarkupContainer addReplyContainer = new Fragment("addReply", "addReplyFrag", this) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(SecurityUtils.getUser() != null);
}
};
addReplyContainer.setOutputMarkupId(true);
addReplyContainer.add(new AjaxLink<Void>("reply") {
@Override
public void onClick(AjaxRequestTarget target) {
onAddReply(target, false, null);
}
});
return addReplyContainer;
}
示例13: newEditOptions
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected WebMarkupContainer newEditOptions(String componentId) {
sourceFormat = new SourceFormatPanel(componentId, new OptionChangeCallback() {
@Override
public void onOptioneChange(AjaxRequestTarget target) {
String script = String.format("gitplex.server.sourceEdit.onIndentTypeChange('%s', '%s');",
sourceFormComponent.getMarkupId(), sourceFormat.getIndentType());
target.appendJavaScript(script);
}
}, new OptionChangeCallback() {
@Override
public void onOptioneChange(AjaxRequestTarget target) {
String script = String.format("gitplex.server.sourceEdit.onTabSizeChange('%s', %s);",
sourceFormComponent.getMarkupId(), sourceFormat.getTabSize());
target.appendJavaScript(script);
}
}, new OptionChangeCallback() {
@Override
public void onOptioneChange(AjaxRequestTarget target) {
String script = String.format("gitplex.server.sourceEdit.onLineWrapModeChange('%s', '%s');",
sourceFormComponent.getMarkupId(), sourceFormat.getLineWrapMode());
target.appendJavaScript(script);
}
});
return sourceFormat;
}
示例14: requestTest
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
public void requestTest(AjaxRequestTarget target) {
target.appendJavaScript(String.format("var $button = $('#%s');"
+ "$button.attr('disabled', 'disabled');"
+ "$button[0].prevValue = $button.val();"
+ "$button[0].prevHtml = $button.html();"
+ "$button.val($button.val() + ' in progress...');"
+ "$button.html($button.html() + ' in progress...');"
+ "$button.addClass('ajax-indicator');"
+ "$button.closest('form').children('.test-feedback').remove();",
getComponent().getMarkupId()));
target.appendJavaScript(getCallbackScript());
}
示例15: onPopState
import org.apache.wicket.ajax.AjaxRequestTarget; //导入依赖的package包/类
@Override
protected void onPopState(AjaxRequestTarget target, Serializable data) {
super.onPopState(target, data);
baseBranch = (String) data;
target.add(baseChoice);
target.add(branchesContainer);
target.add(noBranchesContainer);
target.add(pagingNavigator);
}