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


Java AjaxRequestTarget类代码示例

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

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:18,代码来源:ProjectBlobPage.java

示例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);
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:RevisionSelector.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:20,代码来源:AffinalRevisionPicker.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:25,代码来源:ReviewerChoice.java

示例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);
				}
				
			};
		}
		
	};
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:AjaxActionTab.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:SourceViewPanel.java

示例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);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:18,代码来源:ProjectBlobPage.java

示例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);
		}
				
	});
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:21,代码来源:SelectToAddChoice.java

示例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()));
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:AbstractSelect2Choice.java

示例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);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:18,代码来源:ProjectBlobPage.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:CodeCommentPanel.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:33,代码来源:SourceEditPanel.java

示例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());
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:13,代码来源:TestFormBehavior.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:10,代码来源:ProjectBranchesPage.java


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