Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.

Commit e26fbc6

Browse files
committed
Fixed annotation comments. Fixed SVG handling. Fixed deletion of comment replies. Fixed exception during exporting document. Fixed label for distance annotation.
1 parent fd872b1 commit e26fbc6

File tree

8 files changed

+48
-41
lines changed

8 files changed

+48
-41
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.groupdocs</groupId>
2525
<artifactId>groupdocs-annotation</artifactId>
26-
<version>17.10.2</version>
26+
<version>17.10.3</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.fasterxml.jackson.core</groupId>

src/main/java/com/groupdocs/ui/servlet/AddAnnotationServlet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
3131
AnnotationInfo annotation = new ObjectMapper().readValue(request.getInputStream(), AnnotationInfo.class);
3232
annotation.setDocumentGuid(documentId);
3333
CreateAnnotationResult result = imageHandler.createAnnotation(annotation);
34+
imageHandler.createAnnotationReply(result.getId(), "");
3435
new ObjectMapper().writeValue(response.getOutputStream(), result);
3536
}
3637
}

src/main/java/com/groupdocs/ui/servlet/AnnotationServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.groupdocs.annotation.domain.Point;
77
import com.groupdocs.annotation.domain.TextFieldInfo;
88
import com.groupdocs.annotation.domain.results.DeleteAnnotationResult;
9-
import com.groupdocs.annotation.domain.results.MoveAnnotationResult;
109
import com.groupdocs.annotation.domain.results.SaveAnnotationTextResult;
1110
import com.groupdocs.annotation.handler.AnnotationImageHandler;
1211
import com.groupdocs.ui.Utils;
@@ -36,6 +35,7 @@ protected void doDelete(HttpServletRequest request, HttpServletResponse response
3635
String guid = request.getParameter("guid");
3736
long annotationId = imageHandler.getAnnotation(guid).getId();
3837

38+
imageHandler.deleteAnnotationReplies(annotationId);
3939
DeleteAnnotationResult result = imageHandler.deleteAnnotation(annotationId);
4040
new ObjectMapper().writeValue(response.getOutputStream(), result);
4141

src/main/java/com/groupdocs/ui/servlet/DeleteAnnotationServlet.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/java/com/groupdocs/ui/servlet/DownloadAnnotatedServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
2929

3030
InputStream exported;
3131
try (InputStream original = new FileInputStream(Utils.getStoragePath() + "/" + filename)) {
32-
exported = imageHandler.exportAnnotationsToDocument(original, list, document.getDocumentType());
32+
exported = imageHandler.exportAnnotationsToDocument(original, list);
3333
} catch (Exception x) {
3434
throw new RuntimeException(x);
3535
}

src/main/webapp/app.controller.thread.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@
2727
});
2828
};
2929

30+
$scope.saveAnnotationComment = function (item) {
31+
ReplyFactory
32+
.updateMessage(
33+
{
34+
guid: item.replies[0].guid
35+
},
36+
{
37+
message: item.replies[0].message
38+
}
39+
)
40+
.$promise
41+
.then(function (response) {
42+
item.unsaved = false;
43+
});
44+
};
45+
3046
$scope.addReply = function (item) {
3147
RepliesFactory
3248
.put(

src/main/webapp/app.directive.gdxAnnoPage.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
break;
294294
case 'pencil':
295295
ant.type = 4;
296-
ant.svgPath = currentObject.exportSVG().getAttribute('d');
296+
ant.svgPath = extractSvgPathData(currentObject);
297297
break;
298298
case 'point':
299299
ant = angular.merge({}, ant, {
@@ -308,14 +308,13 @@
308308
break;
309309
case 'arrow':
310310
ant.type = 8;
311-
ant.svgPath = currentObject.exportSVG().firstChild.getAttribute('d');
312-
ant.svgPath += " " + currentObject.exportSVG().lastChild.getAttribute('d');
311+
ant.svgPath = extractSvgPathData(currentObject);
313312
break;
314313
case 'distance':
315314
ant = {
316315
type: 12,
317-
svgPath: currentObject.exportSVG().children[0].getAttribute('d') + " " + currentObject.exportSVG().children[1].getAttribute('d') + " " + currentObject.exportSVG().children[2].getAttribute('d'),
318-
text: currentObject.children[3].content,
316+
svgPath: extractSvgPathData(currentObject),
317+
fieldText: currentObject.children[3].content,
319318
box: {
320319
x: currentObject.children[3].position.x,
321320
y: currentObject.children[3].position.y,
@@ -327,7 +326,7 @@
327326
case 'underline':
328327
ant = {
329328
type: 11,
330-
svgPath: currentObject.exportSVG().getAttribute('d'),
329+
svgPath: extractSvgPathData(currentObject),
331330
box: {
332331
x: currentObject.bounds.x,
333332
y: currentObject.bounds.y,
@@ -339,7 +338,7 @@
339338
case 'strikeout':
340339
ant = {
341340
type: 11,
342-
svgPath: currentObject.exportSVG().getAttribute('d'),
341+
svgPath: extractSvgPathData(currentObject),
343342
box: {
344343
x: currentObject.bounds.x,
345344
y: currentObject.bounds.y,
@@ -528,6 +527,24 @@
528527
});
529528
}
530529

530+
function extractSvgPathData(object) {
531+
var svg = object.exportSVG();
532+
var data = '';
533+
534+
if (svg.nodeName === 'path') {
535+
data = object.exportSVG().getAttribute('d')
536+
} else if (svg.nodeName === 'g') {
537+
angular.forEach(svg.children, function (value) {
538+
if (value.nodeName === 'path') {
539+
data += value.getAttribute('d');
540+
data += ' ';
541+
}
542+
});
543+
}
544+
545+
return data;
546+
}
547+
531548
angular.module('GroupDocsAnnotationApp').directive('gdxAnnoPage', main, ['cfpLoadingBar']);
532549

533550
})();

src/main/webapp/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ <h1>GroupDocs.Annotation for Java</h1>
128128
</md-card-header>
129129
<md-card-content>
130130
<md-input-container>
131-
<label ng-show="!selectedAnnotation.fieldText">Comments...</label>
132-
<textarea ng-model="selectedAnnotation.fieldText" ng-change="selectedAnnotation.unsaved=true"
131+
<label ng-show="!selectedAnnotation.replies[0].message">Comments...</label>
132+
<textarea ng-model="selectedAnnotation.replies[0].message" ng-change="selectedAnnotation.unsaved=true"
133133
aria-label="Comments">
134134
</textarea>
135135
</md-input-container>
@@ -140,7 +140,7 @@ <h1>GroupDocs.Annotation for Java</h1>
140140
<md-icon>reply</md-icon>
141141
</md-button>
142142
<md-button class="md-icon-button" aria-label="Save" ng-show="selectedAnnotation.unsaved"
143-
ng-click="saveAnnotationFieldText(selectedAnnotation)">
143+
ng-click="saveAnnotationComment(selectedAnnotation)">
144144
<md-icon>save</md-icon>
145145
</md-button>
146146
<md-button class="md-icon-button" aria-label="Delete"
@@ -149,7 +149,7 @@ <h1>GroupDocs.Annotation for Java</h1>
149149
</md-button>
150150
</md-card-actions>
151151
</md-card>
152-
<md-card ng-repeat="reply in selectedAnnotation.replies">
152+
<md-card ng-repeat="reply in selectedAnnotation.replies" ng-hide="$first">
153153
<md-card-header>
154154
<md-card-avatar>
155155
<md-icon>person</md-icon>

0 commit comments

Comments
 (0)