You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2007/09/12 14:42:31 UTC
svn commit: r574921 - in /incubator/uima/sandbox/trunk/CasEditor: ./
src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/
src/main/java/org/apache/uima/caseditor/editor/
src/main/java/org/apache/uima/caseditor/editor/annotation/ src/main/java/...
Author: twgoetz
Date: Wed Sep 12 05:42:30 2007
New Revision: 574921
URL: http://svn.apache.org/viewvc?rev=574921&view=rev
Log:
Jira UIMA-571: apply UIMA-571.patch.
https://issues.apache.org/jira/browse/UIMA-571
Added:
incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor tests.launch
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java
Modified:
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/property/AnnotationPropertyPage.java
incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyleTest.java
incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializerTest.java
Added: incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor tests.launch
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/UIMA%20Cas%20Editor%20tests.launch?rev=574921&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor tests.launch (added)
+++ incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor tests.launch Wed Sep 12 05:42:30 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/CasEditor"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=CasEditor/src\/test\/java"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CasEditor"/>
+</launchConfiguration>
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java Wed Sep 12 05:42:30 2007
@@ -32,8 +32,19 @@
*/
public enum Style {
+ /**
+ * The background color style.
+ */
+ BACKGROUND,
+
+ /**
+ * The text color style.
+ */
TEXT_COLOR,
+ /**
+ * The token style.
+ */
TOKEN,
/**
@@ -67,11 +78,15 @@
*/
public static final Color DEFAULT_COLOR = new Color(0xff, 0, 0);
- private String mAnnotation;
+ public static final int DEFAULT_LAYER = 0;
+
+ private final String annotation;
+
+ private final Style style;
- private Style mStyle;
+ private final Color color;
- private Color mColor;
+ private final int layer;
/**
* Initialize a new instance.
@@ -82,55 +97,61 @@
* the drawing style
* @param color -
* annotation color
+ *
+ * @param layer - drawing layer
*/
- public AnnotationStyle(String annotation, Style style, Color color) {
- // annoatation
- if (annotation == null) {
- throw new IllegalArgumentException("annotation must be not null!");
- }
+ public AnnotationStyle(String annotation, Style style, Color color, int layer) {
- mAnnotation = annotation;
-
- // style
- if (style == null) {
- throw new IllegalArgumentException("style must be not null!");
+ if (annotation == null || style == null || color == null) {
+ throw new IllegalArgumentException("parameters must be not null!");
}
- mStyle = style;
+ this.annotation = annotation;
+ this.style = style;
+ this.color = color;
- // color
- if (color == null) {
- throw new IllegalArgumentException("color must be not null!");
+ if (layer < 0) {
+ throw new IllegalArgumentException("layer must be a positive or zero");
}
- mColor = color;
+ this.layer = layer;
+
}
/**
- * Retrives the annoation type.
+ * Retrieves the annotation type.
*
* @return - annotation type.
*/
public String getAnnotation() {
- return mAnnotation;
+ return annotation;
}
/**
- * Retrives the drawing style of the annotation.
+ * Retrieves the drawing style of the annotation.
*
* @return - annotation drawing style
*/
public Style getStyle() {
- return mStyle;
+ return style;
}
/**
- * Retrives the color of the annotation.
+ * Retrieves the color of the annotation.
*
* @return - annotation color
*/
public Color getColor() {
- return mColor;
+ return color;
+ }
+
+ /**
+ * Retrieves the drawing layer.
+ *
+ * @return
+ */
+ public int getLayer() {
+ return layer;
}
/**
@@ -140,17 +161,15 @@
public boolean equals(Object object) {
boolean isEqual;
- if (object != this) {
- if (object instanceof AnnotationStyle) {
- AnnotationStyle style = (AnnotationStyle) object;
-
- isEqual = mAnnotation.equals(style.mAnnotation) && mStyle.equals(style.mStyle)
- && mColor.equals(style.mColor);
- } else {
- isEqual = false;
- }
- } else {
+ if (object == this) {
isEqual = true;
+ } else if (object instanceof AnnotationStyle) {
+ AnnotationStyle style = (AnnotationStyle) object;
+
+ isEqual = annotation.equals(style.annotation) && style.style.equals(style.style)
+ && color.equals(style.color) && layer == style.layer;
+ } else {
+ isEqual = false;
}
return isEqual;
@@ -169,10 +188,10 @@
*/
@Override
public String toString() {
- String annotationStyle = "Type: " + mAnnotation;
- annotationStyle += " Style: " + mStyle.name();
- annotationStyle += " Color: " + mColor.toString();
-
+ String annotationStyle = "Type: " + annotation;
+ annotationStyle += " Style: " + getStyle().name();
+ annotationStyle += " Color: " + getColor().toString();
+ annotationStyle += " Layer: " + getLayer();
return annotationStyle;
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java Wed Sep 12 05:42:30 2007
@@ -38,7 +38,7 @@
public static final int EDITOR_LINE_LENGTH_HINT_DEFAULT = 80;
/**
- * Name of the typesystem file
+ * Name of the type system file
*/
private String mTypeSystemFileName;
@@ -63,7 +63,7 @@
private HashMap<String, AnnotationStyle> mStyleMap = new HashMap<String, AnnotationStyle>();
/**
- * Retrives type system name parameter.
+ * Retrieves type system name parameter.
*
* @return type system name parameter
*/
@@ -82,7 +82,7 @@
}
/**
- * Retrvies the uima config folder name parameter.
+ * Retrieves the uima config folder name parameter.
*
* @return uima config folder name parameter.
*/
@@ -123,7 +123,7 @@
}
/**
- * Retrives the list of all corpus fodlers.
+ * Retrieves the list of all corpus folders.
*
* @return corpus folder list
*/
@@ -132,7 +132,7 @@
}
/**
- * Retrvies the editor line length hint parameter.
+ * Retrieves the editor line length hint parameter.
*
* @return line length hint
*/
@@ -150,9 +150,9 @@
}
/**
- * Retrives the annotation styles.
+ * Retrieves the annotation styles.
*
- * @return - the annoation styles
+ * @return - the annotation styles
*/
public Collection<AnnotationStyle> getAnnotationStyles() {
return mStyleMap.values();
@@ -164,11 +164,15 @@
* @param style
*/
public void setStyle(AnnotationStyle style) {
- if (!(AnnotationStyle.DEFAULT_COLOR.equals(style.getColor()) && AnnotationStyle.DEFAULT_STYLE
- .equals(style.getStyle()))) {
- mStyleMap.put(style.getAnnotation(), style);
- } else {
+
+ boolean isDefaultAnnotation = AnnotationStyle.DEFAULT_COLOR.equals(style.getColor()) &&
+ AnnotationStyle.DEFAULT_STYLE.equals(style.getStyle()) &&
+ AnnotationStyle.DEFAULT_LAYER == style.getLayer();
+
+ if (isDefaultAnnotation) {
mStyleMap.remove(style.getAnnotation());
+ } else {
+ mStyleMap.put(style.getAnnotation(), style);
}
}
@@ -182,7 +186,7 @@
}
/**
- * Retrives the AnnotationStyle for the given type or null if not available.
+ * Retrieves the AnnotationStyle for the given type or null if not available.
*
* @param type
* @return the requested style or null if none
@@ -192,7 +196,7 @@
if (style == null) {
style = new AnnotationStyle(type.getName(), AnnotationStyle.DEFAULT_STYLE,
- AnnotationStyle.DEFAULT_COLOR);
+ AnnotationStyle.DEFAULT_COLOR, 0);
}
return style;
@@ -232,7 +236,7 @@
* @param a -
* the first object or null
* @param b -
- * the secend object or null
+ * the second object or null
* @return - a.equals(b) or true if both null
*/
private static boolean isEqual(Object a, Object b) {
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java Wed Sep 12 05:42:30 2007
@@ -58,6 +58,8 @@
private static final String STYLE_COLOR_ATTRIBUTE = "color";
+ private static final String STYLE_LAYER_ATTRIBUTE = "layer";
+
private static final String TYPESYSTEM_ELEMENT = "typesystem";
private static final String TYPESYTEM_FILE_ATTRIBUTE = "file";
@@ -71,7 +73,7 @@
private static final String EDITOR_LINE_LENGTH_ATTRIBUTE = "line-length-hint";
/**
- * Creats a {@link DotCorpus} object from a given {@link InputStream}.
+ * Creates a {@link DotCorpus} object from a given {@link InputStream}.
*
* @param dotCorpusStream
* @return the {@link DotCorpus} instance.
@@ -142,13 +144,22 @@
String styleString = corporaChildElement.getAttribute(STYLE_STYLE_ATTRIBUTE);
- String colorString = corporaChildElement.getAttribute(STYLE_COLOR_ATTRIBUTE);
-
- int colorInteger = Integer.parseInt(colorString);
+ int colorInteger = Integer.parseInt(corporaChildElement.getAttribute(STYLE_COLOR_ATTRIBUTE));
Color color = new Color(colorInteger);
+
+ String drawingLayerString = corporaChildElement.getAttribute(STYLE_LAYER_ATTRIBUTE);
+
+ int drawingLayer;
+
+ try {
+ drawingLayer = Integer.parseInt(drawingLayerString);
+ } catch(NumberFormatException e) {
+ drawingLayer = 0;
+ }
+
AnnotationStyle style = new AnnotationStyle(type, AnnotationStyle.Style
- .valueOf(styleString), color);
+ .valueOf(styleString), color, drawingLayer);
dotCorpus.setStyle(style);
} else if (CAS_PROCESSOR_ELEMENT.equals(corporaChildElement.getNodeName())) {
@@ -199,17 +210,19 @@
}
for (AnnotationStyle style : dotCorpus.getAnnotationStyles()) {
- AttributesImpl corpusFolderAttributes = new AttributesImpl();
- corpusFolderAttributes
+ AttributesImpl styleAttributes = new AttributesImpl();
+ styleAttributes
.addAttribute("", "", STYLE_TYPE_ATTRIBUTE, "", style.getAnnotation());
- corpusFolderAttributes.addAttribute("", "", STYLE_STYLE_ATTRIBUTE, "", style.getStyle()
+ styleAttributes.addAttribute("", "", STYLE_STYLE_ATTRIBUTE, "", style.getStyle()
.name());
Color color = style.getColor();
Integer colorInt = new Color(color.getRed(), color.getGreen(), color.getBlue()).getRGB();
- corpusFolderAttributes.addAttribute("", "", STYLE_COLOR_ATTRIBUTE, "", colorInt.toString());
+ styleAttributes.addAttribute("", "", STYLE_COLOR_ATTRIBUTE, "", colorInt.toString());
+ styleAttributes.addAttribute("", "", STYLE_LAYER_ATTRIBUTE, "",
+ Integer.toString(style.getLayer()));
- xmlSerHandler.startElement("", STYLE_ELEMENT, STYLE_ELEMENT, corpusFolderAttributes);
+ xmlSerHandler.startElement("", STYLE_ELEMENT, STYLE_ELEMENT, styleAttributes);
xmlSerHandler.endElement("", STYLE_ELEMENT, STYLE_ELEMENT);
}
@@ -245,7 +258,6 @@
String message = (e.getMessage() != null ? e.getMessage() : "");
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
-
throw new CoreException(s);
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java Wed Sep 12 05:42:30 2007
@@ -40,6 +40,7 @@
import org.apache.uima.caseditor.core.util.Span;
import org.apache.uima.caseditor.editor.action.DeleteFeatureStructureAction;
import org.apache.uima.caseditor.editor.annotation.DrawingStyle;
+import org.apache.uima.caseditor.editor.annotation.EclipseAnnotationPeer;
import org.apache.uima.caseditor.editor.context.AnnotationEditingControlCreator;
import org.apache.uima.caseditor.editor.outline.AnnotationOutline;
import org.apache.uima.caseditor.ui.FeatureStructureTransfer;
@@ -54,6 +55,7 @@
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationPainter;
import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.ISelection;
@@ -72,7 +74,10 @@
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
@@ -303,7 +308,7 @@
}
private void fillTypeMenu(Type parentType, Menu parentMenu, boolean isParentIncluded) {
- List childs = mTypeSystem.getDirectSubtypes(parentType);
+ List<Type> childs = mTypeSystem.getDirectSubtypes(parentType);
Menu newSubMenu;
@@ -324,10 +329,10 @@
insertAction(parentType, newSubMenu);
- Iterator childsIterator = childs.iterator();
+ Iterator<Type> childsIterator = childs.iterator();
while (childsIterator.hasNext()) {
- Type child = (Type) childsIterator.next();
+ Type child = childsIterator.next();
fillTypeMenu(child, newSubMenu, true);
}
@@ -427,9 +432,9 @@
// must be removed/added
syncAnnotations();
- EditorAnnotationStatus status = mDocument.getProject().getEditorAnnotationStatus();
+ EditorAnnotationStatus status = getDocument().getProject().getEditorAnnotationStatus();
- mDocument.getProject().setEditorAnnotationStatus(
+ getDocument().getProject().setEditorAnnotationStatus(
new EditorAnnotationStatus(status.getMode(), getSelectedTypes()));
}
});
@@ -526,6 +531,59 @@
}
}
+ private class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension {
+
+ public Object getType(Annotation annotation) {
+ return null;
+ }
+
+ public boolean isMultiLine(Annotation annotation) {
+ return false;
+ }
+
+ public boolean isTemporary(Annotation annotation) {
+ return false;
+ }
+
+ public int getLayer(Annotation annotation) {
+
+ if (annotation instanceof EclipseAnnotationPeer) {
+
+ EclipseAnnotationPeer eclipseAnnotation = (EclipseAnnotationPeer) annotation;
+
+ AnnotationStyle style = getDocument().getProject().
+ getDotCorpus().getAnnotation(eclipseAnnotation.getAnnotationFS().getType());
+
+ return style.getLayer();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public Object[] getSupertypes(Object annotationType) {
+ return null;
+ }
+
+ public String getTypeLabel(Annotation annotation) {
+ return null;
+ }
+
+ public boolean isPaintable(Annotation annotation) {
+ assert false : "Should never be called";
+
+ return false;
+ }
+
+ public boolean isSubtype(Object annotationType, Object potentialSupertype) {
+ return true;
+ }
+
+ public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
+ assert false : "Should never be called";
+ }
+ }
+
private Type mAnnotationMode;
/**
@@ -550,8 +608,6 @@
private AnnotationPainter mPainter;
-// private IAnnotationModel mAnnotationModel;
-
private ShowAnnotationsMenu mShowAnnotationsMenu;
private DocumentListener mAnnotationSynchronizer;
@@ -591,21 +647,7 @@
sourceViewer.setEditable(false);
- mPainter = new AnnotationPainter(sourceViewer, new IAnnotationAccess() {
-
- public Object getType(Annotation annotation) {
- return null;
- }
-
- public boolean isMultiLine(Annotation annotation) {
- return false;
- }
-
- public boolean isTemporary(Annotation annotation) {
- return false;
- }
-
- });
+ mPainter = new AnnotationPainter(sourceViewer, new AnnotationAccess());
sourceViewer.addPainter(mPainter);
return sourceViewer;
@@ -677,12 +719,12 @@
getSite().setSelectionProvider(mFeatureStructureSelectionProvider);
- if (mDocument != null) {
+ if (getDocument() != null) {
mShowAnnotationsMenu = new ShowAnnotationsMenu(
- mDocument.getProject().getEditorAnnotationStatus(),
+ getDocument().getProject().getEditorAnnotationStatus(),
getDocument().getCAS().getTypeSystem());
- EditorAnnotationStatus status = mDocument.getProject().getEditorAnnotationStatus();
+ EditorAnnotationStatus status = getDocument().getProject().getEditorAnnotationStatus();
setAnnotationMode(status.getMode());
@@ -800,7 +842,7 @@
}
private void showAnnotationType(Type type) {
- AnnotationStyle style = mDocument.getProject().getDotCorpus().getAnnotation(type);
+ AnnotationStyle style = getDocument().getProject().getDotCorpus().getAnnotation(type);
mPainter.addDrawingStrategy(type.getName(),
DrawingStyle.valueOf(style.getStyle().name()).getStrategy());
mPainter.addAnnotationType(type.getName(), type.getName());
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java?rev=574921&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java Wed Sep 12 05:42:30 2007
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.caseditor.editor.annotation;
+
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Fills the background of an annotation.
+ */
+final class BackgroundDrawingStrategy implements IDrawingStrategy {
+ /**
+ * Fill the background of the given annotation in the specified color.
+ *
+ * @param annotation
+ * @param gc
+ * @param textWidget
+ * @param offset
+ * @param length
+ * @param color
+ */
+ public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+ Color color) {
+ if (length != 0) {
+ if (gc != null) {
+ Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
+
+ gc.setBackground(color);
+ gc.fillRectangle(bounds);
+
+ int start = offset;
+ int end = offset + length;
+
+
+// Point selection = textWidget.getSelection();
+// boolean isPartOfAnnotationSelected = selection.x < end && start < selection.y &&
+// selection.y - selection.x > 0;
+// if (isPartOfAnnotationSelected) {
+//
+// int startInAnnotation = selection.x < start ? start : selection.x;
+// int endInAnnotation = selection.y < end ? selection.y : end;
+//
+// Rectangle boundsInAnnotation = textWidget.getTextBounds(startInAnnotation, endInAnnotation);
+//
+// gc.setBackground(new Color(gc.getDevice(), 100, 100, 100));
+// gc.fillRectangle(boundsInAnnotation);
+// }
+
+ gc.setForeground(new Color(gc.getDevice(), 0, 0, 0));
+
+ gc.drawText(textWidget.getText(start, end), bounds.x, bounds.y, true);
+ } else {
+ textWidget.redrawRange(offset, length, true);
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java Wed Sep 12 05:42:30 2007
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,12 +27,12 @@
import org.eclipse.swt.graphics.Rectangle;
/**
- * Draws a box arround an annotation.
+ * Draws a box around an annotation.
*/
final class BoxDrawingStrategy implements IDrawingStrategy {
/**
- * Draws a box arround the given annotation.
- *
+ * Draws a box around the given annotation.
+ *
* @param annotation
* @param gc
* @param textWidget
@@ -48,7 +48,7 @@
gc.setForeground(color);
- gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1);
+ gc.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
} else {
textWidget.redrawRange(offset, length, true);
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java Wed Sep 12 05:42:30 2007
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -22,14 +22,25 @@
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
/**
- * An enumertation of all available {@link IDrawingStrategy}.
+ * An enumeration of all available {@link IDrawingStrategy}.
*/
public enum DrawingStyle {
-
+
+ /**
+ * The background color {@link IDrawingStrategy}.
+ */
+ BACKGROUND(new BackgroundDrawingStrategy()),
+
+ /**
+ * The text color {@link IDrawingStrategy}.
+ */
TEXT_COLOR(new TextColorDrawingStrategy()),
-
+
+ /**
+ * The token {@link IDrawingStrategy}.
+ */
TOKEN(new TokenDrawingStrategy()),
-
+
/**
* The squiggles {@link IDrawingStrategy}.
*/
@@ -50,13 +61,23 @@
*/
BRACKET(new BracketDrawingStrategy());
- private IDrawingStrategy mStrategy;
+ private final IDrawingStrategy strategy;
+ /**
+ * Initializes the current instance.
+ *
+ * @param strategy
+ */
private DrawingStyle(IDrawingStrategy strategy) {
- mStrategy = strategy;
+ this.strategy = strategy;
}
+ /**
+ * Retrieves the {@link IDrawingStrategy}.
+ *
+ * @return the {@link IDrawingStrategy}.
+ */
public IDrawingStrategy getStrategy() {
- return mStrategy;
+ return strategy;
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java Wed Sep 12 05:42:30 2007
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,18 +19,22 @@
package org.apache.uima.caseditor.editor.annotation;
-import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
/**
- * TODO: add javadoc here
+ * This class is used to provide additional information about the {@link AnnotationFS}
+ * object to the custom drawing strategies.
*/
public class EclipseAnnotationPeer extends org.eclipse.jface.text.source.Annotation {
- private AnnotationFS mAnnotation;
+
+ /**
+ * The uima annotation.
+ */
+ private AnnotationFS annotation;
/**
* Initializes a new instance.
- *
+ *
* @param name
* @param isPersitent
* @param text
@@ -41,29 +45,20 @@
/**
* Sets the annotation.
- *
+ *
* @param annotation
*/
public void setAnnotation(AnnotationFS annotation) {
- mAnnotation = annotation;
+ this.annotation = annotation;
setText(annotation.getCoveredText());
}
/**
- * Retrives the annotation.
- *
+ * Retrieves the annotation.
+ *
* @return the annotation
*/
public AnnotationFS getAnnotationFS() {
- return mAnnotation;
- }
-
- /**
- * Retives the type of the annotation.
- *
- * @return the type
- */
- public Type getAnnotationType() {
- return mAnnotation.getType();
+ return annotation;
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/property/AnnotationPropertyPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/property/AnnotationPropertyPage.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/property/AnnotationPropertyPage.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/property/AnnotationPropertyPage.java Wed Sep 12 05:42:30 2007
@@ -31,26 +31,33 @@
import org.apache.uima.caseditor.core.model.TypesystemElement;
import org.apache.uima.caseditor.core.model.dotcorpus.AnnotationStyle;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.ColorSelector;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
import org.eclipse.ui.dialogs.PropertyPage;
/**
- * This is the <code>AnnotationPropertyPage</code>. this page configures the
- * project dependent and type dependent annotation appearance in the
- * <code>AnnotationEditor</code>.
+ * This is the <code>AnnotationPropertyPage</code>. this page configures the project dependent
+ * and type dependent annotation appearance in the <code>AnnotationEditor</code>.
*/
public class AnnotationPropertyPage extends PropertyPage {
private DotCorpusElement mDotCorpusElement;
@@ -59,12 +66,46 @@
private ColorSelector mColorSelector;
- private List mTypeList;
+ private TableViewer mTypeList;
private AnnotationStyle mCurrentSelectedAnnotation = null;
private NlpProject mProject;
+ private AnnotationStyle getDefaultAnnotation() {
+
+ IStructuredSelection selection = (IStructuredSelection) mTypeList.getSelection();
+
+ Type selectedType = (Type) selection.getFirstElement();
+
+ return new AnnotationStyle(selectedType.getName(), AnnotationStyle.DEFAULT_STYLE,
+ AnnotationStyle.DEFAULT_COLOR, mCurrentSelectedAnnotation.getLayer());
+ }
+
+ private void itemSelected() {
+ IStructuredSelection selection = (IStructuredSelection) mTypeList.getSelection();
+
+ Type selectedType = (Type) selection.getFirstElement();
+
+ TypeSystem typesystem = mProject.getTypesystemElement().getTypeSystem();
+
+ AnnotationStyle style = mDotCorpusElement.getAnnotation(selectedType);
+
+ mCurrentSelectedAnnotation = style;
+
+ if (style == null) {
+ style = new AnnotationStyle(selectedType.getName(), AnnotationStyle.DEFAULT_STYLE,
+ AnnotationStyle.DEFAULT_COLOR, mCurrentSelectedAnnotation.getLayer());
+ }
+
+ mStyleCombo.setText(style.getStyle().name());
+ mStyleCombo.setEnabled(true);
+
+ Color color = style.getColor();
+ mColorSelector.setColorValue(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
+ mColorSelector.setEnabled(true);
+ }
+
/**
* Creates the annotation property page controls.
*/
@@ -83,7 +124,6 @@
return message;
}
-
Composite base = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
@@ -98,37 +138,60 @@
typeText.setLayoutData(typeTextGridData);
// type list
- mTypeList = new List(base, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
+ mTypeList = new TableViewer(base, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
GridData typeListGridData = new GridData();
typeListGridData.horizontalAlignment = SWT.FILL;
typeListGridData.grabExcessVerticalSpace = true;
typeListGridData.verticalAlignment = SWT.FILL;
typeListGridData.verticalSpan = 2;
- mTypeList.setLayoutData(typeListGridData);
+ mTypeList.getControl().setLayoutData(typeListGridData);
+
+ mTypeList.getTable().setHeaderVisible(true);
+
+ TableViewerColumn typeColumn = new TableViewerColumn(mTypeList, SWT.LEFT);
+ typeColumn.getColumn().setText("Type");
+ typeColumn.getColumn().setWidth(250);
+ typeColumn.setLabelProvider(new CellLabelProvider(){
+ @Override
+ public void update(ViewerCell cell) {
+
+ Type type = (Type) cell.getElement();
+
+ cell.setText(type.getName());
+ }});
+
+ TableViewerColumn layerColumn = new TableViewerColumn(mTypeList, SWT.LEFT);
+ layerColumn.getColumn().setText("Layer");
+ layerColumn.getColumn().setWidth(50);
+
+ layerColumn.setLabelProvider(new CellLabelProvider() {
+
+ @Override
+ public void update(ViewerCell cell) {
+
+ Type type = (Type) cell.getElement();
+
+ AnnotationStyle style = mDotCorpusElement.getAnnotation(type);
+
+ cell.setText(Integer.toString(style.getLayer()));
+ }});
TypeSystem typeSytstem = mProject.getTypesystemElement().getTypeSystem();
Type annotationType = typeSytstem.getType(CAS.TYPE_NAME_ANNOTATION);
java.util.List types = typeSytstem.getProperlySubsumedTypes(annotationType);
- // Vector types = typeSytstem.getDirectlySubsumedTypes(annotationType);
for (Object typeObject : types) {
- Type type = (Type) typeObject;
-
- mTypeList.add(type.getName());
+ // inserts objects with type Type
+ mTypeList.add(typeObject);
}
- mTypeList.addSelectionListener(new SelectionListener() {
+ mTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void widgetSelected(SelectionEvent e) {
+ public void selectionChanged(SelectionChangedEvent event) {
itemSelected();
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // not needed
- }
-
});
Composite settingsComposite = new Composite(base, SWT.NONE);
@@ -147,7 +210,16 @@
mStyleCombo.setEnabled(false);
mStyleCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
- styleChanged();
+ if (mCurrentSelectedAnnotation == null) {
+ mCurrentSelectedAnnotation = getDefaultAnnotation();
+ }
+
+ mCurrentSelectedAnnotation = new AnnotationStyle(
+ mCurrentSelectedAnnotation.getAnnotation(), AnnotationStyle.Style
+ .valueOf(mStyleCombo.getText()), mCurrentSelectedAnnotation.getColor(),
+ mCurrentSelectedAnnotation.getLayer());
+
+ mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -169,71 +241,79 @@
mColorSelector.setEnabled(false);
mColorSelector.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
- colorChanged();
- }
- });
+ if (mCurrentSelectedAnnotation == null) {
+ mCurrentSelectedAnnotation = getDefaultAnnotation();
+ }
- mTypeList.select(0);
+ RGB colorRGB = mColorSelector.getColorValue();
- if (mTypeList.getSelectionIndex() != -1) {
- itemSelected();
- }
+ Color color = new Color(colorRGB.red, colorRGB.green, colorRGB.blue);
- return base;
- }
+ mCurrentSelectedAnnotation = new AnnotationStyle(
+ mCurrentSelectedAnnotation.getAnnotation(), mCurrentSelectedAnnotation.getStyle(),
+ color, mCurrentSelectedAnnotation.getLayer());
- private void colorChanged() {
- if (mCurrentSelectedAnnotation == null) {
- mCurrentSelectedAnnotation = getDefaultAnnotation();
- }
+ mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
+ }
+ });
- RGB colorRGB = mColorSelector.getColorValue();
+ Button moveLayerUpButton = new Button(settingsComposite, SWT.NONE);
+ moveLayerUpButton.setText("Move layer up");
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(moveLayerUpButton);
+ moveLayerUpButton.addSelectionListener(new SelectionListener() {
- Color color = new Color(colorRGB.red, colorRGB.green, colorRGB.blue);
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
- mCurrentSelectedAnnotation = new AnnotationStyle(mCurrentSelectedAnnotation.getAnnotation(),
- mCurrentSelectedAnnotation.getStyle(), color);
+ public void widgetSelected(SelectionEvent e) {
+ if (mCurrentSelectedAnnotation == null) {
+ mCurrentSelectedAnnotation = getDefaultAnnotation();
+ }
+
+ mCurrentSelectedAnnotation = new AnnotationStyle(
+ mCurrentSelectedAnnotation.getAnnotation(), AnnotationStyle.Style
+ .valueOf(mStyleCombo.getText()), mCurrentSelectedAnnotation.getColor(),
+ mCurrentSelectedAnnotation.getLayer() + 1);
- mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
- }
+ mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
- private void styleChanged() {
- if (mCurrentSelectedAnnotation == null) {
- mCurrentSelectedAnnotation = getDefaultAnnotation();
- }
+ mTypeList.refresh(((IStructuredSelection) mTypeList.getSelection()).getFirstElement(),
+ true);
+ }
+ });
- mCurrentSelectedAnnotation = new AnnotationStyle(mCurrentSelectedAnnotation.getAnnotation(),
- AnnotationStyle.Style.valueOf(mStyleCombo.getText()), mCurrentSelectedAnnotation
- .getColor());
+ Button moveLayerDownButton = new Button(settingsComposite, SWT.NONE);
+ moveLayerDownButton.setText("Move layer down");
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(moveLayerDownButton);
- mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
- }
+ moveLayerDownButton.addSelectionListener(new SelectionListener() {
- private void itemSelected() {
- String name = mTypeList.getItem(mTypeList.getSelectionIndex());
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
- TypeSystem typesystem = mProject.getTypesystemElement().getTypeSystem();
+ public void widgetSelected(SelectionEvent e) {
+ if (mCurrentSelectedAnnotation != null && mCurrentSelectedAnnotation.getLayer() - 1 >= 0) {
+ mCurrentSelectedAnnotation = getDefaultAnnotation();
- AnnotationStyle style = mDotCorpusElement.getAnnotation(typesystem.getType(name));
+ mCurrentSelectedAnnotation = new AnnotationStyle(mCurrentSelectedAnnotation
+ .getAnnotation(), AnnotationStyle.Style.valueOf(mStyleCombo.getText()),
+ mCurrentSelectedAnnotation.getColor(), mCurrentSelectedAnnotation.getLayer() - 1);
+
+ mDotCorpusElement.setStyle(mCurrentSelectedAnnotation);
+
+ mTypeList.update(((IStructuredSelection) mTypeList.getSelection()).getFirstElement(),
+ null);
+ }
+ }
+ });
- mCurrentSelectedAnnotation = style;
+ mTypeList.getTable().select(0);
- if (style == null) {
- style = new AnnotationStyle(name, AnnotationStyle.DEFAULT_STYLE,
- AnnotationStyle.DEFAULT_COLOR);
+ if (mTypeList.getTable().getSelectionIndex() != -1) {
+ itemSelected();
}
- mStyleCombo.setText(style.getStyle().name());
- mStyleCombo.setEnabled(true);
-
- Color color = style.getColor();
- mColorSelector.setColorValue(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
- mColorSelector.setEnabled(true);
- }
-
- private AnnotationStyle getDefaultAnnotation() {
- return new AnnotationStyle(mTypeList.getItem(mTypeList.getSelectionIndex()),
- AnnotationStyle.DEFAULT_STYLE, AnnotationStyle.DEFAULT_COLOR);
+ return base;
}
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyleTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyleTest.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyleTest.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyleTest.java Wed Sep 12 05:42:30 2007
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -35,21 +35,25 @@
*/
@Test
public void testEquals() {
- AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(255, 255, 0));
+ AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
+ 255, 255, 0), 0);
- AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(255, 255, 0));
+ AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
+ 255, 255, 0), 0);
assertEquals(a, b);
}
/**
* Test the {@link AnnotationStyle#hashCode()} method.
- *
+ *
*/
public void testHashCode() {
- AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(255, 255, 0));
+ AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
+ 255, 255, 0), 0);
- AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(255, 255, 0));
+ AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
+ 255, 255, 0), 0);
assertEquals(a.hashCode(), b.hashCode());
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializerTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializerTest.java?rev=574921&r1=574920&r2=574921&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializerTest.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/test/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializerTest.java Wed Sep 12 05:42:30 2007
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -31,12 +31,14 @@
import org.junit.Test;
/**
- * TODO: add javadoc here
+ * This is the test for the {@link DotCorpusSerializer} class.
+ *
+ * @see DotCorpusSerializer
*/
public class DotCorpusSerializerTest {
/**
* Tests if serialization and recreations creates and object that is equal to the original.
- *
+ *
* @throws CoreException
*/
@Test
@@ -44,7 +46,7 @@
DotCorpus original = new DotCorpus();
original.setTypeSystemFilename("typesystem");
original.addCasProcessorFolder("uima processor folder");
- original.setStyle(new AnnotationStyle("test", Style.BRACKET, new Color(255, 255, 0)));
+ original.setStyle(new AnnotationStyle("test", Style.BRACKET, new Color(255, 255, 0), 0));
original.addCorpusFolder("corpus");
ByteArrayOutputStream out = new ByteArrayOutputStream();