You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/01 15:54:22 UTC

svn commit: r1152774 [3/6] - in /uima/sandbox/trunk/TextMarker: org.apache.uima.tm.cev.feature/ org.apache.uima.tm.cev.html.feature/ org.apache.uima.tm.cev.html/ org.apache.uima.tm.cev.html/META-INF/ org.apache.uima.tm.cev.html/bin/ org.apache.uima.tm....

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,947 @@
+package org.apache.uima.tm.cev.data;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.tm.cev.CEVPlugin;
+import org.apache.uima.tm.cev.data.CEVAnnotationRanges.StyleRangeContainer;
+import org.apache.uima.tm.cev.data.tree.CEVAnnotationTreeNode;
+import org.apache.uima.tm.cev.data.tree.CEVTypeOrderedRootTreeNode;
+import org.apache.uima.tm.cev.data.tree.CEVTypeTreeNode;
+import org.apache.uima.tm.cev.data.tree.ICEVAnnotationNode;
+import org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode;
+import org.apache.uima.tm.cev.preferences.CEVPreferenceConstants;
+import org.apache.uima.tools.stylemap.StyleMapEntry;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * Wrapper-Klasse fuer einzelne CAS-Views
+ * 
+ * @author Marco Nehmeier
+ * 
+ */
+public class CEVData implements ICheckStateListener/* , ProgressListener */{
+
+  /**
+   * HTML-Parser zum Analysieren des HTML-Dokuments um Positionen von Tags im Code zu bstimmen und
+   * mit eindeutigen HTML-ID zu versehen
+   * 
+   * @author Marco Nehmeier
+   * 
+   */
+
+  // Farben fuer Annotationen wenn nicht in Stylemap
+  private static final int[] COLOR_NR = new int[] { SWT.COLOR_BLUE, SWT.COLOR_CYAN, SWT.COLOR_GRAY,
+      SWT.COLOR_GREEN, SWT.COLOR_MAGENTA, SWT.COLOR_RED, SWT.COLOR_YELLOW, SWT.COLOR_DARK_BLUE,
+      SWT.COLOR_DARK_CYAN, SWT.COLOR_DARK_GRAY, SWT.COLOR_DARK_GREEN, SWT.COLOR_DARK_MAGENTA,
+      SWT.COLOR_DARK_RED, SWT.COLOR_DARK_YELLOW };
+
+  private CAS cas;
+
+  private HashSet<ICEVAnnotationListener> annotListeners;
+
+  private ArrayList<Type> indexedTypes;
+
+  private ArrayList<AnnotationFS> annotations;
+
+  private HashMap<Type, Color> fgColors;
+
+  private HashMap<Type, Color> bgColors;
+
+  private HashMap<Type, Image> icons;
+
+  // Hashmap der Typen mit Hashmap der Annotatinen mit den Status
+  // (Anzeingen/Nichtanzeigen)
+  private HashMap<Type, HashMap<AnnotationFS, Boolean>> annotationState;
+
+  // Zaehler der Angezeigten Annotationen eines Typs
+  private HashMap<Type, Integer> annotationStateCount;
+
+  public String htmlText;
+
+  // Map mit den Positionen der HTML-Elemente
+  public LinkedHashMap<String, int[]> htmlElementPos;
+
+  // ID-Prefix
+  public String idName;
+
+  // ID-Zaehler
+  public int idCount;
+
+  // Annotationsbereiche
+  public CEVAnnotationRanges annotationRanges;
+
+  private Map<String, ICEVDataExtension> extensions;
+
+  /**
+   * Konstruktor
+   * 
+   * @param cas
+   *          CAS-View
+   * @param style
+   *          Map mit den Stylemap-Werten fuer die einzelnen Typen
+   */
+  public CEVData(CAS cas, Map<String, StyleMapEntry> style) {
+    this.cas = cas;
+
+    extensions = new HashMap<String, ICEVDataExtension>();
+
+    // Initialisieren
+    fgColors = new HashMap<Type, Color>();
+    bgColors = new HashMap<Type, Color>();
+
+    icons = new HashMap<Type, Image>();
+
+    annotationState = new HashMap<Type, HashMap<AnnotationFS, Boolean>>();
+    annotationStateCount = new HashMap<Type, Integer>();
+    indexedTypes = new ArrayList<Type>();
+    annotations = new ArrayList<AnnotationFS>();
+    annotListeners = new HashSet<ICEVAnnotationListener>();
+
+    // Cas nach Annotationen analysieren
+    initializeAnnotations(style);
+
+    // Annotationsbereiche erstellen
+    annotationRanges = new CEVAnnotationRanges(this);
+  }
+
+  public void addExtension(String name, ICEVDataExtension extension) {
+    extensions.put(name, extension);
+  }
+
+  /**
+   * CAS nach Annotationen analysieren
+   * 
+   * @param style
+   *          StyleMap
+   */
+  private void initializeAnnotations(Map<String, StyleMapEntry> style) {
+    // Preferences nach Annotation_Filter auslesen
+    IPreferenceStore store = CEVPlugin.getDefault().getPreferenceStore();
+    String filter = store.getString(CEVPreferenceConstants.P_ANNOTATION_FILTER);
+
+    int i = 0;
+
+    // Ueber Typen interieren um Farben zu setzen
+    TypeSystem typeSystem = cas.getTypeSystem();
+    Iterator<Type> tIter = typeSystem.getTypeIterator();
+    while (tIter.hasNext()) {
+      Type t = tIter.next();
+
+      if (!t.getName().matches(filter) && typeSystem.subsumes(cas.getAnnotationType(), t)) {
+        // Typ indizieren
+        indexedTypes.add(t);
+
+        // in Stylemap
+        if (style != null && style.containsKey(t.getName())) {
+          StyleMapEntry se = style.get(t.getName());
+          bgColors.put(t, new Color(Display.getCurrent(), se.getBackground().getRed(), se
+                  .getBackground().getGreen(), se.getBackground().getBlue()));
+          fgColors.put(t, new Color(Display.getCurrent(), se.getForeground().getRed(), se
+                  .getForeground().getGreen(), se.getForeground().getBlue()));
+        } else {
+          RGB rgb = Display.getCurrent().getSystemColor(COLOR_NR[i++ % COLOR_NR.length]).getRGB();
+          int sum = rgb.blue + rgb.green + rgb.red;
+          int max = Math.max(Math.max(rgb.blue, rgb.green), rgb.red);
+          bgColors.put(t, new Color(Display.getCurrent(), rgb));
+          if (sum < 255 || max < 129) {
+            fgColors.put(t, new Color(Display.getCurrent(), Display.getCurrent().getSystemColor(
+                    SWT.COLOR_WHITE).getRGB()));
+          } else {
+            fgColors.put(t, new Color(Display.getCurrent(), Display.getCurrent().getSystemColor(
+                    SWT.COLOR_BLACK).getRGB()));
+          }
+        }
+
+        annotationState.put(t, new HashMap<AnnotationFS, Boolean>());
+        annotationStateCount.put(t, 0);
+      }
+    }
+
+    // Typenindex alpahbetisch
+    Collections.sort(indexedTypes, new Comparator<Type>() {
+      public int compare(Type o1, Type o2) {
+        return o1.getName().compareTo(o2.getName());
+      }
+    });
+
+    FSIndex anIndex = cas.getAnnotationIndex();
+    FSIterator anIter = anIndex.iterator();
+
+    // Annotationen auslesen
+    while (anIter.isValid()) {
+      AnnotationFS annot = (AnnotationFS) anIter.get();
+      // if (!annot.getType().getName().matches(filter)) {
+      if (annotationState.containsKey(annot.getType())) {
+        boolean show = false;
+        if (style != null) {
+          // TODO what about the parents?
+          StyleMapEntry se = style.get(annot.getType().getName());
+          if (se != null) {
+            show = se.getChecked();
+          }
+        }
+        annotations.add(annot);
+        annotationState.get(annot.getType()).put(annot, show);
+        if (show) {
+          annotationStateCount.put(annot.getType(), annotationStateCount.get(annot.getType()) + 1);
+        }
+
+      }
+
+      anIter.moveToNext();
+    }
+  }
+
+  /**
+   * Gibt das CAS zurueck
+   * 
+   * @return CAS
+   */
+  public CAS getCAS() {
+    return cas;
+  }
+
+  /**
+   * Gibt den DocumentText zurueck
+   * 
+   * @return DocumentText
+   */
+  public String getDocumentText() {
+    return cas.getDocumentText();
+  }
+
+  /**
+   * Gibt den Namen zurueck
+   * 
+   * @return Name
+   */
+  public String getViewName() {
+    return cas.getViewName();
+  }
+
+  /**
+   * Gibt die Anzahl der Annotationen zurueck
+   * 
+   * @return Anzahl
+   */
+  public int getAnnotationsCount() {
+    return annotations.size();
+  }
+
+  /**
+   * Gibt die Annotationen zurueck
+   * 
+   * @return Annotationen
+   */
+  public AnnotationFS[] getAnnotations() {
+    return annotations.toArray(new AnnotationFS[annotations.size()]);
+  }
+
+  /**
+   * Gibt einen Iterator ueber die Annotationen zurueck
+   * 
+   * @return Iterator
+   */
+  public Iterator<AnnotationFS> getAnnotationIterator() {
+    return annotations.iterator();
+  }
+
+  /**
+   * Gibt den HTML-Code zurueck
+   * 
+   * @return HTML-Code
+   */
+  public String getHTMLSource() {
+    return htmlText;
+  }
+
+  /**
+   * Vordergrundfarbe eines Typs
+   * 
+   * @param type
+   *          Typ
+   * @return Farbe
+   */
+  public Color getForegroundColor(Type type) {
+    return fgColors.get(type);
+  }
+
+  /**
+   * Vordergrundfarbe eines Typs als HTML-Farbcode
+   * 
+   * @param type
+   *          Typ
+   * @return Farbe
+   */
+  public String getHtmlForegroundColor(Type type) {
+    Color c = fgColors.get(type);
+
+    String rH = Integer.toHexString(c.getRed());
+    if (rH.length() == 1)
+      rH = 0 + rH;
+
+    String gH = Integer.toHexString(c.getGreen());
+    if (gH.length() == 1)
+      gH = 0 + gH;
+
+    String bH = Integer.toHexString(c.getBlue());
+    if (bH.length() == 1)
+      bH = 0 + bH;
+
+    return "#" + rH + gH + bH;
+  }
+
+  /**
+   * Setzt die Vordergrundfarbe eines Typs
+   * 
+   * @param type
+   *          Typ
+   * @param color
+   *          Farbe
+   */
+  public void setForegroundColor(Type type, Color color) {
+    Color oldColor = fgColors.get(type);
+    Image oldIcon = icons.get(type);
+
+    fgColors.put(type, color);
+    icons.put(type, null);
+
+    annotationColorChanged(type);
+
+    if (oldColor != null)
+      oldColor.dispose();
+
+    if (oldIcon != null)
+      oldIcon.dispose();
+  }
+
+  /**
+   * Hintergrundfarbe eines Typs
+   * 
+   * @param type
+   *          Typ
+   * @return Farbe
+   */
+  public Color getBackgroundColor(Type type) {
+    return bgColors.get(type);
+  }
+
+  /**
+   * Hintergrundfrabe eines Typs als HTML-Code
+   * 
+   * @param type
+   *          Typ
+   * @return Farbe
+   */
+  public String getHtmlBackgroundColor(Type type) {
+    Color c = bgColors.get(type);
+
+    String rH = Integer.toHexString(c.getRed());
+    if (rH.length() == 1)
+      rH = 0 + rH;
+
+    String gH = Integer.toHexString(c.getGreen());
+    if (gH.length() == 1)
+      gH = 0 + gH;
+
+    String bH = Integer.toHexString(c.getBlue());
+    if (bH.length() == 1)
+      bH = 0 + bH;
+
+    return "#" + rH + gH + bH;
+  }
+
+  /**
+   * Setzt die Hintergrundfrabe
+   * 
+   * @param type
+   *          Typ
+   * @param color
+   *          Farbe
+   */
+  public void setBackgroundColor(Type type, Color color) {
+    Color oldColor = bgColors.get(type);
+    Image oldIcon = icons.get(type);
+
+    bgColors.put(type, color);
+    icons.put(type, null);
+
+    annotationColorChanged(type);
+
+    if (oldColor != null)
+      oldColor.dispose();
+
+    if (oldIcon != null)
+      oldIcon.dispose();
+  }
+
+  /**
+   * Gibt das Icon eines Typs zurueck
+   * 
+   * @param type
+   *          Typ
+   * @return Icon
+   */
+  public Image getIcon(Type type) {
+
+    // Wenn Icon fuer diesen Typ in der Farbe noch nicht existiert =>
+    // erstellen
+    if (!icons.containsKey(type) || icons.get(type) == null) {
+      Color fg = getForegroundColor(type);
+      Color bg = getBackgroundColor(type);
+
+      if (fg == null || bg == null) {
+        return null;
+      }
+
+      PaletteData paletteData = new PaletteData(new RGB[] { bg.getRGB(), fg.getRGB() });
+      ImageData imageData = new ImageData(40, 40, 1, paletteData);
+
+      Image image = new Image(Display.getCurrent(), imageData);
+      GC gc = new GC(image);
+      Point p = gc.stringExtent("A");
+
+      gc.dispose();
+      image.dispose();
+
+      imageData = new ImageData(p.x + 4, p.y, 1, paletteData);
+      image = new Image(Display.getCurrent(), imageData);
+      gc = new GC(image);
+
+      gc.setBackground(bg);
+      gc.setForeground(fg);
+
+      gc.setTextAntialias(SWT.ON);
+      gc.drawString("A", 2, 0);
+
+      gc.dispose();
+
+      icons.put(type, image);
+
+      return image;
+    }
+
+    // Icon zurueckgeben
+    return icons.get(type);
+  }
+
+  /**
+   * Gibt an ob eine Annotation zur Anzeige ausgewaehlt ist
+   * 
+   * @param annotation
+   *          Annotation
+   * @return Status
+   */
+  public boolean isChecked(AnnotationFS annotation) {
+    if (annotationState.containsKey(annotation.getType())) {
+      HashMap<AnnotationFS, Boolean> map = annotationState.get(annotation.getType());
+      if (map.containsKey(annotation))
+        return map.get(annotation);
+    }
+
+    return false;
+  }
+
+  /**
+   * Gibt an ob ein Typ zu Anzeige ausgewehlt ist
+   * 
+   * @param type
+   *          Type
+   * @return Status
+   */
+  public boolean isChecked(Type type) {
+    return (annotationState.containsKey(type) && (annotationStateCount.get(type) == annotationState
+            .get(type).size()));
+  }
+
+  /**
+   * Gibt an ob nicht alle Annotationen eines Typs ausgewaehlt sind
+   * 
+   * @param type
+   *          Type
+   * @return Status
+   */
+  public boolean isGrayed(Type type) {
+    return (annotationState.containsKey(type) && (annotationStateCount.get(type) > 0) && (annotationStateCount
+            .get(type) < annotationState.get(type).size()));
+  }
+
+  /**
+   * Gibt die Typnamen in alphabetischer Reihenfolge zurueck
+   * 
+   * @return Typen
+   */
+  public String[] getTypeNames() {
+    String[] names = new String[indexedTypes.size()];
+
+    for (int i = 0; i < names.length; i++) {
+      names[i] = indexedTypes.get(i).getName();
+    }
+
+    return names;
+  }
+
+  /**
+   * Gibt den Typ fuer den Index zurueck
+   * 
+   * @param index
+   *          Index
+   * @return Typ
+   */
+  public Type getTypeByIndex(int index) {
+    if (index >= 0 && index < indexedTypes.size())
+      return indexedTypes.get(index);
+
+    return null;
+  }
+
+  /**
+   * Entfernt eine Annotation
+   * 
+   * @param annot
+   *          Annotation
+   */
+  public void removeAnnotation(AnnotationFS annot) {
+    // Existiert Annot?
+    if (annotationState.containsKey(annot.getType())
+            && annotationState.get(annot.getType()).containsKey(annot)) {
+
+      annotationRanges.removeAnnotation(annot);
+      // Annotationszustaende aktualisieren
+      if (annotationState.get(annot.getType()).get(annot)) {
+        annotationState.get(annot.getType()).put(annot, false);
+        annotationStateCount.put(annot.getType(), annotationStateCount.get(annot.getType()) - 1);
+
+      }
+
+      // aus CAS loeschen
+      cas.removeFsFromIndexes(annot);
+
+      // Aus der Zustandasliste loeschen
+      annotationState.get(annot.getType()).remove(annot);
+
+      // Aus der Annotationliste loeschen
+      annotations.remove(annot);
+
+      annotationStateChanged(annot);
+
+      // Listener benachrichtigen
+      List<AnnotationFS> annots = new ArrayList<AnnotationFS>();
+      annots.add(annot);
+      for (ICEVAnnotationListener l : annotListeners)
+        l.annotationsRemoved(annots);
+    }
+  }
+
+  /**
+   * Entfernt mehrere Annotationen
+   * 
+   * @param annots
+   *          Array mit Annotationen
+   */
+  public void removeAnnotations(AnnotationFS[] annots) {
+    for (AnnotationFS annot : annots) {
+
+      // Existiert Annot?
+      if (annotationState.containsKey(annot.getType())
+              && annotationState.get(annot.getType()).containsKey(annot)) {
+
+        // Annotationszustaende aktualisieren
+        if (annotationState.get(annot.getType()).get(annot)) {
+          annotationState.get(annot.getType()).put(annot, false);
+          annotationStateCount.put(annot.getType(), annotationStateCount.get(annot.getType()) - 1);
+          annotationStateChanged(annot);
+        }
+
+        // aus CAS loeschen
+        cas.removeFsFromIndexes(annot);
+
+        // Aus der Zustandasliste loeschen
+        annotationState.get(annot.getType()).remove(annot);
+
+        // Aus der Annotationliste loeschen
+        annotations.remove(annot);
+        annotationRanges.removeAnnotation(annot);
+        // Listener benachrichtigen
+      }
+    }
+    for (ICEVAnnotationListener l : annotListeners) {
+      l.annotationsRemoved(Arrays.asList(annots));
+    }
+  }
+
+  /**
+   * Fuegt eine Annotation hinzu
+   * 
+   * @param type
+   *          Typ
+   * @param start
+   *          Startpos
+   * @param end
+   *          Endpos
+   */
+  public void addAnnotation(Type type, int start, int end, boolean update) {
+    AnnotationFS annot = cas.createAnnotation(type, start, end);
+    addAnnotation(annot, update);
+  }
+
+  public void addAnnotation(AnnotationFS annotation, boolean update) {
+    cas.addFsToIndexes(annotation);
+    annotationRanges.addAnnotation(annotation);
+    boolean show = isChecked(annotation.getType());
+    annotationState.get(annotation.getType()).put(annotation, show);
+    annotations.add(annotation);
+    if (show) {
+      annotationStateCount.put(annotation.getType(),
+              annotationStateCount.get(annotation.getType()) + 1);
+      // annotationRanges.addAnnotation(annotation);
+      annotationStateChanged(annotation);
+    }
+    if (update) {
+      for (ICEVDataExtension each : extensions.values()) {
+        each.initialize();
+      }
+    }
+    List<AnnotationFS> annots = new ArrayList<AnnotationFS>();
+    annots.add(annotation);
+    for (ICEVAnnotationListener l : annotListeners) {
+      l.annotationsAdded(annots);
+    }
+  }
+
+  /**
+   * AnnotationListener hinzufuegen
+   * 
+   * @param listener
+   *          Listener
+   */
+  public void addAnnotationListener(ICEVAnnotationListener listener) {
+    annotListeners.add(listener);
+  }
+
+  /**
+   * AnnotationListener entfernen
+   * 
+   * @param listener
+   *          Listener
+   */
+  public void removeAnnotationListener(ICEVAnnotationListener listener) {
+    annotListeners.remove(listener);
+  }
+
+  /**
+   * Annotationszustand hat sich geaendert => Listener Benachtichtigen
+   * 
+   * @param type
+   *          Typ
+   */
+  public void annotationStateChanged(Type type) {
+    for (ICEVAnnotationListener l : annotListeners)
+      l.annotationStateChanged(type);
+  }
+
+  /**
+   * Annotationszustand hat sich geaendert => Listener Benachtichtigen
+   * 
+   * @param annot
+   *          Annotation
+   */
+  public void annotationStateChanged(AnnotationFS annot) {
+    for (ICEVAnnotationListener l : annotListeners)
+      l.annotationStateChanged(annot);
+  }
+
+  /**
+   * Farbe einer Annotation hat sich geaendert => Listener benachrichtigen
+   * 
+   * @param type
+   *          Typ
+   */
+  public void annotationColorChanged(Type type) {
+    for (ICEVAnnotationListener l : annotListeners)
+      l.colorChanged(type);
+  }
+
+  /**
+   * Baum nach Typen sortiert
+   * 
+   * @return Baum
+   */
+  public ICEVRootTreeNode getTypeOrderedTree(String manualFilter) {
+    CEVTypeOrderedRootTreeNode root = new CEVTypeOrderedRootTreeNode();
+    Iterator<AnnotationFS> iter = getAnnotationIterator();
+    while (iter.hasNext()) {
+      AnnotationFS next = iter.next();
+      if (manualFilter == null || "".equals(manualFilter)
+              || next.getType().getName().indexOf(manualFilter) != -1) {
+        root.insertFS(next);
+      }
+    }
+    root.sort();
+    return root;
+  }
+
+  /**
+   * Baum nach Annotationen Sortiert
+   * 
+   * @return Baum
+   */
+  public ICEVRootTreeNode getAnnotationOrderedTree(String manualFilter) {
+    // TODO Anpassen wegen Performance
+    // CEVAnnotationOrderedRootTreeNode root = new
+    // CEVAnnotationOrderedRootTreeNode();
+
+    // Wurzel
+    CEVTypeOrderedRootTreeNode root = new CEVTypeOrderedRootTreeNode();
+
+    Iterator<AnnotationFS> iter = getAnnotationIterator();
+
+    // Annotationen einfuegen
+    while (iter.hasNext()) {
+      AnnotationFS next = iter.next();
+      if (manualFilter == null || "".equals(manualFilter)
+              || next.getType().getName().indexOf(manualFilter) != -1) {
+        root.insertFS(next);
+      }
+    }
+    // sortieren
+    root.sort();
+
+    return root;
+  }
+
+  /**
+   * Baum der Annotationen an einer bestimmten Position im Text
+   * 
+   * @param pos
+   *          Position
+   * @return Baum
+   */
+  public ICEVRootTreeNode getAnnotationOrderedTree(int pos, String manualFilter) {
+    // TODO Anpassen wegen Performance
+    // CEVAnnotationOrderedRootTreeNode root = new
+    // CEVAnnotationOrderedRootTreeNode();
+
+    // Wurzel
+    CEVTypeOrderedRootTreeNode root = new CEVTypeOrderedRootTreeNode();
+
+    Iterator<AnnotationFS> iter = getAnnotationIterator();
+
+    // Annotationen einfuegen wenn Position passt
+    while (iter.hasNext()) {
+      AnnotationFS next = iter.next();
+      if (manualFilter == null || "".equals(manualFilter)
+              || next.getType().getName().indexOf(manualFilter) != -1) {
+        if (next.getBegin() <= pos && next.getEnd() >= pos) {
+          root.insertFS(next);
+        }
+      }
+    }
+
+    // sortieren
+    root.sort();
+
+    return root;
+  }
+
+  public List<AnnotationFS> getAnnotationsAt(int pos) {
+    List<AnnotationFS> result = new ArrayList<AnnotationFS>();
+    Iterator<AnnotationFS> iter = getAnnotationIterator();
+
+    while (iter.hasNext()) {
+      AnnotationFS next = iter.next();
+      if (next.getBegin() <= pos && next.getEnd() >= pos) {
+        result.add(next);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Dispose
+   */
+  public void dispose() {
+    for (Color c : fgColors.values()) {
+      c.dispose();
+    }
+    for (Color c : bgColors.values()) {
+      c.dispose();
+    }
+    for (Image i : icons.values()) {
+      i.dispose();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse
+   * .jface.viewers.CheckStateChangedEvent)
+   */
+  public void checkStateChanged(CheckStateChangedEvent event) {
+    // Checkstate anpassen
+    Object element = event.getElement();
+    if (element instanceof CEVAnnotationTreeNode) {
+      AnnotationFS annot = ((CEVAnnotationTreeNode) element).getAnnotation();
+
+      if (annotationState.containsKey(annot.getType())) {
+        HashMap<AnnotationFS, Boolean> map = annotationState.get(annot.getType());
+        if (map.containsKey(annot)) {
+          map.put(annot, event.getChecked());
+
+          int count = annotationStateCount.get(annot.getType());
+
+          if (event.getChecked())
+            count++;
+          else
+            count--;
+
+          annotationStateCount.put(annot.getType(), count);
+          annotationStateChanged(annot);
+        }
+      }
+    } else if (element instanceof CEVTypeTreeNode) {
+      Type type = ((CEVTypeTreeNode) element).getType();
+
+      if (annotationState.containsKey(type)) {
+        HashMap<AnnotationFS, Boolean> map = annotationState.get(type);
+        for (AnnotationFS a : map.keySet())
+          map.put(a, event.getChecked());
+
+        if (event.getChecked())
+          annotationStateCount.put(type, map.size());
+        else
+          annotationStateCount.put(type, 0);
+
+        if (!map.isEmpty())
+          annotationStateChanged(type);
+      }
+    } else if (element instanceof ICEVAnnotationNode) {
+      AnnotationFS annot = ((ICEVAnnotationNode) element).getAnnotation();
+
+      if (annotationState.containsKey(annot.getType())) {
+        HashMap<AnnotationFS, Boolean> map = annotationState.get(annot.getType());
+        if (map.containsKey(annot)) {
+          map.put(annot, event.getChecked());
+          int count = annotationStateCount.get(annot.getType());
+          if (event.getChecked())
+            count++;
+          else
+            count--;
+          annotationStateCount.put(annot.getType(), count);
+          annotationStateChanged(annot);
+        }
+      }
+    }
+  }
+
+  /**
+   * Alle StyleRanges
+   * 
+   * @return StyleRanges
+   */
+  public StyleRangeContainer getAllStyleRanges() {
+    return annotationRanges.getAllStyleRanges();
+  }
+
+  /**
+   * Alle StyleRanges fuer eine Annotation
+   * 
+   * @param annot
+   *          Annotation
+   * @return StyleRanges
+   */
+  public StyleRangeContainer getStyleRangesForAAnnotation(AnnotationFS annot) {
+    return annotationRanges.getStyleRangesForAAnnotation(annot);
+  }
+
+  /**
+   * HTML-ID fuer aktive Typen
+   * 
+   * @return Map
+   */
+  public Map<String, Type> getAllHtmlIdsAndActiveTypes() {
+    return annotationRanges.getAllHtmlIdsAndActiveTypes();
+  }
+
+  /**
+   * HTML-ID und Typen fuer Annotatioen
+   * 
+   * @param annot
+   *          Annotation
+   * @return Map
+   */
+  public Map<String, Type> getHtmlIdsAndActiveTypesForAAnnotation(AnnotationFS annot) {
+    return annotationRanges.getHtmlIdsAndActiveTypesForAAnnotation(annot);
+  }
+
+  /**
+   * Neue HTML-ID erzeugen
+   * 
+   * @return HTM_ID
+   */
+  public String getNextHtmlID() {
+    return idName + idCount++;
+  }
+
+  /**
+   * Pruefen Ob HTML-ID existiert
+   * 
+   * @param id
+   *          ID
+   * @return ja/nein
+   */
+  public boolean containsHtmlId(String id) {
+    return htmlElementPos.containsKey(id);
+  }
+
+  /**
+   * Postionen fuer eine HTMLId
+   * 
+   * @param id
+   *          ID
+   * @return Positionen
+   */
+  public int[] getHtmlElementPos(String id) {
+    if (htmlElementPos.containsKey(id))
+      return htmlElementPos.get(id);
+
+    return null;
+  }
+
+  public HashMap<Type, Integer> getAnnotationStateCount() {
+    return annotationStateCount;
+  }
+
+  public HashMap<Type, HashMap<AnnotationFS, Boolean>> getAnnotationState() {
+    return annotationState;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,186 @@
+package org.apache.uima.tm.cev.data;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.XmiCasDeserializer;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.metadata.FsIndexDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.tm.cev.CEVPlugin;
+import org.apache.uima.tools.stylemap.StyleMapEntry;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Klasse fuer ein CAS-File/XMI-File Es enthaehlt mehrere CAS-Views
+ * 
+ * @author Marco Nehmeier
+ */
+public class CEVDocument {
+
+  private ArrayList<CEVData> casData;
+
+  private CAS mainCAS;
+
+  private Object descriptor;
+
+  private Map<String, StyleMapEntry> style;
+
+  /**
+   * Konstruktor Oeffnet das Cas-File...
+   * 
+   * @param descriptorFile
+   *          Descriptor
+   * @param casFile
+   *          CAS-File
+   * @throws IllegalArgumentException
+   * @throws IOException
+   * @throws InvalidXMLException
+   * @throws SAXException
+   * @throws ResourceInitializationException
+   */
+  public CEVDocument(IFile descriptorFile, IFile casFile) throws IllegalArgumentException,
+          IOException, InvalidXMLException, SAXException, ResourceInitializationException {
+
+    casData = new ArrayList<CEVData>();
+
+    // Descriptor parsen
+    descriptor = UIMAFramework.getXMLParser().parse(
+            new XMLInputSource(descriptorFile.getLocation().toFile()));
+
+    mainCAS = null;
+
+    // CAS erzeugen
+    if (descriptor instanceof AnalysisEngineDescription) {
+      // not tested any more: use Type System!
+      mainCAS = CasCreationUtils.createCas((AnalysisEngineDescription) descriptor);
+    } else if (descriptor instanceof TypeSystemDescription) {
+      TypeSystemDescription tsDesc = (TypeSystemDescription) descriptor;
+      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
+      IProject project = descriptorFile.getProject();
+      // TODO hotfix for import by name
+      IFolder folder = project.getFolder("descriptor");
+      resMgr.setDataPath(folder.getLocation().toPortableString());
+      tsDesc.resolveImports(resMgr);
+      mainCAS = CasCreationUtils.createCas(tsDesc, null, new FsIndexDescription[0]);
+    } else {
+      throw new IllegalArgumentException("Invalid Type System Descriptor");
+    }
+
+    // CAS-File einlesen und deserialisieren
+    FileInputStream inputStream = null;
+    try {
+      inputStream = new FileInputStream(casFile.getLocation().toFile());
+      XmiCasDeserializer.deserialize(inputStream, mainCAS, true);
+    } finally {
+      if (inputStream != null)
+        inputStream.close();
+    }
+
+    // Stylemap einlesen (wenn vorhanden)
+    try {
+      String desc = descriptorFile.getFullPath().removeFileExtension().lastSegment();
+      if (desc.toLowerCase().endsWith("typesystem")) {
+        desc = desc.substring(0, desc.length() - 10);
+      }
+      String styleMap = desc.toLowerCase() + "stylemap.xml";
+
+      for (IResource r : descriptorFile.getParent().members())
+        if (r.getType() == IResource.FILE && r.getFullPath().lastSegment().startsWith(desc)
+                && r.getFullPath().lastSegment().toLowerCase().equals(styleMap)) {
+
+          style = StyleMapReader.parseStyleMapDOM(r.getLocation().toOSString());
+          break;
+        }
+
+    } catch (CoreException e) {
+      CEVPlugin.error(e);
+    }
+
+    Iterator viewIter = mainCAS.getViewIterator();
+
+    // LinkedList<CAS> views = new LinkedList<CAS>();
+
+    // einzenlnen Views auslesen
+    while (viewIter.hasNext())
+      casData.add(new CEVData((CAS) viewIter.next(), getStyleMap()));
+  }
+
+  /**
+   * Anzahl der Views
+   * 
+   * @return Anzahl
+   */
+  public int count() {
+    return casData.size();
+  }
+
+  /**
+   * View mit entsprechenden index
+   * 
+   * @param index
+   *          Index
+   * @return View
+   * @throws IndexOutOfBoundsException
+   */
+  public CEVData getCASData(int index) throws IndexOutOfBoundsException {
+    return casData.get(index);
+  }
+
+  /**
+   * alle Views
+   * 
+   * @return Views
+   */
+  public CEVData[] getCASData() {
+    return casData.toArray(new CEVData[casData.size()]);
+  }
+
+  /**
+   * Hauptview
+   * 
+   * @return View
+   */
+  public CAS getMainCas() {
+    return mainCAS;
+  }
+
+  public void dispose() {
+    for (CEVData each : casData) {
+      each.dispose();
+    }
+  }
+
+  public CAS createCas() throws ResourceInitializationException, InvalidXMLException {
+    // CAS erzeugen
+    if (descriptor instanceof AnalysisEngineDescription) {
+      return CasCreationUtils.createCas((AnalysisEngineDescription) descriptor);
+    } else if (descriptor instanceof TypeSystemDescription) {
+      TypeSystemDescription tsDesc = (TypeSystemDescription) descriptor;
+      tsDesc.resolveImports();
+      return CasCreationUtils.createCas(tsDesc, null, new FsIndexDescription[0]);
+    } else {
+      throw new IllegalArgumentException("Invalid Type System Descriptor");
+    }
+  }
+
+  public Map<String, StyleMapEntry> getStyleMap() {
+    return style;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVDocument.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,54 @@
+package org.apache.uima.tm.cev.data;
+
+import java.util.List;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+/**
+ * Interface fuer einen Listener der Annotationen im CEVData ueberwacht
+ * 
+ * @author Marco Nehmeier
+ */
+public interface ICEVAnnotationListener {
+
+  /**
+   * Annotation hinzugefuegt
+   * 
+   * @param annots
+   *          Annotation
+   */
+  public void annotationsAdded(List<AnnotationFS> annots);
+
+  /**
+   * Annotation entfernt
+   * 
+   * @param annots
+   *          Annotation
+   */
+  public void annotationsRemoved(List<AnnotationFS> annots);
+
+  /**
+   * Farbe hat sich geaendert
+   * 
+   * @param type
+   *          Annotations-Typ
+   */
+  public void colorChanged(Type type);
+
+  /**
+   * Aenderung an einem Annotations-Typ
+   * 
+   * @param type
+   *          Annotations-Typ
+   */
+  public void annotationStateChanged(Type type);
+
+  /**
+   * Aenderung an einer Annotation
+   * 
+   * @param annot
+   *          Annotation
+   */
+  public void annotationStateChanged(AnnotationFS annot);
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,17 @@
+package org.apache.uima.tm.cev.data;
+
+/**
+ * Listener-Interface fuer Selektionen von Annotationen im Dokument
+ * 
+ * @author Marco Nehmeier
+ */
+public interface ICEVAnnotationSelectionListener {
+
+  /**
+   * Neue Auswahl im Dokument
+   * 
+   * @param offset
+   *          Offset-Position
+   */
+  public void newSelection(int offset);
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVAnnotationSelectionListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,7 @@
+package org.apache.uima.tm.cev.data;
+
+public interface ICEVDataExtension {
+
+  void initialize();
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/ICEVDataExtension.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,262 @@
+package org.apache.uima.tm.cev.data;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.uima.tm.cev.CEVPlugin;
+import org.apache.uima.tools.stylemap.StyleMapEntry;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Utilityklasse zum lesen von Stylemaps
+ * 
+ * @author Marco Nehmeier
+ */
+public class StyleMapReader {
+
+  // Colormap
+  public static final Map<String, String> COLOR_NAME_MAP;
+
+  // Map mit Farben initialisieren
+  static {
+    COLOR_NAME_MAP = new HashMap<String, String>();
+    COLOR_NAME_MAP.put("#000000", "black");
+    COLOR_NAME_MAP.put("#c0c0c0", "silver");
+    COLOR_NAME_MAP.put("#808080", "gray");
+    COLOR_NAME_MAP.put("#ffffff", "white");
+    COLOR_NAME_MAP.put("#800000", "maroon");
+    COLOR_NAME_MAP.put("#ff0000", "red");
+    COLOR_NAME_MAP.put("#800080", "purple");
+    COLOR_NAME_MAP.put("#ff00ff", "fuchsia");
+    COLOR_NAME_MAP.put("#008000", "green");
+    COLOR_NAME_MAP.put("#00ff00", "lime");
+    COLOR_NAME_MAP.put("#808000", "olive");
+    COLOR_NAME_MAP.put("#ffff00", "yellow");
+    COLOR_NAME_MAP.put("#000080", "navy");
+    COLOR_NAME_MAP.put("#0000ff", "blue");
+    COLOR_NAME_MAP.put("#00ffff", "aqua");
+    COLOR_NAME_MAP.put("#000000", "black");
+    COLOR_NAME_MAP.put("#add8e6", "lightblue");
+    COLOR_NAME_MAP.put("#90ee90", "lightgreen");
+    COLOR_NAME_MAP.put("#ffa500", "orange");
+    COLOR_NAME_MAP.put("#ffc0cb", "pink");
+    COLOR_NAME_MAP.put("#fa8072", "salmon");
+    COLOR_NAME_MAP.put("#00ffff", "cyan");
+    COLOR_NAME_MAP.put("#ee82ee", "violet");
+    COLOR_NAME_MAP.put("#d2b48c", "tan");
+    COLOR_NAME_MAP.put("#a52a2a", "brown");
+    COLOR_NAME_MAP.put("#ffffff", "white");
+    COLOR_NAME_MAP.put("#9370db", "mediumpurple");
+
+    COLOR_NAME_MAP.put("black", "#000000");
+    COLOR_NAME_MAP.put("silver", "#c0c0c0");
+    COLOR_NAME_MAP.put("gray", "#808080");
+    COLOR_NAME_MAP.put("white", "#ffffff");
+    COLOR_NAME_MAP.put("maroon", "#800000");
+    COLOR_NAME_MAP.put("red", "#ff0000");
+    COLOR_NAME_MAP.put("purple", "#800080");
+    COLOR_NAME_MAP.put("fuchsia", "#ff00ff");
+    COLOR_NAME_MAP.put("green", "#008000");
+    COLOR_NAME_MAP.put("lime", "#00ff00");
+    COLOR_NAME_MAP.put("olive", "#808000");
+    COLOR_NAME_MAP.put("yellow", "#ffff00");
+    COLOR_NAME_MAP.put("navy", "#000080");
+    COLOR_NAME_MAP.put("blue", "#0000ff");
+    COLOR_NAME_MAP.put("aqua", "#00ffff");
+    COLOR_NAME_MAP.put("black", "#000000");
+    COLOR_NAME_MAP.put("lightblue", "#add8e6");
+    COLOR_NAME_MAP.put("lightgreen", "#90ee90");
+    COLOR_NAME_MAP.put("orange", "#ffa500");
+    COLOR_NAME_MAP.put("pink", "#ffc0cb");
+    COLOR_NAME_MAP.put("salmon", "#fa8072");
+    COLOR_NAME_MAP.put("cyan", "#00ffff");
+    COLOR_NAME_MAP.put("violet", "#ee82ee");
+    COLOR_NAME_MAP.put("tan", "#d2b48c");
+    COLOR_NAME_MAP.put("brown", "#a52a2a");
+    COLOR_NAME_MAP.put("white", "#ffffff");
+    COLOR_NAME_MAP.put("mediumpurple", "#9370db");
+  }
+
+  /**
+   * Stylemap einlesen und die Farbinformationen als Map zurueckgeben
+   * 
+   * @param styleFileString
+   *          Filename zur Stylemap
+   * @return Map mit Farbinformationen
+   */
+  public static Map<String, StyleMapEntry> parseStyleMapDOM(String styleFileString) {
+    File styleMapFile = new File(styleFileString);
+    Map<String, StyleMapEntry> result = new HashMap<String, StyleMapEntry>();
+    Document parse = null;
+
+    // Einlesen/parsen
+    try {
+      DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+      FileInputStream stream = new FileInputStream(styleMapFile);
+      parse = db.parse(stream);
+      stream.close();
+
+    } catch (FileNotFoundException e) {
+      CEVPlugin.error(e);
+      return null;
+
+    } catch (ParserConfigurationException e) {
+      CEVPlugin.error(e);
+      return null;
+
+    } catch (FactoryConfigurationError e) {
+      CEVPlugin.error(e);
+      return null;
+
+    } catch (SAXException e) {
+      CEVPlugin.error(e);
+      return null;
+
+    } catch (IOException e) {
+      CEVPlugin.error(e);
+      return null;
+    }
+
+    // Document analysieren
+    final Node root = parse.getDocumentElement();
+    final NodeList nodeList = root.getChildNodes();
+
+    for (int i = 0; i < nodeList.getLength(); ++i) {
+      final Node node = nodeList.item(i);
+      final String nodeName = node.getNodeName();
+      // "rule" node ?
+      if (!nodeName.equals("rule")) { //$NON-NLS-1$
+        continue;
+      }
+
+      // Collect type or pattern, label, and color text style
+      NodeList childrenList = node.getChildNodes();
+      String type = ""; //$NON-NLS-1$ 
+      String label = ""; //$NON-NLS-1$ 
+      String colorText = ""; //$NON-NLS-1$ 
+      for (int j = 0; j < childrenList.getLength(); ++j) {
+        final Node child = childrenList.item(j);
+        final String childName = child.getNodeName();
+
+        if (childName.equals("pattern")) { //$NON-NLS-1$ 
+          type = getTextValue(child);
+        } else if (childName.equals("label")) { //$NON-NLS-1$ 
+          label = getTextValue(child);
+        } else if (childName.equals("style")) { //$NON-NLS-1$ 
+          colorText = getTextValue(child);
+        }
+      }
+
+      StyleMapEntry styleMapEntry = getStyleMapEntry(type, label, colorText);
+      result.put(styleMapEntry.getAnnotationTypeName(), styleMapEntry);
+    }
+    return result;
+  }
+
+  /**
+   * String aus Stylemap nach Fraben parsen und ein StyleMapEntry zurueckgeben
+   * 
+   * @param type
+   *          Typ
+   * @param label
+   *          Label
+   * @param styleColor
+   *          String
+   * @return
+   */
+  protected static StyleMapEntry getStyleMapEntry(String type, String label, String styleColor) {
+    StyleMapEntry result = new StyleMapEntry();
+    result.setAnnotationTypeName(type);
+    result.setLabel(label);
+    StringTokenizer token = new StringTokenizer(styleColor, ":;");
+    if (!token.hasMoreTokens()) {
+      return null; // No token
+    }
+
+    token.nextToken();
+    String fgString = token.nextToken().toLowerCase().trim();
+    result.setForeground(parseColorForeground(fgString));
+
+    token.nextToken();
+    String bgString = token.nextToken().toLowerCase().trim();
+    result.setBackground(parseColorBackground(bgString));
+
+    boolean checked = false; // default to Checked
+    if (token.hasMoreTokens()) {
+      String ck = token.nextToken();
+      String tf = token.nextToken();
+      if (ck.equals("checked")) {
+        if (tf.equals("false")) {
+          checked = false;
+        } else if (tf.equals("true")) {
+          checked = true;
+        }
+      }
+    }
+    result.setChecked(checked);
+
+    boolean hidden = false;
+    if (token.hasMoreTokens()) {
+      String ck = token.nextToken();
+      String tf = token.nextToken();
+      if (ck.equals("hidden")) {
+        if (tf.equals("true")) {
+          hidden = true;
+        }
+      }
+    }
+    result.setHidden(hidden);
+    return result;
+  }
+
+  private static String getTextValue(final Node node) {
+    final Node first = node.getFirstChild();
+
+    if (first != null) {
+      return ((Text) first).getNodeValue().trim();
+
+    } else {
+      return null;
+    }
+  }
+
+  private static Color parseColorBackground(String color) {
+    if (color.startsWith("#")) {
+      return Color.decode(color);
+    } else {
+      String string = COLOR_NAME_MAP.get(color);
+      if (string != null)
+        return Color.decode(string);
+      else
+        return Color.LIGHT_GRAY;
+    }
+  }
+
+  private static Color parseColorForeground(String color) {
+    if (color.startsWith("#")) {
+      return Color.decode(color);
+    } else {
+      String string = COLOR_NAME_MAP.get(color);
+      if (string != null)
+        return Color.decode(string);
+      else
+        return Color.BLACK;
+    }
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/StyleMapReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,81 @@
+package org.apache.uima.tm.cev.data;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.apache.uima.tm.cev.CEVPlugin;
+
+
+public class TextFile2String {
+
+  private static String encoding = "UTF-8";
+
+  static {
+    // ResourceBundle ctuBundle = ResourceBundle.getBundle("converter");
+    // encoding = ctuBundle.getString("TextFileRecoder.encoding");
+  }
+
+  public static String read(File file) {
+    return read(file, encoding);
+  }
+
+  public static String read(File file, String encoding) {
+    StringBuffer contents = new StringBuffer();
+
+    BufferedReader input = null;
+    try {
+
+      InputStreamReader isr = encoding == null ? new FileReader(file) : new InputStreamReader(
+              new FileInputStream(file), encoding);
+
+      input = new BufferedReader(isr);
+      String line = null;
+
+      while ((line = input.readLine()) != null) {
+        contents.append(line);
+        contents.append(System.getProperty("line.separator"));
+      }
+    } catch (FileNotFoundException ex) {
+      CEVPlugin.error(ex);
+    } catch (IOException ex) {
+      CEVPlugin.error(ex);
+    } finally {
+      try {
+        if (input != null) {
+          // flush and close both "input" and its underlying
+          // FileReader
+          input.close();
+        }
+      } catch (IOException ex) {
+        CEVPlugin.error(ex);
+      }
+    }
+    return contents.toString();
+  }
+
+  public static void write(String content, File file) throws FileNotFoundException, IOException {
+    write(content, file, encoding);
+  }
+
+  public static void write(String content, File file, String enc) throws FileNotFoundException,
+          IOException {
+    Writer output = null;
+    try {
+      output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), enc));
+      output.write(content);
+    } finally {
+      if (output != null)
+        output.close();
+    }
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/TextFile2String.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,114 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * Abstrakter Node
+ * 
+ * @author Marco Nehmeier
+ */
+public abstract class CEVAbstractTreeNode implements ICEVTreeNode {
+
+  // Elternknoten
+  private ICEVTreeNode parent;
+
+  // Kinderknoten
+  private ArrayList<ICEVTreeNode> children;
+
+  /**
+   * Konstruktor
+   */
+  public CEVAbstractTreeNode() {
+    this(null);
+  }
+
+  /**
+   * Konstruktor
+   * 
+   * @param parent
+   *          Elternknoten
+   */
+  public CEVAbstractTreeNode(ICEVTreeNode parent) {
+    this.parent = parent;
+    children = new ArrayList<ICEVTreeNode>();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#addChild(org.apache.uima.tm.cev.data.tree.ICEVTreeNode)
+   */
+  public void addChild(ICEVTreeNode child) {
+    children.add(child);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getChildren()
+   */
+  public ICEVTreeNode[] getChildren() {
+    return children.toArray(new ICEVTreeNode[] {});
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getChildrenIterator()
+   */
+  public Iterator<ICEVTreeNode> getChildrenIterator() {
+    return children.iterator();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getParent()
+   */
+  public ICEVTreeNode getParent() {
+    return parent;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#hasChildren()
+   */
+  public boolean hasChildren() {
+    return children.size() > 0;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getNodes(java.util.LinkedList)
+   */
+  public void getNodes(LinkedList<ICEVTreeNode> list) {
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    // ueber die Knoten iterieren
+    while (iter.hasNext()) {
+      ICEVTreeNode node = iter.next();
+
+      list.add(node);
+
+      node.getNodes(list);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#sort(java.util.Comparator)
+   */
+  public void sort(Comparator<ICEVTreeNode> cp) {
+    Collections.sort(children, cp);
+
+    // for (ICEVTreeNode node : children)
+    // node.sort(cp);
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAbstractTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,102 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+/**
+ * Wurzelknoten fuer einen Annotationssortierten Baum
+ * 
+ * @author Marco Nehmeier
+ * 
+ */
+public class CEVAnnotationOrderedRootTreeNode extends CEVAnnotationOrderedTreeNode implements
+        ICEVRootTreeNode {
+
+  /**
+   * Konstruktor
+   */
+  public CEVAnnotationOrderedRootTreeNode() {
+    super(null, null);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.CEVAnnotationTreeNode#getName()
+   */
+  @Override
+  public String getName() {
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.CEVAnnotationTreeNode#getType()
+   */
+  @Override
+  public Type getType() {
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.CEVAnnotationTreeNode#getAnnotation()
+   */
+  @Override
+  public AnnotationFS getAnnotation() {
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes()
+   */
+  public LinkedList<ICEVTreeNode> getNodes() {
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+
+    getNodes(list);
+
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes(org.apache.uima.cas.Type)
+   */
+  public LinkedList<ICEVTreeNode> getNodes(Type type) {
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+
+    getNodes(list, type);
+
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes(org.apache.uima.cas.text.AnnotationFS)
+   */
+  public LinkedList<ICEVTreeNode> getNodes(AnnotationFS annot) {
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+
+    getNodes(list, annot);
+
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#sort()
+   */
+  public void sort() {
+    sort(new CEVTreeComparator());
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedRootTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,122 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+/**
+ * Node fuer eine Annotation fuer Baum mit Annotationsordnung
+ * 
+ * @author Marco Nehmeier
+ */
+public class CEVAnnotationOrderedTreeNode extends CEVAnnotationTreeNode {
+
+  /**
+   * Konstruktor
+   * 
+   * @param parent
+   *          Elternknoten
+   * @param annotation
+   *          Annotation
+   */
+  public CEVAnnotationOrderedTreeNode(ICEVTreeNode parent, AnnotationFS annotation) {
+    super(parent, annotation);
+  }
+
+  /**
+   * Annotation einfuegen
+   * 
+   * @param annotation
+   *          Annotation
+   */
+  public void insertFS(FeatureStructure fs) {
+    boolean processed = false;
+
+    if (!(fs instanceof AnnotationFS))
+      return;
+
+    AnnotationFS annotation = (AnnotationFS) fs;
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    // ueber alle Annotationen und Position suchen
+    while (iter.hasNext()) {
+      CEVAnnotationOrderedTreeNode childNode = (CEVAnnotationOrderedTreeNode) iter.next();
+
+      // Position gefunden
+      if (isChild(childNode, annotation)) {
+        childNode.insertFS(annotation);
+        processed = true;
+      }
+    }
+
+    // Wenn nicht gefunden
+    if (!processed) {
+      CEVAnnotationOrderedTreeNode node = new CEVAnnotationOrderedTreeNode(this, annotation);
+      addChild(node);
+    }
+  }
+
+  /**
+   * Pruefen ob Annotation im Bereich von Node liegt
+   * 
+   * @param node
+   *          Node
+   * @param annotation
+   *          Annotation
+   * @return ja/nein
+   */
+  private boolean isChild(CEVAnnotationOrderedTreeNode node, AnnotationFS annotation) {
+    return (node.getAnnotation().getBegin() < annotation.getBegin() && node.getAnnotation()
+            .getEnd() >= annotation.getEnd())
+            || (node.getAnnotation().getBegin() <= annotation.getBegin() && node.getAnnotation()
+                    .getEnd() > annotation.getEnd());
+  }
+
+  /**
+   * Gibt die Knoten eines Typs in der Liste zurueck
+   * 
+   * @param list
+   *          Liste
+   * @param type
+   *          Typ
+   */
+  public void getNodes(LinkedList<ICEVTreeNode> list, Type type) {
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    // Typ suchen
+    while (iter.hasNext()) {
+      CEVAnnotationOrderedTreeNode node = (CEVAnnotationOrderedTreeNode) iter.next();
+
+      if (node.getType().equals(type))
+        list.add(node);
+
+      node.getNodes(list, type);
+    }
+  }
+
+  /**
+   * Gibt die Knoten einer Annotation in der Liste zurueck
+   * 
+   * @param list
+   *          Liste
+   * @param annot
+   *          Annotation
+   */
+  public void getNodes(LinkedList<ICEVTreeNode> list, AnnotationFS annot) {
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    // Annotation suchen
+    while (iter.hasNext()) {
+      CEVAnnotationOrderedTreeNode node = (CEVAnnotationOrderedTreeNode) iter.next();
+
+      if (node.getAnnotation().equals(annot))
+        list.add(node);
+      else if (isChild(node, annot))
+        node.getNodes(list, annot);
+    }
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationOrderedTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,23 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+public class CEVAnnotationTreeNode extends CEVFSTreeNode implements ICEVAnnotationNode {
+
+  public CEVAnnotationTreeNode(AnnotationFS annotation) {
+    super(annotation);
+  }
+
+  public CEVAnnotationTreeNode(ICEVTreeNode parent, AnnotationFS annotation) {
+    super(parent, annotation);
+  }
+
+  public AnnotationFS getAnnotation() {
+    return (AnnotationFS) fs;
+  }
+
+  @Override
+  public String getName() {
+    return getAnnotation().getCoveredText();
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVAnnotationTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,113 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import org.apache.uima.cas.ArrayFS;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public class CEVFSTreeNode extends CEVAbstractTreeNode {
+
+  protected FeatureStructure fs;
+
+  /**
+   * Konstruktor
+   * 
+   * @param fs
+   *          Annotation
+   */
+  public CEVFSTreeNode(FeatureStructure thisFS) {
+    super();
+    this.fs = thisFS;
+
+    // Features auslesen und als Kinder setzen
+    for (Feature f : thisFS.getType().getFeatures()) {
+      if (f.getRange().isPrimitive()) {
+        addChild(new CEVFeatureTreeNode(this, f, thisFS.getFeatureValueAsString(f)));
+      }
+    }
+
+  }
+
+  /**
+   * Konstruktor
+   * 
+   * @param parent
+   *          Elternknoten
+   * @param fs
+   *          Annotation
+   */
+  public CEVFSTreeNode(ICEVTreeNode parent, FeatureStructure annotation) {
+    super(parent);
+    this.fs = annotation;
+    for (Feature f : annotation.getType().getFeatures()) {
+      addFeatures(this, f, annotation);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getName()
+   */
+  public String getName() {
+    return fs.getType().getShortName();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getType()
+   */
+  public Type getType() {
+    return fs.getType();
+  }
+
+  public void addFeatures(ICEVTreeNode parent, Feature f, FeatureStructure featureStructure) {
+    if (f.getRange().isArray()) {
+      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
+      if (featureValue instanceof ArrayFS) {
+        ArrayFS array = (ArrayFS) featureValue;
+        if (array != null) {
+          String text = "Array" + "[" + array.size() + "]";
+          CEVFeatureTreeNode arrayNode = new CEVFeatureTreeNode(this, f, text);
+          parent.addChild(arrayNode);
+
+          int size = array.size();
+
+          for (int i = 0; i < size; i++) {
+            FeatureStructure fs = array.get(i);
+            if (fs instanceof FeatureStructure) {
+              Type fsType = fs.getType();
+              ICEVTreeNode fsNode;
+              if (fs instanceof AnnotationFS) {
+                AnnotationFS faa = (AnnotationFS) fs;
+                fsNode = new CEVAnnotationTreeNode(arrayNode, faa);
+              } else {
+                fsNode = new CEVTypeTreeNode(arrayNode, fsType);
+              }
+              arrayNode.addChild(fsNode);
+
+              // List<Feature> features = fs.getType().getFeatures();
+              // for (Feature feature : features) {
+              // addFeatures(fsNode, feature, fs);
+              // }
+            }
+          }
+        }
+      }
+    } else if (f.getRange().isPrimitive()) {
+      if ("uima.cas.AnnotationBase:sofa".equals(f.getName())) {
+      } else {
+        parent
+                .addChild(new CEVFeatureTreeNode(this, f, featureStructure
+                        .getFeatureValueAsString(f)));
+      }
+    } else if (f.getRange() instanceof Type) {
+      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
+      if (featureValue instanceof AnnotationFS) {
+        parent.addChild(new CEVAnnotationTreeNode(this, ((AnnotationFS) featureValue)));
+      }
+    }
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFSTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,139 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+
+/**
+ * Node fuer ein Feature
+ * 
+ * @author Marco Nehmeier
+ * 
+ */
+public class CEVFeatureTreeNode implements ICEVTreeNode {
+
+  // Elternknoten
+  private ICEVTreeNode parent;
+
+  // Feature
+  private Feature f;
+
+  // Wert
+  private String value;
+
+  // Liste mit Kinderknoten
+  private ArrayList<ICEVTreeNode> children;
+
+  /**
+   * Konstruktor
+   * 
+   * @param parent
+   *          Elternknoten
+   * @param f
+   *          Feature
+   * @param value
+   *          Wert
+   */
+  public CEVFeatureTreeNode(ICEVTreeNode parent, Feature f, String value) {
+    this.parent = parent;
+    this.f = f;
+    this.value = value;
+    this.children = new ArrayList<ICEVTreeNode>();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#addChild(org.apache.uima.tm.cev.data .tree.ICEVTreeNode)
+   */
+  public void addChild(ICEVTreeNode child) {
+    this.children.add(child);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getChildren()
+   */
+  public ICEVTreeNode[] getChildren() {
+    return this.children.toArray(new ICEVTreeNode[] {});
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getChildrenIterator()
+   */
+  public Iterator<ICEVTreeNode> getChildrenIterator() {
+    return this.children.iterator();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getName()
+   */
+  public String getName() {
+    return f.getShortName() + " : " + value;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getNodes(java.util.LinkedList)
+   */
+  public void getNodes(LinkedList<ICEVTreeNode> list) {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getParent()
+   */
+  public ICEVTreeNode getParent() {
+    return parent;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getType()
+   */
+  public Type getType() {
+    return f.getRange();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#hasChildren()
+   */
+  public boolean hasChildren() {
+    if (children.size() > 0) {
+      return true;
+    }
+    return false;
+  }
+
+  public Feature getFeature() {
+    return this.f;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#sort(java.util.Comparator)
+   */
+  public void sort(Comparator<ICEVTreeNode> cp) {
+    // nothing to do
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVFeatureTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,18 @@
+package org.apache.uima.tm.cev.data.tree;
+
+/**
+ * Comparator fuer TreeNodes. Vergleicht den Namen fuer eine alphabetische Sortierung
+ * 
+ * @author Marco Nehmeier
+ */
+public class CEVTreeComparator implements java.util.Comparator<ICEVTreeNode> {
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+   */
+  public int compare(ICEVTreeNode o1, ICEVTreeNode o2) {
+    return o1.getName().compareToIgnoreCase(o2.getName());
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTreeComparator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,167 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public class CEVTypeOrderedRootTreeNode extends CEVAbstractTreeNode implements ICEVRootTreeNode {
+
+  /**
+   * Konstruktor
+   */
+  public CEVTypeOrderedRootTreeNode() {
+    super();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getName()
+   */
+  public String getName() {
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getType()
+   */
+  public Type getType() {
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#insertAnnotation(org.apache.uima.cas.text.AnnotationFS
+   * )
+   */
+  public void insertFS(FeatureStructure fs) {
+    // TODO hotfix...
+    if (fs.getType().getShortName().equals("DebugBlockApply")
+            || fs.getType().getShortName().equals("DebugMatchedRuleMatch")
+            || fs.getType().getShortName().equals("DebugFailedRuleMatch")
+            || fs.getType().getShortName().equals("DebugScriptApply")
+            || fs.getType().getShortName().equals("DebugRuleElementMatches")
+            || fs.getType().getShortName().equals("DebugRuleElementMatch")) {
+      return;
+    }
+
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    // pruefen ob Typ schon im Baum existiert, wenn ja Annotation da
+    // einhaengen und
+    // Methode verlassen
+    while (iter.hasNext()) {
+      CEVTypeTreeNode typeNode = (CEVTypeTreeNode) iter.next();
+
+      if (typeNode.getType().equals(fs.getType())) {
+        CEVFSTreeNode node = createFSNode(typeNode, fs);
+        typeNode.addChild(node);
+        return;
+      }
+    }
+
+    // Type-Node erzeugen
+    CEVTypeTreeNode typeNode = new CEVTypeTreeNode(this, fs.getType());
+    addChild(typeNode);
+
+    // Annotation-Node erzeugen
+    CEVFSTreeNode node = createFSNode(typeNode, fs);
+    typeNode.addChild(node);
+  }
+
+  private CEVFSTreeNode createFSNode(ICEVTreeNode parent, FeatureStructure fs) {
+    if (fs instanceof AnnotationFS) {
+      return new CEVAnnotationTreeNode(parent, (AnnotationFS) fs);
+    }
+    return new CEVFSTreeNode(parent, fs);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes()
+   */
+  public LinkedList<ICEVTreeNode> getNodes() {
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+    getNodes(list);
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes(org.apache.uima.cas.Type)
+   */
+  public LinkedList<ICEVTreeNode> getNodes(Type type) {
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+
+    // Typ suchen
+    while (iter.hasNext()) {
+      CEVTypeTreeNode typeNode = (CEVTypeTreeNode) iter.next();
+
+      // wenn Typ gefunden, Liste fuellen
+      if (typeNode.getType().equals(type)) {
+        Iterator<ICEVTreeNode> children = typeNode.getChildrenIterator();
+
+        list.add(typeNode);
+
+        while (children.hasNext())
+          list.add(children.next());
+      }
+    }
+
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#getNodes(org.apache.uima.cas.text.AnnotationFS)
+   */
+  public LinkedList<ICEVTreeNode> getNodes(AnnotationFS annot) {
+    Iterator<ICEVTreeNode> iter = getChildrenIterator();
+
+    LinkedList<ICEVTreeNode> list = new LinkedList<ICEVTreeNode>();
+
+    // ueber alle Knoten
+    while (iter.hasNext()) {
+      CEVTypeTreeNode typeNode = (CEVTypeTreeNode) iter.next();
+
+      // Annotation gefunden
+      if (typeNode.getType().equals(annot.getType())) {
+        Iterator<ICEVTreeNode> children = typeNode.getChildrenIterator();
+
+        // ueber die Kinder
+        while (children.hasNext()) {
+          CEVAnnotationTreeNode node = (CEVAnnotationTreeNode) children.next();
+
+          if (node.getAnnotation().equals(annot)) {
+            list.add(node);
+            return list;
+          }
+        }
+      }
+    }
+
+    return list;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVRootTreeNode#sort()
+   */
+  public void sort() {
+    sort(new CEVTreeComparator());
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeOrderedRootTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,55 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import org.apache.uima.cas.Type;
+
+/**
+ * Ein Node fuer einen Type
+ * 
+ * @author Marco Nehmeier
+ */
+public class CEVTypeTreeNode extends CEVAbstractTreeNode {
+
+  // der Typ
+  private Type type;
+
+  /**
+   * Konstruktor
+   * 
+   * @param type
+   *          Type
+   */
+  public CEVTypeTreeNode(Type type) {
+    this(null, type);
+  }
+
+  /**
+   * Konstruktor
+   * 
+   * @param parent
+   *          Elternknoten
+   * @param type
+   *          Type
+   */
+  public CEVTypeTreeNode(ICEVTreeNode parent, Type type) {
+    super(parent);
+    this.type = type;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getName()
+   */
+  public String getName() {
+    return type.getName();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.uima.tm.cev.data.tree.ICEVTreeNode#getType()
+   */
+  public Type getType() {
+    return type;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/CEVTypeTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,9 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+public interface ICEVAnnotationNode {
+
+  AnnotationFS getAnnotation();
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVAnnotationNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,20 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public interface ICEVRootTreeNode extends ICEVTreeNode {
+
+  public void insertFS(FeatureStructure annotation);
+
+  public LinkedList<ICEVTreeNode> getNodes();
+
+  public LinkedList<ICEVTreeNode> getNodes(Type type);
+
+  public LinkedList<ICEVTreeNode> getNodes(AnnotationFS annot);
+
+  public void sort();
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVRootTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java Mon Aug  1 13:53:56 2011
@@ -0,0 +1,81 @@
+package org.apache.uima.tm.cev.data.tree;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Type;
+
+/**
+ * Interface fuer eine TreeNode fuer die Anzeige von Typen/Annotationen in den Views
+ * 
+ * @author Marco Nehmeier
+ */
+public interface ICEVTreeNode {
+
+  /**
+   * Fuegt ein Node als Kind hinzu
+   * 
+   * @param child
+   *          Node
+   */
+  public void addChild(ICEVTreeNode child);
+
+  /**
+   * Gibt alle Kindknoten zurueck
+   * 
+   * @return Nodes
+   */
+  public ICEVTreeNode[] getChildren();
+
+  /**
+   * Gibt einen Iterator ueber die Kinder zurueck
+   * 
+   * @return Iterator
+   */
+  public Iterator<ICEVTreeNode> getChildrenIterator();
+
+  /**
+   * Gibt die Stringrep. des Nodes zurueck
+   * 
+   * @return Stringrep.
+   */
+  public String getName();
+
+  /**
+   * Gibt den Eltern-Node zurueck
+   * 
+   * @return Node
+   */
+  public ICEVTreeNode getParent();
+
+  /**
+   * Sind Kinder vorhanden?
+   * 
+   * @return Kinder ja/nein
+   */
+  public boolean hasChildren();
+
+  /**
+   * Gibt den Typ zurueck
+   * 
+   * @return Typ
+   */
+  public Type getType();
+
+  /**
+   * Fuellt eine Liste mit allen Nodes aus dem (Teil)Baum in In-Order-Reihenfolge
+   * 
+   * @param list
+   *          Liste
+   */
+  public void getNodes(LinkedList<ICEVTreeNode> list);
+
+  /**
+   * Sortiert die Kinder anhand eines Comparators
+   * 
+   * @param cp
+   *          Comparator
+   */
+  public void sort(Comparator<ICEVTreeNode> cp);
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/tree/ICEVTreeNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain