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


Java AjaxRequestTarget.appendJavaScript方法代码示例

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


在下文中一共展示了AjaxRequestTarget.appendJavaScript方法的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: respond

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
	IRequestParameters params = RequestCycle.get().getRequest().getPostParameters();
	
	String tooltipId = params.getParameterValue("tooltip").toString();
	String commitHash = params.getParameterValue("commit").toString();
	RevCommit commit = getProject().getRevCommit(commitHash);
	String authoring;
	if (commit.getAuthorIdent() != null) {
		authoring = commit.getAuthorIdent().getName();
		if (commit.getCommitterIdent() != null)
			authoring += " " + DateUtils.formatAge(commit.getCommitterIdent().getWhen());
		authoring = "'" + JavaScriptEscape.escapeJavaScript(authoring) + "'";
	} else {
		authoring = "undefined";
	}
	String message = JavaScriptEscape.escapeJavaScript(commit.getFullMessage());
	String script = String.format("gitplex.server.blameMessage.show('%s', %s, '%s');", tooltipId, authoring, message); 
	target.appendJavaScript(script);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:21,代码来源:BlameMessageBehavior.java

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

示例4: respond

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
	if (dropdown == null) {
		dropdown = new FloatingPanel(target, new ComponentTarget(alignTarget!=null?alignTarget:getComponent()), placement) {
			
			@Override
			protected void onInitialize() {
				super.onInitialize();
				DropdownHover.this.onInitialize(this);
			}

			@Override
			protected Component newContent(String id) {
				return DropdownHover.this.newContent(id);
			}

			@Override
			protected void onClosed() {
				super.onClosed();

				AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
				if (target != null) {
					String script = String.format("gitplex.server.dropdownhover.closed('%s', '%s');", 
							getComponent().getMarkupId(true), getMarkupId(true));
					target.appendJavaScript(script);
				}
				
				dropdown = null;
			}

		};
		String script = String.format("gitplex.server.dropdownhover.opened('%s', '%s');", 
				getComponent().getMarkupId(true), dropdown.getMarkupId(true));
		target.appendJavaScript(script);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:37,代码来源:DropdownHover.java

示例5: requestRun

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
public void requestRun(AjaxRequestTarget target) {
	target.appendJavaScript(String.format(""
			+ "var $button = $('#%s');"
			+ "if ($button.length != 0) {"
			+ "$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...');"
			+ "}",
			getComponent().getMarkupId()));
	target.appendJavaScript(getCallbackScript());
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:14,代码来源:RunTaskBehavior.java

示例6: respond

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
	IRequestParameters params = RequestCycle.get().getRequest().getPostParameters();
	int page = params.getParameterValue("page").toInt();
	target.prependJavaScript(String.format("$('#%s .loading-indicator').remove();", 
			getComponent().getMarkupId()));
	
	appendPage(target, page);

	target.appendJavaScript(String.format("gitplex.infiniteScroll.check('%s');", 
			getComponent().getMarkupId()));
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:13,代码来源:InfiniteScrollBehavior.java

示例7: onActiveIndexChange

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void onActiveIndexChange(AjaxRequestTarget target) {
	Component hitsContainer = blobsView.get(activeBlobIndex).get(HITS_ID);
	if (!hitsContainer.isVisibilityAllowed()) {
		hitsContainer.setVisibilityAllowed(true);
		target.add(hitsContainer);
		target.add(blobsView.get(activeBlobIndex).get(EXPAND_LINK_ID));
	} 

	String activeLinkId = getMarkupId() + "-" + activeBlobIndex; 
	if (activeHitIndex != -1)
		activeLinkId += "-" + activeHitIndex;

	String script = String.format(""
			+ "$('#%s').find('.selectable').removeClass('active');"
			+ "$('#%s').addClass('active');"
			+ "$('#%s>.search-result>.body').scrollIntoView('a.selectable.active', 25, 25);", 
			getMarkupId(), activeLinkId, getMarkupId());
	target.appendJavaScript(script);
	
	target.add(prevMatchLink);
	target.add(nextMatchLink);
	
	MatchedBlob activeBlob = blobs.get(activeBlobIndex);
	
	QueryHit hit;
	if (activeHitIndex != -1)
		hit = activeBlob.getHits().get(activeHitIndex);
	else 
		hit = new FileHit(activeBlob.getBlobPath(), null);
	
	BlobIdent selected = new BlobIdent(context.getBlobIdent().revision, hit.getBlobPath(), 
			FileMode.REGULAR_FILE.getBits());
	context.onSelect(target, selected, hit.getTokenPos());
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:36,代码来源:SearchResultPanel.java

示例8: onSelectTab

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
private void onSelectTab(AjaxRequestTarget target) {
	refs = findRefs();
	revField.setModel(Model.of(""));
	revInput = null;
	target.add(revField);
	newItemsView(target);
	String script = String.format("gitplex.server.revisionSelector.bindInputKeys('%s');", getMarkupId(true));
	target.appendJavaScript(script);
	target.focusComponent(revField);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:11,代码来源:RevisionSelector.java

示例9: close

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
public final void close() {
	AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
	if (target != null) {
		String script = String.format("gitplex.server.floating.close($('#%s'), false);", getMarkupId(true));
		target.appendJavaScript(script);
	} 
	if (getParent() != null)
		remove();
	onClosed();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:11,代码来源:FloatingPanel.java

示例10: close

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
public final void close() {
	AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
	
	if (target != null) {
		String script = String.format("gitplex.server.modal.close($('#%s>.modal'), false);", getMarkupId(true));
		target.appendJavaScript(script);
	}
	remove();
	onClosed();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:11,代码来源:ModalPanel.java

示例11: onCommentDeleted

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
private void onCommentDeleted(AjaxRequestTarget target, CodeComment comment) {
	clearComment(target);
	SourceAware sourceAware = getSourceAware(comment.getCommentPos().getPath());
	if (sourceAware != null)
		sourceAware.onCommentDeleted(target, comment);
	((CommentSupport)markSupport).onCommentOpened(target, null);
	target.appendJavaScript("gitplex.server.revisionDiff.reposition();");
	MarkPos mark = getMark();
	if (mark != null) {
		sourceAware = getSourceAware(mark.getPath());
		if (sourceAware != null) {
			sourceAware.mark(target, mark);
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:16,代码来源:RevisionDiffPanel.java

示例12: onCommentDeleted

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@Override
public void onCommentDeleted(AjaxRequestTarget target, CodeComment comment) {
	String script = String.format("gitplex.server.textDiff.onCommentDeleted($('#%s'), %s);", 
			getMarkupId(), getJsonOfComment(comment));
	target.appendJavaScript(script);
	mark(target, null);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:8,代码来源:TextDiffPanel.java

示例13: newChangedContainer

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
private void newChangedContainer(@Nullable AjaxRequestTarget target) {
	WebMarkupContainer changedContainer = new WebMarkupContainer("changed");
	changedContainer.setVisible(change != null);
	changedContainer.setOutputMarkupPlaceholderTag(true);
	if (change != null) {
		changedContainer.add(new BlobDiffPanel("changes", new AbstractReadOnlyModel<Project>() {

			@Override
			public Project getObject() {
				return context.getProject();
			}
			
		}, new Model<PullRequest>(null), change, DiffViewMode.UNIFIED, null, null));
	} else {
		changedContainer.add(new WebMarkupContainer("changes"));
	}
	if (target != null) {
		replace(changedContainer);
		target.add(changedContainer);
		if (change != null) {
			String script = String.format("$('#%s .commit-option input[type=submit]').val('Commit and overwrite');", 
					getMarkupId());
			target.appendJavaScript(script);
		}
	} else {
		add(changedContainer);		
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:29,代码来源:CommitOptionPanel.java

示例14: updateCommits

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
private void updateCommits(AjaxRequestTarget target) {
	state.page = 1;

	target.add(feedback);
	body.replace(commitsView = newCommitsView());
	target.add(body);
	target.add(foot);
	target.appendJavaScript(renderCommitGraph());
	pushState(target);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:11,代码来源:ProjectCommitsPage.java

示例15: onPopState

import org.apache.wicket.ajax.AjaxRequestTarget; //导入方法依赖的package包/类
@Override
protected void onPopState(AjaxRequestTarget target, Serializable data) {
	super.onPopState(target, data);
	
	state = (State) data;

	target.add(queryForm);
	
	body.replace(commitsView = newCommitsView());
	target.add(body);
	target.add(foot);
	
	target.appendJavaScript(renderCommitGraph());
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:ProjectCommitsPage.java


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