Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine493e0b16a443
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
index ea8574b7f3..fcf35efd71 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
@@ -65,6 +65,15 @@ textarea {
list-style: none;
}
+.noselect {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
/* Table navigator */
table .navigator {
border-radius: 4px 4px 4px 4px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/CommentAndPos.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/CommentAndPos.java
deleted file mode 100644
index 5d06f1505d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/CommentAndPos.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.pmease.gitplex.web.component.diff.blob.text;
-
-import java.io.Serializable;
-
-import com.pmease.gitplex.core.entity.CodeComment;
-
-class CommentAndPos implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- CodeComment comment;
-
- int oldLineNo;
-
- int newLineNo;
-
-}
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.java
index 99b0664931..583b493f4f 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
@@ -236,12 +236,25 @@ public class TextDiffPanel extends Panel {
private String renderDiffs() {
int contextSize = CodeComment.DIFF_CONTEXT_SIZE;
StringBuilder builder = new StringBuilder();
- builder.append("<colgroup><col width='40'></col>");
- if (diffMode == DiffMode.UNIFIED)
- builder.append("<col width='40'></col>");
- else
- builder.append("</col><col></col><col width=40></col>");
- builder.append("<col></col></colgroup>");
+ if (diffMode == DiffMode.UNIFIED) {
+ builder.append(""
+ + "<colgroup>"
+ + "<col width='40'></col>"
+ + "<col width='40'></col>"
+ + "<col width='15'></col>"
+ + "<col></col>"
+ + "</colgroup>");
+ } else {
+ builder.append(""
+ + "<colgroup>"
+ + "<col width='40'></col>"
+ + "<col width='15'></col>"
+ + "<col></col>"
+ + "<col width='40'></col>"
+ + "<col width='15'></col>"
+ + "<col></col>"
+ + "</colgroup>");
+ }
for (int i=0; i<change.getDiffBlocks().size(); i++) {
DiffBlock<List<CmToken>> block = change.getDiffBlocks().get(i);
if (block.getOperation() == Operation.EQUAL) {
@@ -314,95 +327,103 @@ public class TextDiffPanel extends Panel {
if (lastContextSize != 0)
builder.append("<tr class='code expanded'>");
else
- builder.append("<tr class='code intrinsic'>");
+ builder.append("<tr class='code non-expanded'>");
int oldLineNo = block.getOldStart() + lineIndex;
int newLineNo = block.getNewStart() + lineIndex;
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("<td class='content old").append(oldLineNo).append(" new").append(newLineNo).append("'>");
- contentBuilder.append("<span class='operation'>&nbsp;</span>");
for (CmToken token: block.getUnits().get(lineIndex)) {
contentBuilder.append(token.toHtml(Operation.EQUAL));
}
contentBuilder.append("</td>");
if (diffMode == DiffMode.UNIFIED) {
- builder.append("<td class='number'>").append(oldLineNo+1).append("</td>");
- builder.append("<td class='number'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect'>&nbsp;</td>");
builder.append(contentBuilder);
} else {
- builder.append("<td class='number'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect'>&nbsp;</td>");
builder.append(contentBuilder);
- builder.append("<td class='number'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect'>&nbsp;</td>");
builder.append(contentBuilder);
}
builder.append("</tr>");
}
private void appendInsert(StringBuilder builder, DiffBlock<List<CmToken>> block, int lineIndex) {
- builder.append("<tr class='code intrinsic'>");
+ builder.append("<tr class='code non-expanded'>");
int newLineNo = block.getNewStart() + lineIndex;
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("<td class='content new new").append(newLineNo).append("'>");
- contentBuilder.append("<span class='operation'>+</span>");
List<CmToken> tokens = block.getUnits().get(lineIndex);
for (int i=0; i<tokens.size(); i++)
contentBuilder.append(tokens.get(i).toHtml(Operation.EQUAL));
contentBuilder.append("</td>");
if (diffMode == DiffMode.UNIFIED) {
- builder.append("<td class='number new'>&nbsp;</td>");
- builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect new'>&nbsp;</td>");
+ builder.append("<td class='number noselect new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect new'>+</td>");
builder.append(contentBuilder);
} else {
- builder.append("<td class='number'>&nbsp;</td><td class='content'>&nbsp;</td>");
- builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect'>&nbsp;</td>");
+ builder.append("<td class='operation noselect'>&nbsp;</td>");
+ builder.append("<td class='content noselect'>&nbsp;</td>");
+ builder.append("<td class='number noselect new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect new'>+</td>");
builder.append(contentBuilder);
}
builder.append("</tr>");
}
private void appendDelete(StringBuilder builder, DiffBlock<List<CmToken>> block, int lineIndex) {
- builder.append("<tr class='code intrinsic'>");
+ builder.append("<tr class='code non-expanded'>");
int oldLineNo = block.getOldStart() + lineIndex;
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("<td class='content old old").append(oldLineNo).append("'>");
- contentBuilder.append("<span class='operation'>-</span>");
List<CmToken> tokens = block.getUnits().get(lineIndex);
for (int i=0; i<tokens.size(); i++)
contentBuilder.append(tokens.get(i).toHtml(Operation.EQUAL));
contentBuilder.append("</td>");
if (diffMode == DiffMode.UNIFIED) {
- builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");
- builder.append("<td class='number old'>&nbsp;</td>");
+ builder.append("<td class='number noselect old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect old'>&nbsp;</td>");
+ builder.append("<td class='operation noselect old'>-</td>");
builder.append(contentBuilder);
} else {
- builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect new'>-</td>");
builder.append(contentBuilder);
- builder.append("<td class='number'>&nbsp;</td><td class='content'>&nbsp;</td>");
+ builder.append("<td class='number noselect'>&nbsp;</td>");
+ builder.append("<td class='operation noselect'>&nbsp;</td>");
+ builder.append("<td class='content noselect'>&nbsp;</td>");
}
builder.append("</tr>");
}
private void appendSideBySide(StringBuilder builder, DiffBlock<List<CmToken>> deleteBlock,
DiffBlock<List<CmToken>> insertBlock, int deleteLineIndex, int insertLineIndex) {
- builder.append("<tr class='code intrinsic'>");
+ builder.append("<tr class='code non-expanded'>");
int oldLineNo = deleteBlock.getOldStart()+deleteLineIndex;
- builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect old'>-</td>");
builder.append("<td class='content old old").append(oldLineNo).append("'>");
- builder.append("<span class='operation'>-</span>");
for (CmToken token: deleteBlock.getUnits().get(deleteLineIndex))
builder.append(token.toHtml(Operation.EQUAL));
builder.append("</td>");
int newLineNo = insertBlock.getNewStart()+insertLineIndex;
- builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect new'>+</td>");
builder.append("<td class='content new new").append(newLineNo).append("'>");
- builder.append("<span class='operation'>+</span>");
for (CmToken token: insertBlock.getUnits().get(insertLineIndex))
builder.append(token.toHtml(Operation.EQUAL));
builder.append("</td>");
@@ -413,24 +434,24 @@ public class TextDiffPanel extends Panel {
private void appendModification(StringBuilder builder, DiffBlock<List<CmToken>> deleteBlock,
DiffBlock<List<CmToken>> insertBlock, int deleteLineIndex, int insertLineIndex,
List<DiffBlock<CmToken>> tokenDiffs) {
- builder.append("<tr class='code intrinsic'>");
+ builder.append("<tr class='code non-expanded'>");
int oldLineNo = deleteBlock.getOldStart() + deleteLineIndex;
int newLineNo = insertBlock.getNewStart() + insertLineIndex;
if (diffMode == DiffMode.UNIFIED) {
- 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='number noselect old new'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect old new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect old new'>*</td>");
builder.append("<td class='content old new old").append(oldLineNo).append(" new").append(newLineNo).append("'>");
- builder.append("<span class='operation'>*</span>");
for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {
for (CmToken token: tokenBlock.getUnits())
builder.append(token.toHtml(tokenBlock.getOperation()));
}
builder.append("</td>");
} else {
- builder.append("<td class='number old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='number noselect old'>").append(oldLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect old'>-</td>");
builder.append("<td class='content old old").append(oldLineNo).append("'>");
- builder.append("<span class='operation'>-</span>");
for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {
for (CmToken token: tokenBlock.getUnits()) {
if (tokenBlock.getOperation() != Operation.INSERT)
@@ -439,9 +460,9 @@ public class TextDiffPanel extends Panel {
}
builder.append("</td>");
- builder.append("<td class='number new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='number noselect new'>").append(newLineNo+1).append("</td>");
+ builder.append("<td class='operation noselect new'>+</td>");
builder.append("<td class='content new new").append(newLineNo).append("'>");
- builder.append("<span class='operation'>+</span>");
for (DiffBlock<CmToken> tokenBlock: tokenDiffs) {
for (CmToken token: tokenBlock.getUnits()) {
if (tokenBlock.getOperation() != Operation.DELETE)
@@ -461,12 +482,12 @@ public class TextDiffPanel extends Panel {
if (diffMode == DiffMode.UNIFIED) {
builder.append("<td colspan='2' class='expander'><a title='Show more lines' href=\"")
.append(script).append("\"><i class='fa fa-sort'></i></a></td>");
- builder.append("<td class='skipped'><i class='fa fa-ellipsis-h'></i> skipped ")
+ builder.append("<td colspan='2' class='skipped noselect'><i class='fa fa-ellipsis-h'></i> skipped ")
.append(skippedLines).append(" lines <i class='fa fa-ellipsis-h'></i></td>");
} else {
builder.append("<td class='expander'><a title='Show more lines' href=\"").append(script)
.append("\"><i class='fa fa-sort'></i></a></td>");
- builder.append("<td class='skipped' colspan='3'><i class='fa fa-ellipsis-h'></i> skipped ")
+ builder.append("<td class='skipped noselect' colspan='5'><i class='fa fa-ellipsis-h'></i> skipped ")
.append(skippedLines).append(" lines <i class='fa fa-ellipsis-h'></i></td>");
}
builder.append("</tr>");
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.css
index 3a86ec1b41..2ff070d95e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.css
@@ -23,7 +23,7 @@
/*
* have to use relative here as otherwise the last table row will have problem
- * focusing on expander or comment link. This relates to negative margin top
+ * focusing on expander link. This relates to negative margin top
* specified for change class in revision diff panel
*/
.text-diff>.body>tbody>tr>td {
@@ -42,7 +42,7 @@
font-size: 12px;
color: #BBB;
}
-.text-diff>.body>tbody>tr>td.content {
+.text-diff>.body>tbody>tr>td.operation {
border-left: 1px solid #EEE;
}
.text-diff>.body>tbody>tr>td:FIRST-CHILD {
@@ -82,6 +82,9 @@
border-left: 1px solid #f1c0c0;
}
.text-diff>.body>tbody>tr>td.old.content {
+ background: #ffecec;
+}
+.text-diff>.body>tbody>tr>td.old.operation {
border-left: 1px solid #f1c0c0;
background: #ffecec;
}
@@ -93,6 +96,9 @@
border-left: 1px solid #c1e9c1;
}
.text-diff>.body>tbody>tr>td.new.content {
+ background: #eaffea;
+}
+.text-diff>.body>tbody>tr>td.new.operation {
border-left: 1px solid #c1e9c1;
background: #eaffea;
}
@@ -104,6 +110,9 @@
border-left: 1px solid #EBD049;
}
.text-diff>.body>tbody>tr>td.old.new.content {
+ background: #FAF3D0;
+}
+.text-diff>.body>tbody>tr>td.old.new.operation {
border-left: 1px solid #EBD049;
background: #FAF3D0;
}
@@ -114,65 +123,19 @@
white-space: pre-wrap;
word-wrap: break-word;
}
-.text-diff>.body>tbody>tr>td.content>.operation {
+.text-diff>.body>tbody>tr>td.operation {
font-weight: bold;
- margin: 0 2px 0 8px;
+ padding: 0 4px 0 4px;
}
-.text-diff>.body>tbody>tr.intrinsic+.expanded>td {
+.text-diff>.body>tbody>tr.non-expanded+.expanded>td {
border-top: 1px solid #E8E8E8;
}
-.text-diff>.body>tbody>tr.expanded+.intrinsic>td {
+.text-diff>.body>tbody>tr.expanded+.non-expanded>td {
border-top: 1px solid #E8E8E8;
}
.text-diff>.body>tbody>tr.expanded>td {
background: #F9F9F9;
}
-.text-diff>.body>tbody>tr>td.content>span.add-comment {
- position: absolute;
- display: none;
-}
-.text-diff>.body>tbody>tr>td.content>span.add-comment>a {
- display: block;
- position: absolute;
- left: -8px;
- border-radius: 3px;
- color: white;
- background: #087AD8;
- z-index: 100;
- line-height: 14px;
- padding: 1px 2px;
- text-decoration: none;
-}
-.text-diff>.body>tbody>tr>td.content>span.add-comment>a:hover {
- font-size: 16px;
- left: -9px;
- top: -1px;
- padding-top: 2px;
-}
-.text-diff>.body>tbody>tr>td.content:hover>span.add-comment,
-.text-diff>.body>tbody>tr>td.number:hover+.content>span.add-comment,
-.text-diff>.body>tbody>tr>td.number:hover+.number+.content>span.add-comment {
- display: inline-block;
-}
-.text-diff>.body>tbody>tr.code+tr.comment>td.content.comment {
- border-top: 1px solid #DDD;
-}
-.text-diff>.body>tbody>tr.comment>td.content.comment {
- white-space: normal;
- word-wrap: normal;
- padding: 12px;
- border-bottom: 1px solid #DDD;
-}
-.text-diff>.body>tbody>tr.comment>td.content.comment.removed {
- font-style: italic;
- font-size: 16px;
-}
-.text-diff>.comment {
- display: none;
-}
-.text-diff .new-comment>.feedback .alert {
- margin-bottom: 8px;
-}
.diff-tokentooltip {
background-color: infobackground;
border: 1px solid black;
diff --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.html
index 795b443f3a..10fc7ca3da 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,12 @@
<wicket:extend>
- <a wicket:id="test">test</a>
+ <table>
+ <tr>
+ <td style="-ms-user-select: none; -webkit-user-select: none;-moz-user-select: -moz-none;user-select:none;">1</td>
+ <td>hello</td>
+ </tr>
+ <tr>
+ <td style="-webkit-user-select: none;-moz-user-select: -moz-none;user-select:none;">2</td>
+ <td>world</td>
+ </tr>
+ </table>
</wicket:extend>
\ No newline at end of file
diff --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.java
index 802b973d32..4eaae411e0 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,10 +1,5 @@
package com.pmease.gitplex.web.page.test;
-import org.apache.wicket.markup.html.link.Link;
-
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.entity.Depot;
-import com.pmease.gitplex.core.manager.DepotManager;
import com.pmease.gitplex.web.page.base.BasePage;
@SuppressWarnings("serial")
@@ -14,15 +9,6 @@ public class TestPage extends BasePage {
protected void onInitialize() {
super.onInitialize();
- add(new Link<Void>("test") {
-
- @Override
- public void onClick() {
- Depot depot = GitPlex.getInstance(DepotManager.class).load(1L);
- depot.getTagRefs();
- }
-
- });
}
}