The Unified and Autonomous Development Platform
Removed old comment feature
robin shine0428c61fcf5b
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.javaindex eee66834d3..60d0501d34 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java@@ -14,7 +14,6 @@ import org.apache.commons.lang3.StringUtils;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;@@ -31,6 +30,8 @@ import org.apache.wicket.model.LoadableDetachableModel;import org.apache.wicket.model.Model;import org.apache.wicket.util.lang.Bytes;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;@SuppressWarnings("serial")@@ -81,7 +82,7 @@ class SelectUrlPanel extends Panel {urlField.setOutputMarkupId(true);urlForm.add(urlField);- urlForm.add(new AjaxButton("insert", urlForm) {+ urlForm.add(new SubmitTypeAjaxButton("insert", urlForm) {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxButton.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxButton.javanew file mode 100644index 0000000000..14a1da970c--- /dev/null+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxButton.java@@ -0,0 +1,34 @@+package com.pmease.commons.wicket.component;++import org.apache.wicket.ajax.markup.html.form.AjaxButton;+import org.apache.wicket.markup.ComponentTag;+import org.apache.wicket.markup.html.form.Form;+import org.apache.wicket.model.IModel;++public class SubmitTypeAjaxButton extends AjaxButton {++ private static final long serialVersionUID = 1L;++ public SubmitTypeAjaxButton(String id) {+ super(id);+ }++ public SubmitTypeAjaxButton(String id, IModel<String> model) {+ super(id, model);+ }++ public SubmitTypeAjaxButton(String id, Form<?> form) {+ super(id, form);+ }++ public SubmitTypeAjaxButton(String id, IModel<String> model, final Form<?> form) {+ super(id, model, form);+ }++ @Override+ protected void onComponentTag(ComponentTag tag) {+ super.onComponentTag(tag);+ tag.getAttributes().put("type", "submit");+ }++}diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxSubmitLink.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxSubmitLink.javanew file mode 100644index 0000000000..c2e2fd9d51--- /dev/null+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/SubmitTypeAjaxSubmitLink.java@@ -0,0 +1,25 @@+package com.pmease.commons.wicket.component;++import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;+import org.apache.wicket.markup.ComponentTag;+import org.apache.wicket.markup.html.form.Form;++public class SubmitTypeAjaxSubmitLink extends AjaxSubmitLink {++ private static final long serialVersionUID = 1L;++ public SubmitTypeAjaxSubmitLink(String id) {+ super(id);+ }++ public SubmitTypeAjaxSubmitLink(String id, Form<?> form) {+ super(id, form);+ }++ @Override+ protected void onComponentTag(ComponentTag tag) {+ super.onComponentTag(tag);+ tag.getAttributes().put("type", "submit");+ }++}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Comment.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Comment.javaindex 208f18b9d1..d37a57aea7 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Comment.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Comment.java@@ -183,14 +183,24 @@ public class Comment extends AbstractEntity {oldAndNew = null;}- public int getLine() {- return Preconditions.checkNotNull(inlineInfo).getLine();+ public int getBeginLine() {+ return Preconditions.checkNotNull(inlineInfo).getBeginLine();}- public void setLine(int line) {+ public void setBeginLine(int beginLine) {if (inlineInfo == null)inlineInfo = new InlineInfo();- inlineInfo.setLine(line);+ inlineInfo.setBeginLine(beginLine);+ }++ public int getEndLine() {+ return Preconditions.checkNotNull(inlineInfo).getEndLine();+ }++ public void setEndLine(int endLine) {+ if (inlineInfo == null)+ inlineInfo = new InlineInfo();+ inlineInfo.setEndLine(endLine);}public Date getLastVisitDate() {diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CommentReply.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CommentReply.javaindex 5637ee0a45..ff373c6984 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CommentReply.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CommentReply.java@@ -32,6 +32,8 @@ public class CommentReply extends AbstractEntity {@Lob@Column(nullable=false, length=65535)private String content;++ private String contextCommit;public long getVersion() {return version;@@ -74,4 +76,18 @@ public class CommentReply extends AbstractEntity {this.comment = comment;}+ /**+ * @return the contextCommit+ */+ public String getContextCommit() {+ return contextCommit;+ }++ /**+ * @param contextCommit the contextCommit to set+ */+ public void setContextCommit(String contextCommit) {+ this.contextCommit = contextCommit;+ }+}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/InlineInfo.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/InlineInfo.javaindex a92c7a1c09..3bac255bd6 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/InlineInfo.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/InlineInfo.java@@ -35,7 +35,9 @@ public class InlineInfo implements Serializable {// Use Integer instead of int here in order to allow this class to be// embedded as nullable property of JPA entities- private Integer line;+ private Integer beginLine;++ private Integer endLine;public BlobIdent getBlobIdent() {return blobIdent;@@ -53,12 +55,20 @@ public class InlineInfo implements Serializable {this.compareWith = compareWith;}- public int getLine() {- return line;+ public Integer getBeginLine() {+ return beginLine;+ }++ public void setBeginLine(Integer beginLine) {+ this.beginLine = beginLine;+ }++ public Integer getEndLine() {+ return endLine;}- public void setLine(int line) {- this.line = line;+ public void setEndLine(Integer endLine) {+ this.endLine = endLine;}}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CommentManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CommentManager.javaindex 9568f18aca..a969fde9b3 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CommentManager.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CommentManager.java@@ -1,21 +1,10 @@package com.pmease.gitplex.core.manager;-import com.pmease.commons.git.BlobIdent;import com.pmease.commons.hibernate.dao.EntityDao;import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.entity.PullRequest;public interface CommentManager extends EntityDao<Comment> {- /**- * Update specified inline comment to make sure it is up to date with latest pull request update- *- * @param comment- * comment to be updated- */- void updateInlineInfo(Comment comment);-void save(Comment comment, boolean notify);- Comment addInline(PullRequest request, BlobIdent blobInfo, BlobIdent compareWith, int line, String content);}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommentManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommentManager.javaindex 7a9ee90678..f0340179e8 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommentManager.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommentManager.java@@ -1,185 +1,29 @@package com.pmease.gitplex.core.manager.impl;-import static com.pmease.gitplex.core.entity.Comment.DIFF_CONTEXT_SIZE;--import java.util.List;import java.util.Set;import javax.inject.Inject;import javax.inject.Singleton;-import org.eclipse.jgit.diff.DiffEntry;--import com.google.common.base.Preconditions;-import com.pmease.commons.git.Blob;-import com.pmease.commons.git.BlobIdent;-import com.pmease.commons.git.GitUtils;import com.pmease.commons.hibernate.Transactional;import com.pmease.commons.hibernate.dao.AbstractEntityDao;import com.pmease.commons.hibernate.dao.Dao;-import com.pmease.commons.lang.diff.DiffBlock;-import com.pmease.commons.lang.diff.DiffMatchPatch.Operation;-import com.pmease.commons.lang.diff.DiffUtils;-import com.pmease.gitplex.core.entity.Account;import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.entity.PullRequest;import com.pmease.gitplex.core.listener.PullRequestListener;-import com.pmease.gitplex.core.manager.AccountManager;import com.pmease.gitplex.core.manager.CommentManager;@Singletonpublic class DefaultCommentManager extends AbstractEntityDao<Comment> implements CommentManager {- private final AccountManager userManager;-private final Set<PullRequestListener> pullRequestListeners;@Inject- public DefaultCommentManager(Dao dao, AccountManager userManager,- Set<PullRequestListener> pullRequestListeners) {+ public DefaultCommentManager(Dao dao, Set<PullRequestListener> pullRequestListeners) {super(dao);- this.userManager = userManager;this.pullRequestListeners = pullRequestListeners;}- @Transactional- @Override- public void updateInlineInfo(Comment comment) {- Preconditions.checkNotNull(comment.getInlineInfo());-- String latestCommitHash = comment.getRequest().getLatestUpdate().getHeadCommitHash();- if (!latestCommitHash.equals(comment.getNewCommitHash())) {- List<DiffEntry> changes = comment.getDepot().getDiffs(comment.getNewCommitHash(),- latestCommitHash, true);- String oldCommitHash = comment.getOldCommitHash();- if (oldCommitHash.equals(comment.getBlobIdent().revision)) {- BlobIdent newBlobIdent = null;- String comparePath = comment.getCompareWith().path;- for (DiffEntry change: changes) {- if (comparePath != null && comparePath.equals(change.getOldPath())- || comparePath == null && comment.getBlobIdent().path.equals(change.getNewPath())) {- newBlobIdent = GitUtils.getNewBlobIdent(change, latestCommitHash);- break;- }- }- if (newBlobIdent != null) {- comment.setCompareWith(newBlobIdent);- Blob.Text oldText = comment.getDepot().getBlob(comment.getBlobIdent()).getText();- Blob.Text newText = null;- if (comment.getCompareWith().path != null)- newText = comment.getDepot().getBlob(comment.getCompareWith()).getText();- if (oldText != null && newText != null) {- List<DiffBlock<String>> diffs = DiffUtils.diff(oldText.getLines(), newText.getLines());- for (int i=0; i<diffs.size(); i++) {- DiffBlock<String> diff = diffs.get(i);- int startOffset = comment.getLine() - diff.getOldStart();- int endOffset = diff.getOldEnd() - comment.getLine();- if (startOffset >= 0 && endOffset > 0) {- if (diff.getOperation() == Operation.EQUAL) {- int newLine = startOffset + diff.getNewStart();- if (diffs.size() == 1) {- comment.setBlobIdent(new BlobIdent(comment.getCompareWith()));- comment.setLine(newLine);- } else if (i == 0) {- if (endOffset > DIFF_CONTEXT_SIZE) {- comment.setBlobIdent(new BlobIdent(comment.getCompareWith()));- comment.setLine(newLine);- }- } else if (i == diffs.size()-1) {- if (startOffset >= DIFF_CONTEXT_SIZE) {- comment.setBlobIdent(new BlobIdent(comment.getCompareWith()));- comment.setLine(newLine);- }- } else if (endOffset > DIFF_CONTEXT_SIZE && startOffset >= DIFF_CONTEXT_SIZE){- comment.setBlobIdent(new BlobIdent(comment.getCompareWith()));- comment.setLine(newLine);- }- }- break;- }- }- }- } else if (comment.getCompareWith().equals(comment.getBlobIdent())){- BlobIdent blobIdent = comment.getBlobIdent();- blobIdent.revision = latestCommitHash;- // call setBlobIdent in order to clear some cached info in comment object- comment.setBlobIdent(blobIdent);-- BlobIdent compareWith = comment.getCompareWith();- compareWith.revision = latestCommitHash;- // call setCompareWith in order to clear some cached info in comment object- comment.setCompareWith(compareWith);- } else {- BlobIdent compareWith = comment.getCompareWith();- compareWith.revision = latestCommitHash;- // call setCompareWith in order to clear some cached info in comment object- comment.setCompareWith(compareWith);- }- } else {- BlobIdent newBlobIdent = null;- for (DiffEntry diff: changes) {- if (comment.getBlobIdent().path.equals(diff.getOldPath())) {- newBlobIdent = GitUtils.getNewBlobIdent(diff, latestCommitHash);- break;- }- }- if (newBlobIdent != null) {- Blob.Text oldText = comment.getDepot().getBlob(comment.getBlobIdent()).getText();- Blob.Text newText = null;- if (newBlobIdent.path != null)- newText = comment.getDepot().getBlob(newBlobIdent).getText();- if (oldText != null && newText != null) {- List<DiffBlock<String>> diffs = DiffUtils.diff(oldText.getLines(), newText.getLines());- Integer newLineNo = DiffUtils.mapLines(diffs).get(comment.getLine());- if (newLineNo != null) {- comment.setBlobIdent(newBlobIdent);- comment.setLine(newLineNo);-- oldText = null;- if (comment.getCompareWith().path != null)- oldText = comment.getDepot().getBlob(comment.getCompareWith()).getText();- if (oldText != null) {- diffs = DiffUtils.diff(oldText.getLines(), newText.getLines());- for (int i=0; i<diffs.size(); i++) {- DiffBlock<String> diff = diffs.get(i);- int startOffset = comment.getLine() - diff.getNewStart();- int endOffset = diff.getNewEnd() - comment.getLine();- if (startOffset >= 0 && endOffset > 0) {- if (diff.getOperation() == Operation.EQUAL) {- if (diffs.size() == 1) {- comment.setCompareWith(new BlobIdent(comment.getBlobIdent()));- } else if (i == 0) {- if (endOffset > DIFF_CONTEXT_SIZE)- comment.setCompareWith(new BlobIdent(comment.getBlobIdent()));- } else if (i == diffs.size()-1) {- if (startOffset >= DIFF_CONTEXT_SIZE)- comment.setCompareWith(new BlobIdent(comment.getBlobIdent()));- } else if (endOffset > DIFF_CONTEXT_SIZE && startOffset >= DIFF_CONTEXT_SIZE){- comment.setCompareWith(new BlobIdent(comment.getBlobIdent()));- }- }- break;- }- }- }- } else {- comment.setCompareWith(newBlobIdent);- }- } else {- comment.setCompareWith(newBlobIdent);- }- } else {- BlobIdent blobIdent = comment.getBlobIdent();- blobIdent.revision = latestCommitHash;- // call setBlobInfo in order to clear some cached info in comment object- comment.setBlobIdent(blobIdent);- }- }- persist(comment);- }- }-@Transactional@Overridepublic void save(Comment comment, boolean notify) {@@ -191,21 +35,4 @@ public class DefaultCommentManager extends AbstractEntityDao<Comment> implements}}- @Transactional- @Override- public Comment addInline(PullRequest request, BlobIdent blobInfo, BlobIdent compareWith, int line, String content) {- Account user = userManager.getCurrent();- Preconditions.checkNotNull(user);- Comment comment = new Comment();- request.getComments().add(comment);- comment.setUser(user);- comment.setContent(content);- comment.setRequest(request);- comment.setBlobIdent(blobInfo);- comment.setCompareWith(compareWith);- comment.setLine(line);- save(comment, true);- return comment;- }-}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestUpdateManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestUpdateManager.javaindex 2ed9b3292f..96b3b56b3d 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestUpdateManager.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestUpdateManager.java@@ -6,11 +6,9 @@ import javax.inject.Inject;import javax.inject.Singleton;import com.pmease.commons.hibernate.Transactional;-import com.pmease.commons.hibernate.UnitOfWork;import com.pmease.commons.hibernate.dao.AbstractEntityDao;import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.util.FileUtils;-import com.pmease.gitplex.core.entity.Comment;import com.pmease.gitplex.core.entity.PullRequest;import com.pmease.gitplex.core.entity.PullRequestUpdate;import com.pmease.gitplex.core.listener.PullRequestListener;@@ -25,20 +23,13 @@ public class DefaultPullRequestUpdateManager extends AbstractEntityDao<PullRequeprivate final Set<PullRequestListener> pullRequestListeners;- private final CommentManager commentManager;-- private final UnitOfWork unitOfWork;-@Inject- public DefaultPullRequestUpdateManager(Dao dao,- StorageManager storageManager, Set<PullRequestListener> pullRequestListeners,- UnitOfWork unitOfWork, CommentManager commentManager) {+ public DefaultPullRequestUpdateManager(Dao dao, StorageManager storageManager,+ Set<PullRequestListener> pullRequestListeners, CommentManager commentManager) {super(dao);this.storageManager = storageManager;this.pullRequestListeners = pullRequestListeners;- this.unitOfWork = unitOfWork;- this.commentManager = commentManager;}@Transactional@@ -65,28 +56,6 @@ public class DefaultPullRequestUpdateManager extends AbstractEntityDao<PullRequelistener.onUpdated(update);}- // Inline comment update can be time consuming and we do it inside a separate thread- // in order not to blocking the push operation- final Long requestId = request.getId();- afterCommit(new Runnable() {-- @Override- public void run() {- unitOfWork.asyncCall(new Runnable() {-- @Override- public void run() {- PullRequest request = dao.load(PullRequest.class, requestId);- for (Comment comment: request.getComments()) {- if (comment.getInlineInfo() != null)- commentManager.updateInlineInfo(comment);- }- }-- });- }-- });}@Transactionaldiff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.javaindex 05b6afe522..8d9994aeb9 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java@@ -10,7 +10,6 @@ import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;import org.apache.wicket.event.Broadcast;@@ -36,6 +35,7 @@ import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.loader.InheritableThreadLocalData;import com.pmease.commons.wicket.ajaxlistener.ConfirmLeaveListener;import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.component.markdownviewer.MarkdownViewer;import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior.PageId;import com.pmease.gitplex.core.GitPlex;@@ -215,7 +215,7 @@ public class CommentPanel extends GenericPanel<Comment> {form.add(input);final long lastVersion = getComment().getVersion();- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {@@ -388,7 +388,7 @@ public class CommentPanel extends GenericPanel<Comment> {form.add(input);final int pageId = getPage().getPageId();- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {@@ -516,7 +516,7 @@ public class CommentPanel extends GenericPanel<Comment> {form.add(input);final long lastVersion = reply.getVersion();- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentLink.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentLink.javadeleted file mode 100644index f3bfa5b3a5..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentLink.java+++ /dev/null@@ -1,33 +0,0 @@-package com.pmease.gitplex.web.component.comment;--import org.apache.wicket.model.IModel;--import com.pmease.commons.wicket.component.LabelLink;-import com.pmease.gitplex.core.GitPlex;-import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.manager.CommentManager;-import com.pmease.gitplex.web.page.depot.file.DepotFilePage;-import com.pmease.gitplex.web.page.depot.file.DepotFilePage.HistoryState;-import com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.compare.RequestComparePage;--@SuppressWarnings("serial")-public class InlineCommentLink extends LabelLink<Comment> {-- public InlineCommentLink(String id, IModel<Comment> commentModel, IModel<String> labelModel) {- super(id, commentModel, labelModel);- }-- @Override- public void onClick() {- Comment comment = getModelObject();- GitPlex.getInstance(CommentManager.class).updateInlineInfo(comment);- if (comment.getBlobIdent().equals(comment.getCompareWith())) {- HistoryState state = new HistoryState();- state.commentId = comment.getId();- setResponsePage(DepotFilePage.class, DepotFilePage.paramsOf(comment.getDepot(), state));- } else {- setResponsePage(RequestComparePage.class, RequestComparePage.paramsOf(comment));- }- }--}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.htmldeleted file mode 100644index 3160eb56e1..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.html+++ /dev/null@@ -1,9 +0,0 @@-<wicket:panel>- <div class="inline-comment">- <div wicket:id="alert" class="outdated">- <i class="fa fa-warning"></i> <a wicket:id="refresh"></a>- </div>- <div wicket:id="avatar" class="avatar pull-left"></div>- <div wicket:id="detail" class="detail"></div>- </div>-</wicket:panel>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.javadeleted file mode 100644index 3b6e1f63c1..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/InlineCommentPanel.java+++ /dev/null@@ -1,65 +0,0 @@-package com.pmease.gitplex.web.component.comment;--import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;-import org.apache.wicket.event.Broadcast;-import org.apache.wicket.event.IEvent;-import org.apache.wicket.markup.head.CssHeaderItem;-import org.apache.wicket.markup.head.IHeaderResponse;-import org.apache.wicket.markup.html.WebMarkupContainer;-import org.apache.wicket.markup.html.panel.GenericPanel;-import org.apache.wicket.model.IModel;-import org.apache.wicket.model.Model;-import org.apache.wicket.request.resource.CssResourceReference;--import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.entity.PullRequest;-import com.pmease.gitplex.web.component.avatar.AvatarLink;-import com.pmease.gitplex.web.component.comment.event.CommentResized;-import com.pmease.gitplex.web.websocket.PullRequestChanged;--@SuppressWarnings("serial")-public class InlineCommentPanel extends GenericPanel<Comment> {-- public InlineCommentPanel(String id, IModel<Comment> commentModel) {- super(id, commentModel);- }-- @Override- protected void onInitialize() {- super.onInitialize();-- WebMarkupContainer alert = new WebMarkupContainer("alert") {-- @Override- public void onEvent(IEvent<?> event) {- super.onEvent(event);- if (event.getPayload() instanceof PullRequestChanged) {- PullRequestChanged pullRequestChanged = (PullRequestChanged) event.getPayload();- if (pullRequestChanged.getEvent() == PullRequest.Event.UPDATED) {- IPartialPageRequestHandler partialPageRequestHandler = pullRequestChanged.getPartialPageRequestHandler();- setVisible(true);- partialPageRequestHandler.add(this);- send(this, Broadcast.BUBBLE, new CommentResized(partialPageRequestHandler, InlineCommentPanel.this.getModelObject()));- }- }- }-- };- alert.add(new InlineCommentLink("refresh", getModel(),- Model.of("Context of comment updated, click to display in new context")));- alert.setOutputMarkupPlaceholderTag(true);- alert.setVisible(false);- add(alert);-- add(new AvatarLink("avatar", getModelObject().getUser(), null));- add(new CommentPanel("detail", getModel()));-- }-- @Override- public void renderHead(IHeaderResponse response) {- super.renderHead(response);- response.render(CssHeaderItem.forReference(new CssResourceReference(InlineCommentPanel.class, "inline-comment.css")));- }--}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/inline-comment.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/inline-comment.cssdeleted file mode 100644index ed756dd9c4..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/inline-comment.css+++ /dev/null@@ -1,15 +0,0 @@-.inline-comment>.detail {- margin-left: 36px;- font-size: 14px;- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;-}-.inline-comment>.outdated {- margin-bottom: 12px;-}-.inline-comment>.outdated>a {- font-size: 14px;-}-.inline-comment>.avatar img {- width: 28px;- height: 28px;-}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createbranch/CreateBranchPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createbranch/CreateBranchPanel.javaindex d565702003..7359fce183 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createbranch/CreateBranchPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createbranch/CreateBranchPanel.java@@ -2,7 +2,6 @@ package com.pmease.gitplex.web.component.createbranch;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.form.TextField;import org.apache.wicket.markup.html.panel.Panel;@@ -14,6 +13,7 @@ import org.eclipse.jgit.lib.Repository;import com.google.common.base.Joiner;import com.google.common.base.Preconditions;import com.pmease.commons.git.GitUtils;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.gitplex.core.entity.Account;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.gatekeeper.checkresult.CheckResult;@@ -64,7 +64,7 @@ abstract class CreateBranchPanel extends Panel {}));nameInput.setOutputMarkupId(true);- form.add(new AjaxButton("create") {+ form.add(new SubmitTypeAjaxButton("create") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createtag/CreateTagPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createtag/CreateTagPanel.javaindex b309c7a9e0..c2cbd16e00 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createtag/CreateTagPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/createtag/CreateTagPanel.java@@ -2,7 +2,6 @@ package com.pmease.gitplex.web.component.createtag;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.form.TextArea;import org.apache.wicket.markup.html.form.TextField;@@ -15,6 +14,7 @@ import org.eclipse.jgit.lib.Repository;import com.google.common.base.Joiner;import com.google.common.base.Preconditions;import com.pmease.commons.git.GitUtils;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.gitplex.core.entity.Account;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.gatekeeper.checkresult.CheckResult;@@ -84,7 +84,7 @@ abstract class CreateTagPanel extends Panel {}}));- form.add(new AjaxButton("create") {+ form.add(new SubmitTypeAjaxButton("create") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.htmlindex e5b31239d0..c4c8503585 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.html@@ -9,17 +9,6 @@</div></div><table class="body"><wicket:container wicket:id="diffLines"></wicket:container></table>- <form wicket:id="newComments" class="new-comment leave-confirm">- <div wicket:id="feedback" class="feedback"></div>- <textarea wicket:id="input" rows="5" class="form-control focusable"></textarea>- <div class="actions">- <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware leave-confirm">Comment on this line</button>- <button wicket:id="cancel" class="btn btn-sm btn-default">Close form</button>- </div>- </form>- <div wicket:id="comments" class="comment clearfix">- <div wicket:id="inlineComment"></div>- </div><script wicket:id="script" type="text/javascript"></script></div><div wicket:id="symbols"></div>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.javaindex e7f6bedf1a..d2a4a06fdd 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/TextDiffPanel.java@@ -9,27 +9,19 @@ import java.util.Map;import org.apache.wicket.Component;import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.attributes.CallbackParameter;-import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.behavior.AttributeAppender;-import org.apache.wicket.event.Broadcast;-import org.apache.wicket.event.IEvent;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;import org.apache.wicket.markup.head.JavaScriptHeaderItem;import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;-import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.link.BookmarkablePageLink;import org.apache.wicket.markup.html.link.Link;import org.apache.wicket.markup.html.panel.Panel;-import org.apache.wicket.markup.repeater.RepeatingView;import org.apache.wicket.model.IModel;import org.apache.wicket.model.LoadableDetachableModel;-import org.apache.wicket.model.Model;import org.apache.wicket.protocol.http.WebSession;import org.apache.wicket.request.IRequestParameters;import org.apache.wicket.request.cycle.RequestCycle;@@ -38,27 +30,17 @@ import org.apache.wicket.request.resource.CssResourceReference;import org.apache.wicket.request.resource.JavaScriptResourceReference;import com.pmease.commons.git.BlobChange;-import com.pmease.commons.git.BlobIdent;-import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.lang.diff.DiffBlock;import com.pmease.commons.lang.diff.DiffMatchPatch.Operation;import com.pmease.commons.lang.diff.DiffUtils;import com.pmease.commons.lang.diff.LineDiff;import com.pmease.commons.lang.tokenizers.CmToken;-import com.pmease.commons.loader.InheritableThreadLocalData;import com.pmease.commons.util.StringUtils;-import com.pmease.commons.wicket.ajaxlistener.ConfirmLeaveListener;-import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior;-import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.Comment;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.PullRequest;-import com.pmease.gitplex.core.manager.CommentManager;import com.pmease.gitplex.search.hit.QueryHit;import com.pmease.gitplex.web.Constants;-import com.pmease.gitplex.web.component.comment.CommentInput;-import com.pmease.gitplex.web.component.comment.InlineCommentPanel;-import com.pmease.gitplex.web.component.comment.event.CommentRemoved;import com.pmease.gitplex.web.component.diff.diffstat.DiffStatBar;import com.pmease.gitplex.web.component.diff.difftitle.BlobDiffTitle;import com.pmease.gitplex.web.component.diff.revision.DiffMode;@@ -67,7 +49,6 @@ import com.pmease.gitplex.web.component.symboltooltip.SymbolTooltipPanel;import com.pmease.gitplex.web.page.depot.file.DepotFilePage;import com.pmease.gitplex.web.page.depot.file.DepotFilePage.HistoryState;-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;import de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference;@SuppressWarnings("serial")@@ -77,66 +58,18 @@ public class TextDiffPanel extends Panel {private final IModel<PullRequest> requestModel;- private final IModel<Comment> commentModel;-private final BlobChange change;private final Map<Integer, Integer> contextSizes = new HashMap<>();private final DiffMode diffMode;- private final IModel<List<CommentAndPos>> listOfCommentAndPosModel = new LoadableDetachableModel<List<CommentAndPos>>() {-- @Override- protected List<CommentAndPos> load() {- List<CommentAndPos> listOfCommentAndPos = new ArrayList<>();- if (commentableModel.getObject()) {- for (Comment comment: requestModel.getObject().getComments()) {- if (comment.getInlineInfo() != null) {- GitPlex.getInstance(CommentManager.class).updateInlineInfo(comment);- CommentAndPos commentAndPos = getCommentAndPos(comment);- if (commentAndPos != null)- listOfCommentAndPos.add(commentAndPos);- }- }- listOfCommentAndPos.sort((commentAndPos1, commentAndPos2)- -> commentAndPos1.comment.getDate().compareTo(commentAndPos2.comment.getDate()));- }- return listOfCommentAndPos;- }-- };-- private final IModel<Boolean> commentableModel = new LoadableDetachableModel<Boolean>() {-- @Override- protected Boolean load() {- PullRequest request = requestModel.getObject();- if (request != null) {- List<String> commentables = request.getCommentables();- int oldCommitIndex = commentables.indexOf(change.getOldBlobIdent().revision);- int newCommitIndex = commentables.indexOf(change.getNewBlobIdent().revision);- return oldCommitIndex != -1 && newCommitIndex != -1 && oldCommitIndex < newCommitIndex;- } else {- return false;- }- }-- };-- private AbstractDefaultAjaxBehavior addCommentBehavior;-- private RepeatingView newCommentForms;-- private RepeatingView commentRows;-public TextDiffPanel(String id, IModel<Depot> depotModel, IModel<PullRequest> requestModel,IModel<Comment> commentModel, BlobChange change, DiffMode diffMode) {super(id);this.depotModel = depotModel;this.requestModel = requestModel;- this.commentModel = commentModel;this.change = change;this.diffMode = diffMode;}@@ -223,119 +156,6 @@ public class TextDiffPanel extends Panel {});- add(addCommentBehavior = new AbstractDefaultAjaxBehavior() {-- @Override- protected void respond(AjaxRequestTarget target) {- IRequestParameters params = RequestCycle.get().getRequest().getQueryParameters();- final int oldLineNo = params.getParameterValue("oldLineNo").toInt();- final int newLineNo = params.getParameterValue("newLineNo").toInt();-- final Form<?> newCommentForm = new Form<Void>(newCommentForms.newChildId());- newCommentForm.setOutputMarkupId(true);-- final CommentInput input;- newCommentForm.add(input = new CommentInput("input", requestModel, Model.of("")));- input.setRequired(true);-- final NotificationPanel feedback = new NotificationPanel("feedback", input);- feedback.setOutputMarkupPlaceholderTag(true);- newCommentForm.add(feedback);-- newCommentForm.add(new AjaxLink<Void>("cancel") {-- @Override- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {- super.updateAjaxAttributes(attributes);- attributes.getAjaxCallListeners().add(new ConfirmLeaveListener(newCommentForm));- }-- @Override- public void onClick(AjaxRequestTarget target) {- newCommentForm.remove();- String script = String.format("gitplex.textdiff.removeComment('%s');", newCommentForm.getMarkupId());- target.appendJavaScript(script);- }-- });-- newCommentForm.add(new AjaxSubmitLink("save") {-- @Override- protected void onError(AjaxRequestTarget target, Form<?> form) {- super.onError(target, form);- target.add(feedback);- }-- @Override- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {- super.onSubmit(target, form);-- BlobIdent commentAt;- BlobIdent compareWith;- int lineNo;-- if (newLineNo == -1) {- commentAt = change.getOldBlobIdent();- compareWith = change.getNewBlobIdent();- lineNo = oldLineNo;- } else {- commentAt = change.getNewBlobIdent();- compareWith = change.getOldBlobIdent();- lineNo = newLineNo;- }-- Comment comment;- InheritableThreadLocalData.set(new WebSocketRenderBehavior.PageId(getPage().getPageId()));- try {- comment = GitPlex.getInstance(CommentManager.class).addInline(- requestModel.getObject(), commentAt, compareWith,- lineNo, input.getModelObject());- } finally {- InheritableThreadLocalData.clear();- }-- CommentAndPos commentAndPos = getCommentAndPos(comment);- Component commentRow = newCommentRow(commentRows.newChildId(), commentAndPos);- commentRows.add(commentRow);- commentRow.setMarkupId(newCommentForm.getMarkupId());- newCommentForm.remove();-- target.add(commentRow);- }-- });-- newCommentForms.add(newCommentForm);-- String script = String.format("gitplex.textdiff.placeComment($('#%s'), %d, %d, $('<div id=\"%s\"></div>'));",- getMarkupId(), oldLineNo, newLineNo, newCommentForm.getMarkupId());- target.prependJavaScript(script);-- target.add(newCommentForm);- }-- @Override- public void renderHead(Component component, IHeaderResponse response) {- super.renderHead(component, response);- CharSequence addCommentCallback = addCommentBehavior.getCallbackFunction(- CallbackParameter.explicit("oldLineNo"), CallbackParameter.explicit("newLineNo"));- String script = String.format("document.getElementById('%s').addComment=%s;",- getMarkupId(), addCommentCallback);- response.render(OnDomReadyHeaderItem.forScript(script));- }-- });-- add(newCommentForms = new RepeatingView("newComments"));-- commentRows = new RepeatingView("comments");-- for (CommentAndPos each: listOfCommentAndPosModel.getObject())- commentRows.add(newCommentRow(commentRows.newChildId(), each));-- add(commentRows);-SymbolTooltipPanel symbolTooltip = new SymbolTooltipPanel("symbols", depotModel, requestModel) {@Override@@ -360,12 +180,8 @@ public class TextDiffPanel extends Panel {};add(symbolTooltip);- // do not call init script via onDomReady as otherwise there will be a noticeable delay- // between displaying diffs and comments if there are many diff files- CharSequence addCommentCallback = addCommentBehavior.getCallbackFunction(- CallbackParameter.explicit("oldLineNo"), CallbackParameter.explicit("newLineNo"));- String script = String.format("gitplex.textdiff.init('%s', %s, '%s', '%s', '%s');",- getMarkupId(), addCommentCallback, symbolTooltip.getMarkupId(),+ String script = String.format("gitplex.textdiff.init('%s', '%s', '%s', '%s');",+ getMarkupId(), symbolTooltip.getMarkupId(),change.getOldBlobIdent().revision, change.getNewBlobIdent().revision);add(new Label("script", script).setEscapeModelStrings(false));@@ -494,15 +310,6 @@ public class TextDiffPanel extends Panel {}}- private void appendAddComment(StringBuilder builder, int oldLineNo, int newLineNo) {- if (commentableModel.getObject()) {- builder.append("<span class='add-comment'>");- String script = String.format("document.getElementById('%s').addComment(%d, %d);",- getMarkupId(), oldLineNo, newLineNo);- builder.append("<a title='Add inline comment' href=\"javascript:").append(script).append("\">").append("<i class='fa fa-plus'></i></a></span>");- }- }-private void appendEqual(StringBuilder builder, DiffBlock<List<CmToken>> block, int lineIndex, int lastContextSize) {if (lastContextSize != 0)builder.append("<tr class='code expanded'>");@@ -513,8 +320,6 @@ public class TextDiffPanel extends Panel {int newLineNo = block.getNewStart() + lineIndex;StringBuilder contentBuilder = new StringBuilder();contentBuilder.append("<td class='content old").append(oldLineNo).append(" new").append(newLineNo).append("'>");- if (lastContextSize == 0)- appendAddComment(contentBuilder, oldLineNo, newLineNo);contentBuilder.append("<span class='operation'> </span>");for (CmToken token: block.getUnits().get(lineIndex)) {contentBuilder.append(token.toHtml(Operation.EQUAL));@@ -540,7 +345,6 @@ public class TextDiffPanel extends Panel {int newLineNo = block.getNewStart() + lineIndex;StringBuilder contentBuilder = new StringBuilder();contentBuilder.append("<td class='content new new").append(newLineNo).append("'>");- appendAddComment(contentBuilder, -1, newLineNo);contentBuilder.append("<span class='operation'>+</span>");List<CmToken> tokens = block.getUnits().get(lineIndex);for (int i=0; i<tokens.size(); i++)@@ -565,7 +369,6 @@ public class TextDiffPanel extends Panel {int oldLineNo = block.getOldStart() + lineIndex;StringBuilder contentBuilder = new StringBuilder();contentBuilder.append("<td class='content old old").append(oldLineNo).append("'>");- appendAddComment(contentBuilder, oldLineNo, -1);contentBuilder.append("<span class='operation'>-</span>");List<CmToken> tokens = block.getUnits().get(lineIndex);for (int i=0; i<tokens.size(); i++)@@ -591,7 +394,6 @@ public class TextDiffPanel extends Panel {int oldLineNo = deleteBlock.getOldStart()+deleteLineIndex;builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");builder.append("<td class='content old old").append(oldLineNo).append("'>");- appendAddComment(builder, oldLineNo, -1);builder.append("<span class='operation'>-</span>");for (CmToken token: deleteBlock.getUnits().get(deleteLineIndex))builder.append(token.toHtml(Operation.EQUAL));@@ -600,7 +402,6 @@ public class TextDiffPanel extends Panel {int newLineNo = insertBlock.getNewStart()+insertLineIndex;builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");builder.append("<td class='content new new").append(newLineNo).append("'>");- appendAddComment(builder, -1, newLineNo);builder.append("<span class='operation'>+</span>");for (CmToken token: insertBlock.getUnits().get(insertLineIndex))builder.append(token.toHtml(Operation.EQUAL));@@ -620,7 +421,6 @@ public class TextDiffPanel extends Panel {builder.append("<td class='number old new'>").append(oldLineNo+1).append("</td>");builder.append("<td class='number old new'>").append(newLineNo+1).append("</td>");builder.append("<td class='content old new old").append(oldLineNo).append(" new").append(newLineNo).append("'>");- appendAddComment(builder, oldLineNo, newLineNo);builder.append("<span class='operation'>*</span>");for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {for (CmToken token: tokenBlock.getUnits())@@ -630,7 +430,6 @@ public class TextDiffPanel extends Panel {} else {builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");builder.append("<td class='content old old").append(oldLineNo).append("'>");- appendAddComment(builder, oldLineNo, -1);builder.append("<span class='operation'>-</span>");for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {for (CmToken token: tokenBlock.getUnits()) {@@ -642,7 +441,6 @@ public class TextDiffPanel extends Panel {builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");builder.append("<td class='content new new").append(newLineNo).append("'>");- appendAddComment(builder, -1, newLineNo);builder.append("<span class='operation'>+</span>");for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {for (CmToken token: tokenBlock.getUnits()) {@@ -674,79 +472,10 @@ public class TextDiffPanel extends Panel {builder.append("</tr>");}- private CommentAndPos getCommentAndPos(Comment comment) {- BlobIdent blobIdent = comment.getBlobIdent();- if (blobIdent.equals(change.getOldBlobIdent())) {- CommentAndPos commentAndPos = new CommentAndPos();- commentAndPos.comment = comment;- commentAndPos.oldLineNo = comment.getLine();- commentAndPos.newLineNo = -1;- return commentAndPos;- } else if (blobIdent.equals(change.getNewBlobIdent())) {- CommentAndPos commentAndPos = new CommentAndPos();- commentAndPos.comment = comment;- commentAndPos.oldLineNo = -1;- commentAndPos.newLineNo = comment.getLine();- return commentAndPos;- } else {- return null;- }- }-- private Component newCommentRow(String id, CommentAndPos commentAndPos) {- final Long commentId = commentAndPos.comment.getId();- WebMarkupContainer row = new WebMarkupContainer(id) {-- @Override- public void onEvent(IEvent<?> event) {- super.onEvent(event);-- if (event.getPayload() instanceof CommentRemoved) {- CommentRemoved commentRemoved = (CommentRemoved) event.getPayload();- commentRows.remove(this);- String script = String.format("gitplex.textdiff.removeComment('%s');", getMarkupId());- commentRemoved.getPartialPageRequestHandler().appendJavaScript(script);-- send(TextDiffPanel.this, Broadcast.BUBBLE, commentRemoved);- }- }-- @Override- public void renderHead(IHeaderResponse response) {- super.renderHead(response);-- Comment comment = commentModel.getObject();- if (comment != null && commentId.equals(comment.getId())) {- String script = String.format("$('#%s').closest('td').focus();", getMarkupId());- response.render(OnDomReadyHeaderItem.forScript(script));- }- }-- };-- row.add(new InlineCommentPanel("inlineComment", new LoadableDetachableModel<Comment>() {-- @Override- protected Comment load() {- return GitPlex.getInstance(Dao.class).load(Comment.class, commentId);- }-- }));-- row.add(AttributeAppender.append("data-oldLineNo", commentAndPos.oldLineNo));- row.add(AttributeAppender.append("data-newLineNo", commentAndPos.newLineNo));- row.setOutputMarkupId(true);-- return row;- }-@Overrideprotected void onDetach() {depotModel.detach();requestModel.detach();- commentModel.detach();- commentableModel.detach();- listOfCommentAndPosModel.detach();super.onDetach();}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.jsindex 874c52d60c..521ffdc477 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js@@ -1,13 +1,6 @@gitplex.textdiff = {- init: function(containerId, addCommentCallback, symbolTooltipId, oldRev, newRev) {+ init: function(containerId, symbolTooltipId, oldRev, newRev) {var $container = $("#" + containerId);- $container[0].addComment = addCommentCallback;- $container.find(">.text-diff>.comment").each(function() {- var oldLineNo = $(this).data("oldlineno");- var newLineNo = $(this).data("newlineno");- gitplex.textdiff.placeComment($container, oldLineNo, newLineNo, $(this));- });-var $symbols = $container.find(".cm-property, .cm-variable, .cm-variable-2, .cm-variable-3, .cm-def, .cm-meta");$symbols.mouseover(function() {var revision;@@ -25,50 +18,5 @@ gitplex.textdiff = {}document.getElementById(symbolTooltipId).onMouseOverSymbol(revision, this);});- },- removeComment: function(commentId) {- var $comment = $("#" + commentId);- var $tr = $comment.closest("tr");- if ($tr.children(".comment").length == 1)- $tr.remove();- else- $comment.closest("td").empty().addClass("removed").append("This comment has been removed");- },- placeComment: function($container, oldLineNo, newLineNo, $comment) {- var $content;- if (newLineNo != -1)- $content = $container.find(".content.new" + newLineNo);- else- $content = $container.find(".content.old" + oldLineNo);-- var $line = $content.closest("tr");- var $currentLine = $line;- var $nextLine = $line.next();-- // check if we should place the comment into left side of right side- // of existing comment line- while ($nextLine.hasClass("comment")) {- var $seat = $nextLine.children(".content").eq(oldLineNo!=-1?0:1);- if ($seat.length == 0 || $seat.hasClass("comment")) {- $currentLine = $nextLine;- $nextLine = $nextLine.next();- } else {- $seat.prev().remove();- $seat.attr("colspan", "2").addClass("comment").empty().append($comment);- return;- }- }-- var $commentLine = $("<tr class='comment'></tr>").insertAfter($currentLine);- if ($line.children().length == 3)- $commentLine.append("<td colspan='3' tabindex='0' class='content comment'></td>");- else if (!$content.hasClass("old") && !$content.hasClass("new"))- $commentLine.append("<td colspan='4' tabindex='0' class='content comment'></td>");- else if (newLineNo != -1)- $commentLine.append("<td class='number'> </td><td tabindex='0' class='content'> </td><td colspan='2' tabindex='0' class='content comment'></td>");- else- $commentLine.append("<td colspan='2' tabindex='0' class='content comment'></td><td class='number'> </td><td class='content' tabindex='0'> </td>");-- $commentLine.children(".content.comment").append($comment);}}\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.javaindex 40f5d0f9f4..725081da2a 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java@@ -43,7 +43,7 @@ public abstract class DiffOptionPanel extends Panel {private final String newRev;- private LineProcessor lineProcessor = LineProcessOption.IGNORE_NOTHING;+ private LineProcessor lineProcessor = LineProcessOption.IGNORE_EOL_SPACES;private DiffMode diffMode;@@ -82,7 +82,7 @@ public abstract class DiffOptionPanel extends Panel {@Overridepublic String getIconClass() {if (lineProcessor == option)- return "fa fa-checked";+ return "fa fa-check";elsereturn null;}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobsearch/advanced/AdvancedSearchPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobsearch/advanced/AdvancedSearchPanel.javaindex e8f7ae5723..286a409454 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobsearch/advanced/AdvancedSearchPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobsearch/advanced/AdvancedSearchPanel.java@@ -12,7 +12,6 @@ import org.apache.shiro.codec.Base64;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;@@ -41,6 +40,7 @@ import org.slf4j.LoggerFactory;import com.pmease.commons.git.BlobIdent;import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.behavior.RunTaskBehavior;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.component.tabbable.AjaxActionTab;import com.pmease.commons.wicket.component.tabbable.Tab;import com.pmease.commons.wicket.component.tabbable.Tabbable;@@ -132,7 +132,7 @@ public abstract class AdvancedSearchPanel extends Panel {form.add(newSearchOptionEditor(option));- form.add(new AjaxSubmitLink("search") {+ form.add(new SubmitTypeAjaxSubmitLink("search") {private RunTaskBehavior runTaskBehavior;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.htmlindex f09be7e399..bb9efae593 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.html@@ -2,17 +2,6 @@<div class="source-view autofit clearfix"><div wicket:id="code" class="code pull-left"></div><div wicket:id="outline" class="outline pull-right"></div>- <form wicket:id="newComments" class="new-comment leave-confirm">- <div wicket:id="feedback" class="feedback"></div>- <textarea wicket:id="input" rows="5" class="form-control focusable"></textarea>- <div class="actions">- <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware leave-confirm">Comment on this line</button>- <button wicket:id="cancel" class="btn btn-sm btn-default">Close form</button>- </div>- </form>- <div wicket:id="comments" class="comment">- <div wicket:id="inlineComment" class="clearfix" tabindex="0"></div>- </div></div><div wicket:id="symbolTooltip"></div></wicket:extend>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.javaindex eef58eda9e..6383fc766d 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/SourceViewPanel.java@@ -8,28 +8,15 @@ import javax.servlet.http.Cookie;import org.apache.commons.lang3.StringEscapeUtils;import org.apache.wicket.Component;-import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;-import org.apache.wicket.ajax.attributes.CallbackParameter;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;-import org.apache.wicket.behavior.AttributeAppender;-import org.apache.wicket.event.Broadcast;-import org.apache.wicket.event.IEvent;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;import org.apache.wicket.markup.head.JavaScriptHeaderItem;import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;-import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.link.AbstractLink;-import org.apache.wicket.markup.repeater.RepeatingView;import org.apache.wicket.model.AbstractReadOnlyModel;-import org.apache.wicket.model.IModel;-import org.apache.wicket.model.LoadableDetachableModel;-import org.apache.wicket.model.Model;-import org.apache.wicket.request.IRequestParameters;import org.apache.wicket.request.cycle.RequestCycle;import org.apache.wicket.request.http.WebRequest;import org.apache.wicket.request.http.WebResponse;@@ -48,29 +35,19 @@ import com.pmease.commons.git.Blame;import com.pmease.commons.git.Blob;import com.pmease.commons.git.BlobIdent;import com.pmease.commons.git.GitUtils;-import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.lang.extractors.ExtractException;import com.pmease.commons.lang.extractors.Extractor;import com.pmease.commons.lang.extractors.Extractors;import com.pmease.commons.lang.extractors.Symbol;-import com.pmease.commons.loader.InheritableThreadLocalData;import com.pmease.commons.util.Range;-import com.pmease.commons.wicket.ajaxlistener.ConfirmLeaveListener;import com.pmease.commons.wicket.assets.codemirror.CodeMirrorResourceReference;import com.pmease.commons.wicket.assets.cookies.CookiesResourceReference;import com.pmease.commons.wicket.component.menu.MenuItem;import com.pmease.commons.wicket.component.menu.MenuLink;-import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior;import com.pmease.gitplex.core.GitPlex;-import com.pmease.gitplex.core.entity.Comment;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.PullRequest;-import com.pmease.gitplex.core.manager.CommentManager;import com.pmease.gitplex.search.hit.QueryHit;-import com.pmease.gitplex.web.component.comment.CommentInput;-import com.pmease.gitplex.web.component.comment.InlineCommentPanel;-import com.pmease.gitplex.web.component.comment.event.CommentRemoved;-import com.pmease.gitplex.web.component.comment.event.CommentResized;import com.pmease.gitplex.web.component.repofile.blobview.BlobViewContext;import com.pmease.gitplex.web.component.repofile.blobview.BlobViewContext.Mode;import com.pmease.gitplex.web.component.repofile.blobview.BlobViewPanel;@@ -79,8 +56,6 @@ import com.pmease.gitplex.web.page.depot.commit.CommitDetailPage;import com.pmease.gitplex.web.page.depot.file.Mark;import com.pmease.gitplex.web.util.DateUtils;-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;-@SuppressWarnings("serial")public class SourceViewPanel extends BlobViewPanel {@@ -88,46 +63,16 @@ public class SourceViewPanel extends BlobViewPanel {private static final String COOKIE_OUTLINE = "sourceView.outline";- private static final String INLINE_COMMENT_ID = "inlineComment";-private final List<Symbol> symbols = new ArrayList<>();private final String viewState;- private final IModel<List<Comment>> commentsModel = new LoadableDetachableModel<List<Comment>>() {-- @Override- protected List<Comment> load() {- List<Comment> comments = new ArrayList<>();- PullRequest request = context.getPullRequest();- if (request != null) {- for (Comment comment: request.getComments()) {- if (comment.getInlineInfo() != null) {- GitPlex.getInstance(CommentManager.class).updateInlineInfo(comment);- BlobIdent blobIdent = comment.getBlobIdent();- if (blobIdent.equals(context.getBlobIdent()))- comments.add(comment);- }- }- comments.sort((comment1, comment2) -> comment1.getDate().compareTo(comment2.getDate()));- }- return comments;- }-- };-private Component codeContainer;private OutlinePanel outlinePanel;private SymbolTooltipPanel symbolTooltip;- private RepeatingView newCommentForms;-- private RepeatingView commentWidgets;-- private AbstractDefaultAjaxBehavior addCommentBehavior;-public SourceViewPanel(String id, BlobViewContext context, @Nullable String viewState) {super(id, context);@@ -261,114 +206,6 @@ public class SourceViewPanel extends BlobViewPanel {});- add(newCommentForms = new RepeatingView("newComments"));-- commentWidgets = new RepeatingView("comments");-- for (Comment comment: commentsModel.getObject())- commentWidgets.add(newCommentWidget(commentWidgets.newChildId(), comment));-- add(commentWidgets);-- if (context.getPullRequest() != null) {- add(addCommentBehavior = new AbstractDefaultAjaxBehavior() {-- @Override- protected void respond(AjaxRequestTarget target) {- IRequestParameters params = RequestCycle.get().getRequest().getQueryParameters();- final int lineNo = params.getParameterValue("lineNo").toInt();-- final Form<?> newCommentForm = new Form<Void>(newCommentForms.newChildId());- newCommentForm.setOutputMarkupId(true);-- final CommentInput input;- newCommentForm.add(input = new CommentInput("input", new AbstractReadOnlyModel<PullRequest>() {-- @Override- public PullRequest getObject() {- return context.getPullRequest();- }-- }, Model.of("")));- input.setRequired(true);-- final NotificationPanel feedback = new NotificationPanel("feedback", input);- feedback.setOutputMarkupPlaceholderTag(true);- newCommentForm.add(feedback);-- newCommentForm.add(new AjaxLink<Void>("cancel") {-- @Override- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {- super.updateAjaxAttributes(attributes);- attributes.getAjaxCallListeners().add(new ConfirmLeaveListener(newCommentForm));- }-- @Override- public void onClick(AjaxRequestTarget target) {- newCommentForm.remove();- String script = String.format("$('#%s').parent()[0].lineWidget.clear();", newCommentForm.getMarkupId());- target.appendJavaScript(script);- }-- });-- newCommentForm.add(new AjaxSubmitLink("save") {-- @Override- protected void onError(AjaxRequestTarget target, Form<?> form) {- super.onError(target, form);- target.add(feedback);- }-- @Override- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {- super.onSubmit(target, form);-- BlobIdent commentAt = context.getBlobIdent();- BlobIdent compareWith = context.getBlobIdent();-- Comment comment;- InheritableThreadLocalData.set(new WebSocketRenderBehavior.PageId(getPage().getPageId()));- try {- comment = GitPlex.getInstance(CommentManager.class).addInline(- context.getPullRequest(), commentAt, compareWith, lineNo, input.getModelObject());- } finally {- InheritableThreadLocalData.clear();- }-- Component commentWidget = newCommentWidget(commentWidgets.newChildId(), comment);- commentWidgets.add(commentWidget);-- Component wrapper = commentWidget.get(INLINE_COMMENT_ID);- wrapper.setMarkupId(newCommentForm.getMarkupId());- newCommentForm.remove();- target.add(wrapper);-- String script = String.format(""- + "var $comment = $('#%s').parent();"- + "$comment.attr('id', '%s'); "- + "gitplex.sourceview.commentResized($comment);",- wrapper.getMarkupId(), commentWidget.getMarkupId());- target.appendJavaScript(script);- }-- });-- newCommentForms.add(newCommentForm);-- String script = String.format("gitplex.sourceview.placeComment('%s', %d, '%s');",- codeContainer.getMarkupId(), lineNo, newCommentForm.getMarkupId());- target.prependJavaScript(script);-- target.add(newCommentForm);- script = String.format("gitplex.sourceview.commentResized($('#%s').parent());",- newCommentForm.getMarkupId());- target.appendJavaScript(script);- }-- });- }setOutputMarkupId(true);}@@ -415,12 +252,7 @@ public class SourceViewPanel extends BlobViewPanel {blameCommitsJson = "undefined";}- CharSequence addCommentCallback;- if (addCommentBehavior != null)- addCommentCallback = addCommentBehavior.getCallbackFunction(CallbackParameter.explicit("lineNo"));- else- addCommentCallback = "undefined";- String script = String.format("gitplex.sourceview.init('%s', '%s', '%s', %s, '%s', '%s', %s, %d, %s, %s);",+ String script = String.format("gitplex.sourceview.init('%s', '%s', '%s', %s, '%s', '%s', %s, %s);",codeContainer.getMarkupId(),StringEscapeUtils.escapeEcmaScript(blob.getText().getContent()),context.getBlobIdent().path,@@ -428,58 +260,10 @@ public class SourceViewPanel extends BlobViewPanel {symbolTooltip.getMarkupId(),context.getBlobIdent().revision,blameCommitsJson,- context.getComment()!=null?context.getComment().getId():-1,- addCommentCallback,viewState!=null?"JSON.parse('"+viewState+"')":"undefined");response.render(OnDomReadyHeaderItem.forScript(script));}- private Component newCommentWidget(String id, Comment comment) {- final Long commentId = comment.getId();- final WebMarkupContainer widget = new WebMarkupContainer(id) {-- @Override- public void onEvent(IEvent<?> event) {- super.onEvent(event);-- if (event.getPayload() instanceof CommentRemoved) {- CommentRemoved commentRemoved = (CommentRemoved) event.getPayload();- commentWidgets.remove(this);- String script = String.format("document.getElementById('%s').lineWidget.clear();", getMarkupId());- commentRemoved.getPartialPageRequestHandler().appendJavaScript(script);-- send(SourceViewPanel.this, Broadcast.BUBBLE, commentRemoved);- } else if (event.getPayload() instanceof CommentResized) {- CommentResized commentResized = (CommentResized) event.getPayload();- String script = String.format("gitplex.sourceview.commentResized('%s');", getMarkupId());- commentResized.getPartialPageRequestHandler().appendJavaScript(script);- }- }-- };-- widget.add(new InlineCommentPanel(INLINE_COMMENT_ID, new LoadableDetachableModel<Comment>() {-- @Override- protected Comment load() {- return GitPlex.getInstance(Dao.class).load(Comment.class, commentId);- }-- }));-- widget.add(AttributeAppender.append("data-lineNo", comment.getLine()));- widget.setMarkupId("pullrequest-comment-" + commentId);- widget.setOutputMarkupId(true);-- return widget;- }-- @Override- protected void onDetach() {- commentsModel.detach();- super.onDetach();- }-@SuppressWarnings("unused")private static class BlameCommit {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.jsindex 64137319ef..8cfcdbe3b3 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js@@ -1,6 +1,5 @@gitplex.sourceview = {- init: function(codeId, fileContent, filePath, mark, symbolTooltipId, revision,- blameCommits, commentId, addCommentCallback, viewState) {+ init: function(codeId, fileContent, filePath, mark, symbolTooltipId, revision, blameCommits, viewState) {var cm;var $code = $("#" + codeId);@@ -54,22 +53,6 @@ gitplex.sourceview = {cm = CodeMirror($code[0], options);- if (addCommentCallback) {- $code[0].addCommentCallback = addCommentCallback;- var gutter = "CodeMirror-addcomments";- var gutters = cm.getOption("gutters").slice();- gutters.push(gutter);- cm.setOption("gutters", gutters);- for (var line=0; line<cm.lineCount(); line++) {- var $ele = $(document.createElement("div"));- $ele.addClass("CodeMirror-addcomment");- $ele.attr("title", "Add inline comment");- var script = "document.getElementById(\"" + codeId + "\").addCommentCallback(" + line + ");";- $("<a href='javascript: " + script + "'><i class='fa fa-plus-square-o'></i></a>").appendTo($ele);- cm.setGutterMarker(line, gutter, $ele[0]);- }- }-pmease.commons.codemirror.setMode(cm, filePath);if (mark)@@ -83,18 +66,6 @@ gitplex.sourceview = {}, 10);}- $sourceView.find(">.comment").each(function() {- var lineNo = $(this).data("lineno");- gitplex.sourceview.placeComment(cm, lineNo, this);- });- if (commentId != -1) {- $comment = $("#pullrequest-comment-" + commentId);- var lineNo = $comment.data("lineno");- pmease.commons.codemirror.centerLine(cm, lineNo);- cm.setCursor(lineNo);- setTimeout(function() {$comment.find(">div").focus();}, 10);- }-$code.mouseover(function(e) {var node = e.target || e.srcElement, $node = $(node);if ($node.hasClass("cm-property") || $node.hasClass("cm-variable") || $node.hasClass("cm-variable-2")@@ -115,35 +86,6 @@ gitplex.sourceview = {pmease.commons.codemirror.mark(cm, mark);},- placeComment: function(cm, lineNo, comment) {- if (typeof cm === "string")- cm = $("#"+ cm + ">.CodeMirror")[0].CodeMirror;- if (typeof comment === "string")- comment = $("<div class='comment'><div id='" + comment + "'></div></div>")[0];- comment.lineWidget = cm.addLineWidget(lineNo, comment, {coverGutter: true});- },-- commentResized: function($comment) {- if (typeof $comment === "string")- $comment = $("#" + $comment);- $comment[0].lineWidget.changed();- var $wrapper = $comment.find(">div");- $wrapper.on("resized", function() {- $comment[0].lineWidget.changed();- });- $wrapper.find("textarea").on("autosize:resized", function(){- $comment[0].lineWidget.changed();- });- $wrapper.on("fullscreen", function() {- // full screen mode is abnormal if we do not do this- $("body").append($wrapper);- });- $wrapper.on("exitFullscreen", function() {- $comment.append($wrapper);- $comment[0].lineWidget.changed();- });- },-blame: function(cm, blameCommits) {if (typeof cm === "string")cm = $("#"+ cm + ">.CodeMirror")[0].CodeMirror;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.htmlindex cabe0284e4..d920923724 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.html@@ -21,7 +21,7 @@<textarea wicket:id="detailCommitMessage" class="detail-commit-message form-control" rows="5"></textarea></div><div class="actions">- <input wicket:id="save" type="submit" class="btn btn-primary" value="Commit"></input>+ <input wicket:id="save" type="button" class="btn btn-primary" value="Commit"></input><input wicket:id="cancel" type="button" class="btn btn-default" value="Cancel"></input></div></form>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.javaindex 62fa923a59..773a6986cb 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java@@ -8,7 +8,6 @@ import org.apache.commons.lang3.StringEscapeUtils;import org.apache.commons.lang3.StringUtils;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.markup.ComponentTag;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;@@ -40,11 +39,12 @@ import com.pmease.commons.git.PathAndContent;import com.pmease.commons.git.exception.NotTreeException;import com.pmease.commons.git.exception.ObjectAlreadyExistException;import com.pmease.commons.git.exception.ObsoleteCommitException;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.gitplex.core.GitPlex;+import com.pmease.gitplex.core.entity.Account;import com.pmease.gitplex.core.entity.Comment;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.PullRequest;-import com.pmease.gitplex.core.entity.Account;import com.pmease.gitplex.core.manager.AccountManager;import com.pmease.gitplex.web.component.diff.blob.BlobDiffPanel;import com.pmease.gitplex.web.component.diff.revision.DiffMode;@@ -200,7 +200,7 @@ public abstract class EditSavePanel extends Panel {}));- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onComponentTag(ComponentTag tag) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/edit-save.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/edit-save.jsindex 9f184ea2ca..469f0e3170 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/edit-save.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/edit-save.js@@ -27,7 +27,7 @@ gitplex.editsave = {},updateSubmitBtnState: function($editSave) {- var $submitBtn = $editSave.find("input[type=submit]");+ var $submitBtn = $editSave.find("input.btn-primary");if ($editSave.data("contentChanged") === true || $editSave.data("pathChanged") === true)$submitBtn.removeAttr("disabled");elsediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/CreateTagPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/CreateTagPanel.javaindex b470ac187c..3acd84cb07 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/CreateTagPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionpicker/CreateTagPanel.java@@ -2,15 +2,15 @@ package com.pmease.gitplex.web.component.revisionpicker;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.form.TextArea;import org.apache.wicket.markup.html.panel.Panel;import org.apache.wicket.model.IModel;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.gitplex.core.GitPlex;-import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.Account;+import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.manager.AccountManager;@SuppressWarnings("serial")@@ -53,7 +53,7 @@ abstract class CreateTagPanel extends Panel {}}));- form.add(new AjaxButton("create") {+ form.add(new SubmitTypeAjaxButton("create") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/admin/MailSettingPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/admin/MailSettingPage.javaindex 54866db789..c247feef65 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/admin/MailSettingPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/admin/MailSettingPage.java@@ -3,7 +3,6 @@ package com.pmease.gitplex.web.page.admin;import java.io.Serializable;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.markup.html.form.Form;import org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -11,6 +10,7 @@ import org.slf4j.LoggerFactory;import com.google.common.collect.Sets;import com.pmease.commons.wicket.behavior.testform.TestFormBehavior;import com.pmease.commons.wicket.behavior.testform.TestResult;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.editable.BeanContext;import com.pmease.commons.wicket.editable.BeanEditor;import com.pmease.gitplex.core.GitPlex;@@ -50,7 +50,7 @@ public class MailSettingPage extends AdministrationPage {};form.add(editor = BeanContext.editBean("editor", mailSetting));- form.add(new AjaxSubmitLink("test") {+ form.add(new SubmitTypeAjaxSubmitLink("test") {private TestFormBehavior testBehavior;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.javaindex bf121aa971..18d64096c0 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java@@ -20,7 +20,6 @@ import org.apache.wicket.ajax.IAjaxIndicatorAware;import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.ComponentTag;import org.apache.wicket.markup.head.CssHeaderItem;@@ -55,6 +54,7 @@ import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;import com.pmease.commons.wicket.behavior.OnTypingDoneBehavior;import com.pmease.commons.wicket.behavior.TooltipBehavior;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.commons.wicket.component.clearable.ClearableTextField;import com.pmease.commons.wicket.component.modal.ModalLink;import com.pmease.gitplex.core.GitPlex;@@ -358,7 +358,7 @@ public class DepotBranchesPage extends DepotPage {nameInput.setOutputMarkupId(true);form.add(newRevisionPicker());- form.add(new AjaxButton("create") {+ form.add(new SubmitTypeAjaxButton("create") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.javaindex 04794d29d5..ecb58ec7b5 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java@@ -15,7 +15,6 @@ import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;@@ -47,6 +46,7 @@ import com.pmease.commons.util.StringUtils;import com.pmease.commons.util.concurrent.PrioritizedCallable;import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;import com.pmease.commons.wicket.assets.clearable.ClearableResourceReference;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.component.DepotAndRevision;@@ -227,7 +227,7 @@ public class DepotCommitsPage extends DepotPage {}).add(new QueryAssistBehavior(depotModel)));- queryForm.add(new AjaxButton("submit") {});+ queryForm.add(new SubmitTypeAjaxButton("submit") {});queryForm.setOutputMarkupId(true);add(queryForm);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.htmlindex 72c2bdf3b7..53d20363a9 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.html@@ -2,7 +2,6 @@<div id="repo-file"><div class="head clearfix"><a wicket:id="revisionPicker" class="revision-picker pull-left"></a>- <div wicket:id="commentContext" class="comment-context pull-left"><i class="fa fa-comments"></i></div><div wicket:id="fileNavigator" class="file-navigator pull-left"></div><div class="operations"><span wicket:id="instantSearch"></span>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.javaindex d0cad3a0c6..d68de6a72a 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/DepotFilePage.java@@ -52,7 +52,6 @@ import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.lang.extractors.TokenPosition;import com.pmease.commons.wicket.assets.closestdescendant.ClosestDescendantResourceReference;import com.pmease.commons.wicket.assets.cookies.CookiesResourceReference;-import com.pmease.commons.wicket.behavior.TooltipBehavior;import com.pmease.commons.wicket.component.menu.MenuItem;import com.pmease.commons.wicket.component.menu.MenuLink;import com.pmease.commons.wicket.component.modal.ModalLink;@@ -89,8 +88,6 @@ import com.pmease.gitplex.web.page.depot.DepotPage;import com.pmease.gitplex.web.page.depot.NoCommitsPage;import com.pmease.gitplex.web.websocket.PullRequestChangeRenderer;-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig.Placement;import de.agilecoders.wicket.extensions.markup.html.bootstrap.jqueryui.JQueryUIJavaScriptReference;@SuppressWarnings("serial")@@ -163,8 +160,6 @@ public class DepotFilePage extends DepotPage implements BlobViewContext {private Mode mode;- private Component commentContext;-private Component revisionIndexing;private WebMarkupContainer searchResultContainer;@@ -327,37 +322,6 @@ public class DepotFilePage extends DepotPage implements BlobViewContext {newRevisionPicker(null);- add(commentContext = new WebMarkupContainer("commentContext") {-- @Override- protected void onConfigure() {- super.onConfigure();-- setVisible(getPullRequest() != null);- }-- @Override- protected void onInitialize() {- super.onInitialize();-- add(new TooltipBehavior(new AbstractReadOnlyModel<String>() {-- @Override- public String getObject() {- PullRequest request = getPullRequest();- String tooltip = String.format("Inline comments added/displayed in "- + "this commit belong to pull request #%d (%s)",- request.getId(), request.getTitle());- return tooltip;- }-- }, new TooltipConfig().withPlacement(Placement.bottom)));-- setOutputMarkupPlaceholderTag(true);- }-- });-newFileNavigator(null);add(revisionIndexing = new WebMarkupContainer("revisionIndexing") {@@ -724,8 +688,6 @@ public class DepotFilePage extends DepotPage implements BlobViewContext {newRevisionPicker(target);- target.add(commentContext);-newFileNavigator(target);target.add(revisionIndexing);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/RequestDetailPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/RequestDetailPage.javaindex 78b76beb0d..dbd9d4ad88 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/RequestDetailPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/RequestDetailPage.java@@ -25,7 +25,6 @@ import org.apache.wicket.RestartResponseException;import org.apache.wicket.Session;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.event.IEvent;import org.apache.wicket.markup.ComponentTag;@@ -53,6 +52,7 @@ import com.google.common.base.Preconditions;import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.loader.InheritableThreadLocalData;import com.pmease.commons.wicket.component.DropdownLink;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.commons.wicket.component.backtotop.BackToTop;import com.pmease.commons.wicket.component.tabbable.PageTab;import com.pmease.commons.wicket.component.tabbable.PageTabLink;@@ -197,7 +197,7 @@ public abstract class RequestDetailPage extends PullRequestPage {}));- form.add(new AjaxButton("save") {+ form.add(new SubmitTypeAjaxButton("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {@@ -688,7 +688,7 @@ public abstract class RequestDetailPage extends PullRequestPage {}}form.add(new NotificationPanel("feedback", form));- form.add(new AjaxButton("submit") {+ form.add(new SubmitTypeAjaxButton("submit") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.htmlindex cf3f7c565f..8a4449e617 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.html@@ -21,9 +21,6 @@<i class="fa fa-warning"></i> Page is outdated, click to refresh.</a></div>- <div wicket:id="noCommentContextAlert" class="no-comment-context alert alert-warning">- <i class="fa fa-warning"></i> <a wicket:id="link"></a>- </div><div wicket:id="noIntegrationPreviewAlert" class="no-integration-preview alert alert-warning"></div></div></div>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.javaindex 683aa8021c..ce19667b07 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java@@ -30,7 +30,6 @@ import org.apache.wicket.markup.html.list.ListView;import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.model.IModel;import org.apache.wicket.model.LoadableDetachableModel;-import org.apache.wicket.model.Model;import org.apache.wicket.request.cycle.RequestCycle;import org.apache.wicket.request.mapper.parameter.PageParameters;import org.apache.wicket.request.resource.CssResourceReference;@@ -52,7 +51,6 @@ import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.PullRequest;import com.pmease.gitplex.core.entity.PullRequestUpdate;import com.pmease.gitplex.core.entity.component.IntegrationPreview;-import com.pmease.gitplex.web.component.comment.InlineCommentLink;import com.pmease.gitplex.web.component.comment.event.CommentRemoved;import com.pmease.gitplex.web.component.diff.revision.RevisionDiffPanel;import com.pmease.gitplex.web.component.diff.revision.option.DiffOptionPanel;@@ -528,12 +526,6 @@ public class RequestComparePage extends RequestDetailPage {noIntegrationPreviewAlert.setEscapeModelStrings(false);compareHead.add(noIntegrationPreviewAlert);- WebMarkupContainer noCommentContextAlert = new WebMarkupContainer("noCommentContextAlert");- noCommentContextAlert.setVisible(state.commentId != null && oldCommitHash.equals(newCommitHash));- noCommentContextAlert.add(new InlineCommentLink("link", commentModel,- Model.of("Commented line is no longer in diff scope, click to display in file view.")));- compareHead.add(noCommentContextAlert);-newCompareResult(null);}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.htmldeleted file mode 100644index f808251706..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.html+++ /dev/null@@ -1,3 +0,0 @@-<wicket:panel>- <div wicket:id="content" class="comment"></div>-</wicket:panel>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.javadeleted file mode 100644index e23ff6d99f..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentActivityPanel.java+++ /dev/null@@ -1,68 +0,0 @@-package com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.overview;--import org.apache.wicket.Component;-import org.apache.wicket.model.AbstractReadOnlyModel;-import org.apache.wicket.model.IModel;-import org.apache.wicket.model.LoadableDetachableModel;--import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.entity.CommentReply;-import com.pmease.gitplex.core.entity.PullRequest;-import com.pmease.gitplex.web.component.comment.CommentPanel;--@SuppressWarnings("serial")-class CommentActivityPanel extends AbstractActivityPanel {-- private final IModel<Comment> commentModel = new LoadableDetachableModel<Comment>(){-- @Override- protected Comment load() {- return ((CommentPullRequest)activity).getComment();- }-- };-- public CommentActivityPanel(String id, CommentPullRequest activity) {- super(id, activity);- }-- @Override- protected void onInitialize() {- super.onInitialize();-- add(new CommentPanel("content", commentModel) {-- @Override- protected Component newAdditionalCommentOperations(String id, final IModel<Comment> commentModel) {- return new SinceChangesLink(id, new AbstractReadOnlyModel<PullRequest>() {-- @Override- public PullRequest getObject() {- return CommentActivityPanel.this.commentModel.getObject().getRequest();- }-- }, CommentActivityPanel.this.commentModel.getObject().getDate(), "Changes since this comment");- }-- @Override- protected Component newAdditionalReplyOperations(String id, CommentReply reply) {- return new SinceChangesLink(id, new AbstractReadOnlyModel<PullRequest>() {-- @Override- public PullRequest getObject() {- return commentModel.getObject().getRequest();- }-- }, reply.getDate(), "Changes since this reply");- }-- });- }-- @Override- protected void onDetach() {- commentModel.detach();- super.onDetach();- }--}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentPullRequest.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentPullRequest.javadeleted file mode 100644index e4e2cbb361..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/CommentPullRequest.java+++ /dev/null@@ -1,44 +0,0 @@-package com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.overview;--import java.util.Date;--import org.apache.wicket.markup.html.panel.Panel;--import com.pmease.commons.hibernate.dao.Dao;-import com.pmease.gitplex.core.GitPlex;-import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.core.entity.Account;--@SuppressWarnings("serial")-class CommentPullRequest extends AbstractRenderableActivity {-- private final Long commentId;-- @Override- public Date getDate() {- return getComment().getDate();- }-- @Override- public Account getUser() {- return getComment().getUser();- }-- public CommentPullRequest(Comment comment) {- super(comment.getRequest(), comment.getUser(), comment.getDate());- this.commentId = comment.getId();- }-- @Override- public Panel render(String panelId) {- if (getComment().getInlineInfo() != null)- return new InlineCommentActivityPanel(panelId, this);- else- return new CommentActivityPanel(panelId, this);- }-- public Comment getComment() {- return GitPlex.getInstance(Dao.class).load(Comment.class, commentId);- }--}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.htmldeleted file mode 100644index 4e5430adc2..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.html+++ /dev/null@@ -1,6 +0,0 @@-<wicket:panel>- <div wicket:id="content" class="inline-comment"></div>- <wicket:fragment wicket:id="actionFrag">- added inline comment on file <a wicket:id="fileLink" class="file"></a>- </wicket:fragment>-</wicket:panel>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.javadeleted file mode 100644index 48870a960e..0000000000--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/InlineCommentActivityPanel.java+++ /dev/null@@ -1,52 +0,0 @@-package com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.overview;--import org.apache.wicket.Component;-import org.apache.wicket.markup.html.panel.Fragment;-import org.apache.wicket.model.IModel;-import org.apache.wicket.model.LoadableDetachableModel;-import org.apache.wicket.model.Model;--import com.pmease.gitplex.core.entity.Comment;-import com.pmease.gitplex.web.component.comment.CommentPanel;-import com.pmease.gitplex.web.component.comment.InlineCommentLink;--@SuppressWarnings("serial")-class InlineCommentActivityPanel extends AbstractActivityPanel {-- private final IModel<Comment> commentModel = new LoadableDetachableModel<Comment>(){-- @Override- protected Comment load() {- return ((CommentPullRequest)activity).getComment();- }-- };-- public InlineCommentActivityPanel(String id, CommentPullRequest activity) {- super(id, activity);- }-- @Override- protected void onInitialize() {- super.onInitialize();-- add(new CommentPanel("content", commentModel) {-- @Override- protected Component newActionComponent(String id) {- Fragment fragment = new Fragment(id, "actionFrag", InlineCommentActivityPanel.this);- String filePath = commentModel.getObject().getInlineInfo().getBlobIdent().path;- fragment.add(new InlineCommentLink("fileLink", commentModel, Model.of(filePath)));-- return fragment;- }-- });- }-- @Override- protected void onDetach() {- commentModel.detach();- super.onDetach();- }-}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/OpenActivityPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/OpenActivityPanel.javaindex 4ae2002c98..8fe7753101 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/OpenActivityPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/OpenActivityPanel.java@@ -6,7 +6,6 @@ import org.apache.commons.lang3.StringUtils;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.form.Form;@@ -19,6 +18,7 @@ import org.hibernate.StaleObjectStateException;import com.google.common.base.Preconditions;import com.pmease.commons.hibernate.dao.Dao;import com.pmease.commons.wicket.ajaxlistener.ConfirmLeaveListener;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.component.markdownviewer.MarkdownViewer;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.PullRequest;@@ -118,7 +118,7 @@ class OpenActivityPanel extends AbstractActivityPanel {Model.of(requestModel.getObject().getDescription()));form.add(input);- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onError(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.htmlindex dd9a3f8fde..3b6efa593a 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.html@@ -9,15 +9,6 @@<td wicket:id="detail" class="detail"></td></tr></table>- <div wicket:id="addComment" class="add-comment">- <form wicket:id="form" class="leave-confirm">- <div wicket:id="feedback"></div>- <textarea wicket:id="input" class="form-control" rows="5" placeholder="Leave a comment"></textarea>- <div class="actions">- <button wicket:id="comment" class="dirty-aware btn btn-primary">Comment</button>- </div>- </form>- </div></td><td class="info"><div class="well">diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.javaindex 0e9fe0a196..69fa49e24d 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/RequestOverviewPage.java@@ -10,7 +10,6 @@ import org.apache.wicket.MetaDataKey;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;import org.apache.wicket.event.Broadcast;@@ -35,12 +34,9 @@ import org.apache.wicket.request.resource.CssResourceReference;import com.google.common.base.Preconditions;import com.pmease.commons.hibernate.dao.Dao;-import com.pmease.commons.loader.InheritableThreadLocalData;import com.pmease.commons.wicket.behavior.TooltipBehavior;-import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior.PageId;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.Account;-import com.pmease.gitplex.core.entity.Comment;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.PullRequest;import com.pmease.gitplex.core.entity.PullRequest.IntegrationStrategy;@@ -52,7 +48,6 @@ import com.pmease.gitplex.core.entity.PullRequestWatch;import com.pmease.gitplex.core.entity.Review;import com.pmease.gitplex.core.entity.ReviewInvitation;import com.pmease.gitplex.core.manager.AccountManager;-import com.pmease.gitplex.core.manager.CommentManager;import com.pmease.gitplex.core.manager.PullRequestManager;import com.pmease.gitplex.core.security.ObjectPermission;import com.pmease.gitplex.core.security.SecurityUtils;@@ -137,7 +132,7 @@ public class RequestOverviewPage extends RequestDetailPage {if (row.get(DETAIL_ID) == null)row.add(activity.render(DETAIL_ID));- if (activity instanceof OpenPullRequest || activity instanceof CommentPullRequest)+ if (activity instanceof OpenPullRequest)row.add(AttributeAppender.append("class", " discussion"));elserow.add(AttributeAppender.append("class", " non-discussion"));@@ -177,9 +172,6 @@ public class RequestOverviewPage extends RequestDetailPage {for (PullRequestUpdate update: request.getUpdates())renderableActivities.add(new UpdatePullRequest(update));- for (Comment comment: request.getComments())- renderableActivities.add(new CommentPullRequest(comment));-for (PullRequestReference reference: request.getReferencedBy()) {renderableActivities.add(new ReferencePullRequest(request, reference.getUser(),reference.getDate(), reference.getReferencedBy()));@@ -214,7 +206,7 @@ public class RequestOverviewPage extends RequestDetailPage {return -1;else if (o1.getDate().after(o2.getDate()))return 1;- else if (o1 instanceof OpenPullRequest || o1 instanceof CommentPullRequest)+ else if (o1 instanceof OpenPullRequest)return -1;elsereturn 1;@@ -326,45 +318,6 @@ public class RequestOverviewPage extends RequestDetailPage {form.add(new NotificationPanel("feedback", input));- form.add(new AjaxSubmitLink("comment") {-- @Override- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {- super.onSubmit(target, form);-- Comment comment = new Comment();- comment.setRequest(getPullRequest());- comment.setUser(GitPlex.getInstance(AccountManager.class).getCurrent());- comment.setContent(input.getModelObject());- InheritableThreadLocalData.set(new PageId(getPage().getPageId()));- try {- GitPlex.getInstance(CommentManager.class).save(comment, true);- } finally {- InheritableThreadLocalData.clear();- }- input.setModelObject("");-- target.add(addComment);-- @SuppressWarnings("deprecation")- Component lastActivityRow = activitiesView.get(activitiesView.size()-1);- Component newActivityRow = newActivityRow(activitiesView.newChildId(), new CommentPullRequest(comment));- activitiesView.add(newActivityRow);-- String script = String.format("$(\"<tr id='%s'></tr>\").insertAfter('#%s');",- newActivityRow.getMarkupId(), lastActivityRow.getMarkupId());- target.prependJavaScript(script);- target.add(newActivityRow);- }-- @Override- protected void onError(AjaxRequestTarget target, Form<?> form) {- super.onError(target, form);- target.add(form);- }-- });-add(newIntegrationStrategyContainer());add(newAssigneeContainer());add(newReviewersContainer());diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.htmlindex cca4096421..0b54cd42bb 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.html@@ -7,7 +7,7 @@</div><div wicket:id="description" class="gate-keeper-description"></div></div>- <form wicket:id="form" class="leave-confirm">+ <form wicket:id="form" onsubmit="return false" class="leave-confirm"><div wicket:id="feedback" class="feedback"></div><div wicket:id="beanEditor" class="modal-body"></div><div class="modal-footer">diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.javaindex 029f3686d6..d1eba6b362 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/gatekeeper/GateKeeperEditor.java@@ -3,13 +3,14 @@ package com.pmease.gitplex.web.page.depot.setting.gatekeeper;import org.apache.commons.lang3.SerializationUtils;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.behavior.AttributeAppender;+import org.apache.wicket.markup.ComponentTag;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.panel.Panel;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.editable.BeanContext;import com.pmease.commons.wicket.editable.EditableUtils;import com.pmease.gitplex.core.gatekeeper.GateKeeper;@@ -51,7 +52,7 @@ abstract class GateKeeperEditor extends Panel {});- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {@@ -59,6 +60,12 @@ abstract class GateKeeperEditor extends Panel {onSave(target, gateKeeper);}+ @Override+ protected void onComponentTag(ComponentTag tag) {+ super.onComponentTag(tag);+ tag.getAttributes().put("type", "submit");+ }+@Overrideprotected void onError(AjaxRequestTarget target, Form<?> form) {super.onError(target, form);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/general/GeneralSettingPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/general/GeneralSettingPage.javaindex eb2075eb75..6ac91d60df 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/general/GeneralSettingPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/general/GeneralSettingPage.java@@ -8,13 +8,13 @@ import org.apache.wicket.Component;import org.apache.wicket.Session;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.feedback.FencedFeedbackPanel;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.model.IModel;import org.apache.wicket.request.mapper.parameter.PageParameters;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.commons.wicket.component.modal.ModalPanel;import com.pmease.commons.wicket.component.select2.ResponseFiller;import com.pmease.commons.wicket.editable.BeanContext;@@ -144,7 +144,7 @@ public class GeneralSettingPage extends DepotSettingPage {form.add(new FencedFeedbackPanel("feedback", form));- form.add(new AjaxButton("transfer") {+ form.add(new SubmitTypeAjaxButton("transfer") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/integrationpolicy/IntegrationPolicyEditor.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/integrationpolicy/IntegrationPolicyEditor.javaindex 6bdc2327d2..f8ced61a74 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/integrationpolicy/IntegrationPolicyEditor.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/setting/integrationpolicy/IntegrationPolicyEditor.java@@ -2,10 +2,10 @@ package com.pmease.gitplex.web.page.depot.setting.integrationpolicy;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.panel.Panel;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.editable.BeanContext;import com.pmease.gitplex.core.entity.component.IntegrationPolicy;@@ -31,7 +31,7 @@ abstract class IntegrationPolicyEditor extends Panel {Form<?> form = new Form<Void>("form");form.add(new NotificationPanel("feedback", form));form.add(BeanContext.editBean("editor", policy));- form.add(new AjaxSubmitLink("save") {+ form.add(new SubmitTypeAjaxSubmitLink("save") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.javaindex 986bf780d6..01600c1c88 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java@@ -9,7 +9,6 @@ import org.apache.wicket.RestartResponseException;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.ajax.markup.html.form.AjaxButton;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;@@ -44,6 +43,7 @@ import com.pmease.commons.git.GitUtils;import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;import com.pmease.commons.wicket.behavior.OnTypingDoneBehavior;+import com.pmease.commons.wicket.component.SubmitTypeAjaxButton;import com.pmease.commons.wicket.component.clearable.ClearableTextField;import com.pmease.commons.wicket.component.modal.ModalLink;import com.pmease.gitplex.core.entity.Depot;@@ -173,7 +173,7 @@ public class DepotTagsPage extends DepotPage {}));form.add(newRevisionPicker());- form.add(new AjaxButton("create") {+ form.add(new SubmitTypeAjaxButton("create") {@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/ForgetPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/ForgetPage.javaindex 476040e8d5..daaaf69c67 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/ForgetPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/ForgetPage.java@@ -5,7 +5,6 @@ import java.util.Arrays;import org.apache.commons.lang3.RandomStringUtils;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;import org.apache.wicket.markup.html.form.Form;@@ -16,13 +15,14 @@ import org.slf4j.LoggerFactory;import com.pmease.commons.wicket.behavior.testform.TestFormBehavior;import com.pmease.commons.wicket.behavior.testform.TestResult;+import com.pmease.commons.wicket.component.SubmitTypeAjaxSubmitLink;import com.pmease.commons.wicket.editable.BeanContext;import com.pmease.commons.wicket.editable.annotation.Editable;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.Account;+import com.pmease.gitplex.core.manager.AccountManager;import com.pmease.gitplex.core.manager.ConfigManager;import com.pmease.gitplex.core.manager.MailManager;-import com.pmease.gitplex.core.manager.AccountManager;import com.pmease.gitplex.web.page.base.BasePage;import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;@@ -41,7 +41,7 @@ public class ForgetPage extends BasePage {form.add(new NotificationPanel("feedback", form));form.add(BeanContext.editBean("editor", bean));- form.add(new AjaxSubmitLink("reset") {+ form.add(new SubmitTypeAjaxSubmitLink("reset") {private TestFormBehavior testBehavior;@Overridediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.htmlindex 795b443f3a..9c72343fc8 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html@@ -1,3 +1,6 @@<wicket:extend>- <a wicket:id="test">test</a>+ <form wicket:id="form" onsubmit="return false;">+ <input wicket:id="name"></input>+ <input wicket:id="save" type="button" value="Save"></input>+ </form></wicket:extend>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.javaindex fa1c8b98b2..d829e4fa0e 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java@@ -1,39 +1,58 @@package com.pmease.gitplex.web.page.test;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;-import org.apache.wicket.ajax.markup.html.AjaxLink;-import org.apache.wicket.behavior.AttributeAppender;+import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;+import org.apache.wicket.markup.html.form.Form;+import org.apache.wicket.markup.html.form.TextField;+import org.apache.wicket.model.IModel;import com.pmease.gitplex.web.page.base.BasePage;@SuppressWarnings("serial")public class TestPage extends BasePage {+ private String name;+@Overrideprotected void onInitialize() {super.onInitialize();- add(new AjaxLink<Void>("test") {+ Form<Void> form = new Form<Void>("form") {@Override- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {- super.updateAjaxAttributes(attributes);- attributes.setPreventDefault(true);+ protected void onSubmit() {+ super.onSubmit();+ System.out.println("form submit: " + name);}++ };+ form.add(new TextField<String>("name", new IModel<String>() {@Override- protected void onInitialize() {- super.onInitialize();- add(AttributeAppender.replace("href", "http://www.baidu.com"));+ public void detach() {}@Override- public void onClick(AjaxRequestTarget target) {- System.out.println("hello world");+ public String getObject() {+ return name;}+ @Override+ public void setObject(String object) {+ name = object;+ }++ }));+ form.add(new AjaxSubmitLink("save") {++ @Override+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {+ super.onSubmit(target, form);+ System.out.println("button submit: " + name);+ }+});+ add(form);}}