You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2008/07/02 16:46:38 UTC

svn commit: r673409 [1/10] - in /incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src: ./ main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/uima/ main/java/org/apache/uima/casviewer/ main/java/org/apa...

Author: schor
Date: Wed Jul  2 07:46:35 2008
New Revision: 673409

URL: http://svn.apache.org/viewvc?rev=673409&view=rev
Log:
[UIMA-1102] initial import

Added:
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeSystemUtilModified.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeSystemUtils2.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeTree.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/UFSIndex.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/UFeature.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/UFeatureStructure.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/casreader/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/casreader/CASViewerException.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/casreader/XcasOrXmiUtil.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/casreader/XcasReader.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/style/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/style/BaseColor.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/style/BaseTypeStyle.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/style/TypesystemBaseStyle.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/tree/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/tree/TreeNode.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/CasViewerCoreActivator.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/Messages.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/annotations/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/annotations/FSContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/annotations/FSSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/annotations/FeatureStructureViewerFilter.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/annotations/FeatureViewerFilter.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/AbstractAnnotatedTextSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/AnnotatedTextComposite.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/AnnotatedTextSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/AnnotationScanner.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasSourceViewer.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/FSIndexContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/FSIndexLabelProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/FSIndexSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/model/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/model/ICASViewControl.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/model/ICASViewer.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/model/ICASViewerListener.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/ColorManager.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/ColoredTypeTreeContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/ColoredTypeTreeLabelProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/ColoredTypeTreeSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/DefaultColorTreeLabelProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/DefaultColorTreeSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/TypeStyle.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/style/TypeSystemStyle.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/type/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/type/TypeSystemSorter.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/type/TypesTreeContentProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/type/TypesTreeLabelProvider.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/type/TypesTreeSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/AbstractSectionPart.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/CustomCheckedTreeViewer.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/Form2Panel.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/FormSection.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/IObjectSelectionListener.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/util/TreeViewerHelper.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/common/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/common/internal/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/common/internal/images/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/common/internal/images/ImageLoader.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/common/internal/images/UimaToolsImagesPlugin.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/debug/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/debug/util/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/debug/util/Trace.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/internal/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/internal/util/
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/internal/util/CasHelper.java   (with props)
    incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/tools/internal/util/UimaToolsUtil.java   (with props)

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,275 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.List;
+
+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;
+import org.apache.uima.casviewer.core.internal.style.BaseTypeStyle;
+
+
+public class AnnotationObject // implements ITreeNodeComparator 
+{
+    protected static Object[] EMPTY_ARRAY = new Object[0];
+
+    public Type      type;
+    public int       begin;
+    public int       end;
+    public boolean   show = false;   
+
+    protected FeatureStructure      featureStructure;
+    
+    // Used by CASDiff
+    public static final int         DIFF_STATUS_NONE    = 0x00;
+    public static final int         DIFF_STATUS_ADDED   = 0x01;
+    public static final int         DIFF_STATUS_DELETED = 0x02;
+    public static final int         DIFF_STATUS_MATCH   = 0x04;
+    
+    protected int                   diffStatus;         // DIFF_STATUS_xxx
+    protected String                textSpan;
+
+    protected boolean annotationFS = true;
+    
+    /*************************************************************************/
+    public AnnotationObject(FeatureStructure fs) {
+        this.type   = fs.getType();
+        featureStructure = fs;
+        if (fs instanceof AnnotationFS) {
+            this.textSpan = ((AnnotationFS) fs).getCoveredText();
+            this.begin = ((AnnotationFS) fs).getBegin();
+            this.end = ((AnnotationFS) fs).getEnd();
+        } else {
+            annotationFS = false;
+        }
+    }
+    
+    protected AnnotationObject(AnnotationFS f, String text) {
+        this((FeatureStructure)f, text);
+    }
+
+    public AnnotationObject(FeatureStructure f, String text) {
+        this.type   = f.getType();
+        featureStructure = f;
+        textSpan = text;
+    }
+
+    public AnnotationObject (FeatureStructure f, int begin, int end) {
+        this.type   = f.getType();
+        this.begin  = begin;
+        this.end    = end;
+        this.featureStructure = f;
+    }
+    
+    public AnnotationObject (FeatureStructure f, int begin, int end, boolean show) {
+        this.type   = f.getType();
+        this.featureStructure = f;
+        this.begin  = begin;
+        this.end    = end;
+        this.show   = show;
+    }
+    
+    public AnnotationObject cloneMe () {
+        AnnotationObject c = new AnnotationObject(featureStructure, begin, end, show);
+        c.diffStatus = diffStatus;
+        c.textSpan   = textSpan;
+        return c;
+    }
+
+    /*************************************************************************/
+    
+    public Type getType () {
+        return type;
+    }
+    
+    public String getTypeName() {
+        return type.getName();
+    }
+
+    public String getAnnotationTypeShortName() {
+        return type.getShortName();
+    }
+
+    /**
+     * @return Returns the show.
+     */
+    public boolean isShow() {
+        return show;
+    }
+
+    /**
+     * @param show The show to set.
+     */
+    public void setShow(boolean show) {
+        this.show = show;
+    }
+
+    /*************************************************************************/
+    /*                          For CASDiff                                  */ 
+    /*************************************************************************/
+
+    public String getText ()
+    {
+        return textSpan;
+    }
+    
+    public void setTextSpan (String t) {
+        textSpan = t;
+    }
+    public String getTypeShortName () {
+        return featureStructure.getType().getShortName();
+    }
+    
+    public FeatureStructure getFeatureStructure() {
+        return featureStructure;
+    }
+
+    public void setFeatureStructure(FeatureStructure fs) {
+        featureStructure = fs;
+    }
+
+    /* (non-Javadoc)
+     * @see com.ibm.uima.tools.casdiff.ITreeNodeComparator#getChildren()
+     */
+    public Object[] getFeatures() {
+        if (featureStructure == null) {
+            return EMPTY_ARRAY;
+        }
+        List<Feature> aFeatures = featureStructure.getType().getFeatures();
+        if (aFeatures.size() > 0) {
+            Object[] objs = new Object[aFeatures.size()];
+            for (int i=0; i<aFeatures.size(); ++i) {
+                objs[i] = new UFeature(featureStructure, aFeatures.get(i));
+                // objs[i] = (Feature) aFeatures.get(i);
+            }
+            return objs;
+        }            
+        
+        return EMPTY_ARRAY;
+    }
+
+    /*************************************************************************/
+    
+    /**
+     * Compare FeatureStructure with "other"
+     * 
+     * @param other
+     * @return int  -1 if this.begin < other.begin;
+     *               0 equal;
+     *               1 if this.begin > other.begin;
+     */
+    public int compareFS(AnnotationObject other) {
+        if ( other == null ) {
+            return 1;
+        }
+        
+        FeatureStructure otherF = ((AnnotationObject) other).featureStructure;
+        if (featureStructure instanceof AnnotationFS) {
+            if ( ((AnnotationFS) featureStructure).getBegin() == ((AnnotationFS) otherF).getBegin() 
+                 && ((AnnotationFS) featureStructure).getEnd() == ((AnnotationFS) otherF).getEnd() ) {
+                return 0;
+            } else {
+                if ( ((AnnotationFS) featureStructure).getBegin() < ((AnnotationFS) otherF).getBegin() ) {
+                    return -1;
+                } else {
+                    return 1;
+                }
+            }
+        }
+        
+        if ( featureStructure.getType().getName().equals(otherF.getType().getName()) ) {
+            return 0;
+        } else {               
+            return 0;
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see com.ibm.uima.tools.casdiff.ITreeNodeComparator#compareContents(java.lang.Object, java.lang.Object)
+     */
+    public int compareContents(Object other) {
+        if (other != null && getClass() == other.getClass()) {
+            int c = textSpan.compareTo(((AnnotationObject)other).getText());
+            return c;
+        }
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.ibm.uima.tools.casdiff.ITreeNodeComparator#getChildren()
+     */
+    public Object[] getChildren() {
+        return EMPTY_ARRAY;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     * 
+     * Note: getLabel() == null when compare to FS that is NOT an AnnotationFS 
+     */
+//    public boolean equals(Object other) {
+//        if ( other != null && getClass() == other.getClass()
+//                && getLabel().equals(((AnnotationObject) other).getLabel()) ) {
+//            FeatureStructure otherF = ((AnnotationObject) other).featureStructure;
+//            if (featureStructure instanceof AnnotationFS) {
+//                if ( ((AnnotationFS) featureStructure).getBegin() == ((AnnotationFS) otherF).getBegin() 
+//                     && ((AnnotationFS) featureStructure).getEnd() == ((AnnotationFS) otherF).getEnd() ) {
+//                    return true;
+//                } else {
+//                    return false;
+//                }
+//            }
+//            
+//            if ( featureStructure.getType().getName().equals(otherF.getType().getName()) ) {
+//                return true;
+//            }
+//        }
+//        
+//        return super.equals(other);
+//    }
+//
+//    /* (non-Javadoc)
+//     * @see java.lang.Object#hashCode()
+//     */
+//    public int hashCode() {
+//        int hashCode= 1;
+//        return hashCode;
+//    }
+
+    /* (non-Javadoc)
+     * @see com.ibm.uima.tools.casdiff.ITreeNode#getLabel()
+     */
+    public String getLabel() {
+        return getText ();
+    }
+
+    /**
+     * @return the diffStatus
+     */
+    public int getDiffStatus() {
+        return diffStatus;
+    }
+
+    /**
+     * @param diffStatus the diffStatus to set
+     */
+    public void setDiffStatus(int diffStatus) {
+        this.diffStatus = diffStatus;
+    }
+
+    /**
+     * @return the annotationFS
+     */
+    public boolean isAnnotationFS() {
+        return annotationFS;
+    }
+
+    /**
+     * @param annotationFS the annotationFS to set
+     */
+    public void setAnnotationFS(boolean annotationFS) {
+        this.annotationFS = annotationFS;
+    }
+    
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,35 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.List;
+
+/**
+ * A node that contains a list of AnnotationObject(s)
+ * 
+ */
+public class AnnotationObjectsNode {
+
+    protected List<AnnotationObject> annotationList;
+    
+    public AnnotationObjectsNode () {
+        
+    }
+
+    public AnnotationObjectsNode(List<AnnotationObject> list) {
+        annotationList = list;
+    }
+
+    /**
+     * @return the annotationList
+     */
+    public List<AnnotationObject> getAnnotationList() {
+        return annotationList;
+    }
+
+    /**
+     * @param annotationList the annotationList to set
+     */
+    public void setAnnotationList(List<AnnotationObject> list) {
+        this.annotationList = list;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/AnnotationObjectsNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,203 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.SofaFS;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.casviewer.core.internal.style.TypesystemBaseStyle;
+import org.apache.uima.resource.metadata.TypePriorities;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.util.TypeSystemUtil;
+ 
+/**
+ *  This class wraps UIMA BaseCAS and other objects related to CAS 
+ *  
+ *  Each BaseCASObject has multiple ICASObjectView which are accessed by Ids.
+ *  Each ICASObjectView is associated with a sofa name by registration.
+ *  
+ *  
+ *  Base CAS has:                       <---> BaseCASObject
+ *   - Multiple CAS Views              
+ *   
+ *  CAS View has:                        <---> CASObjectView (ICASObjectView)
+ *   - associated Sofa identified 
+ *   by Sofa name (or Sofa Id)
+ *   - index repository
+ *  
+ *
+ */
+public class BaseCASObject {
+    
+    protected CAS                   aBaseCAS;
+    protected TypeSystem            typeSystem;
+    protected TypeSystemDescription typeSystemDescription;
+    protected TypePriorities        typePriorities;
+    protected Map<String,ICASObjectView>  mapSofIdToCASView = new TreeMap<String,ICASObjectView>();
+    protected TypeTree              typeTree;
+    
+    protected String                xmiFileLocation = null; // Full path to xmi file
+    /*************************************************************************/
+
+    public BaseCASObject(CAS aCAS) 
+    {
+        super();
+        this.aBaseCAS = aCAS;
+        this.typeSystemDescription =
+            TypeSystemUtil.typeSystem2TypeSystemDescription (aCAS.getTypeSystem());
+        this.typePriorities = null;
+    }
+    
+    public BaseCASObject(CAS aCAS, TypeSystemDescription typeSystemDescription,
+                               TypePriorities typePriorities) {
+        super();
+        this.aBaseCAS = aCAS;
+        this.typeSystemDescription = typeSystemDescription;
+        this.typePriorities = typePriorities;
+        // CAS defaultView = aCAS.getView(CAS.NAME_DEFAULT_SOFA);
+    }
+    
+    public BaseCASObject(CAS aCAS, TypePriorities typePriorities) 
+    {
+        super();
+        this.aBaseCAS = aCAS;
+        this.typeSystemDescription =
+            TypeSystemUtil.typeSystem2TypeSystemDescription (aCAS.getTypeSystem());
+        this.typePriorities = typePriorities;
+    }
+        
+    public ICASObjectView getCASView (String sofaId)
+    {
+        return (ICASObjectView) mapSofIdToCASView.get(sofaId);        
+    }
+ 
+    public ICASObjectView getDefaultCASView ()
+    {
+        return (ICASObjectView) mapSofIdToCASView.get("Default Sofa");        
+    }
+    
+    public Collection<ICASObjectView> getCASViews () {
+        return mapSofIdToCASView.values();
+    }
+
+    public Object registerCASView (String sofaId, ICASObjectView aICASView) {
+        return mapSofIdToCASView.put(sofaId, aICASView);
+    }
+    
+    public Object unregisterCASView (String sofaId) {
+        return mapSofIdToCASView.remove(sofaId);
+    }    
+    
+    /**
+     * Register ALL ICASObjectView(s) of the specified BaseCASObject
+     * 
+     * @param aCASObject
+     * @return void
+     */
+    static public void registerCASViews (BaseCASObject aCASObject)
+    {
+        FSIterator it = aCASObject.getCAS().getSofaIterator();
+        while (it.hasNext()) {
+            SofaFS sofa = (SofaFS) it.next();
+            aCASObject.mapSofIdToCASView.put(sofa.getStringValue(sofa.getType().getFeatureByBaseName(CAS.FEATURE_BASE_NAME_SOFAID)),  
+                    new CASObjectView(aCASObject, sofa));
+        }             
+    }
+    
+    /*************************************************************************/
+
+    public TypeTree getTypeTree ()
+    {
+        if (typeTree == null) {
+            typeTree = TypeTree.createTypeTreeFromTypeSystemDescription(typeSystemDescription);
+        }
+        return typeTree;
+    }
+
+    public TypeTree newTypeTree ()
+    {
+        return TypeTree.createTypeTreeFromTypeSystemDescription(typeSystemDescription);
+    }
+    
+    /*************************************************************************/
+    // May create a subclass and support getTypeSystemStyle(sofId) per Sofa
+    
+    protected TypesystemBaseStyle       typeSystemStyle;
+    
+    /**
+     * @return the typeSystemStyle
+     */
+    public TypesystemBaseStyle getTypeSystemStyle() {
+        return typeSystemStyle;
+    }
+
+    /**
+     * @param typeSystemStyle the typeSystemStyle to set
+     */
+    public void setTypeSystemStyle(TypesystemBaseStyle typeSystemStyle) {
+        this.typeSystemStyle = typeSystemStyle;
+    }
+    
+    /*************************************************************************/
+
+
+    /**
+     * @return Returns the typePriorities.
+     */
+    public TypePriorities getTypePriorities() {
+        return typePriorities;
+    }
+
+    /**
+     * @param typePriorities The typePriorities to set.
+     */
+    public void setTypePriorities(TypePriorities typePriorities) {
+        this.typePriorities = typePriorities;
+    }
+
+    /**
+     * @return Returns the typeSystemDescription.
+     */
+    public TypeSystemDescription getTypeSystemDescription() {
+        return typeSystemDescription;
+    }
+
+    /**
+     * @param typeSystemDescription The typeSystemDescription to set.
+     */
+    public void setTypeSystemDescription(TypeSystemDescription typeSystemDescription) {
+        this.typeSystemDescription = typeSystemDescription;
+    }
+
+    /**
+     * @return Returns the  BaseCAS.
+     */
+    public CAS getCAS() {
+        return aBaseCAS;
+    }
+
+    public TypeSystem getTypeSystem () {
+        if (typeSystem == null) {
+            typeSystem = aBaseCAS.getTypeSystem();
+        }
+        return typeSystem;
+    }
+
+    /**
+     * @return the xmiFileLocation
+     */
+    public String getXmiFileLocation() {
+        return xmiFileLocation;
+    }
+
+    /**
+     * @param xmiFileLocation the xmiFileLocation to set
+     */
+    public void setXmiFileLocation(String xmiFileLocation) {
+        this.xmiFileLocation = xmiFileLocation;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseCASObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,122 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.tools.debug.util.Trace;
+
+// See also TreeNode
+public class BaseNode implements Serializable {
+  private static final long serialVersionUID = 3763098548568601397L;
+
+  protected String label = null;
+  protected BaseNode parent = null;
+  protected List<BaseNode> childrenList = null;
+  
+  protected int             objectType = 0;
+  protected Object          object = null;  
+
+  /************************************************************************/
+
+  public BaseNode() {
+  }
+
+  public BaseNode(String label, Object object, List list) {
+      super();
+      this.label  = label;
+      this.object = object;
+      childrenList = list;
+  }
+
+  /**
+   * @return Returns the label.
+   */
+  public String getLabel() {
+    return label;
+  }
+
+  /**
+   * @param label The label to set.
+   */
+  public void setLabel(String label) {
+    this.label = label;
+  }
+  
+  /**
+   * @return Returns the object.
+   */
+  public Object getObject() {
+      return object;
+  }
+  
+  /**
+   * @param object The object to set.
+   */
+  public void setObject(Object object) {
+      this.object = object;
+  }
+  
+  /**
+   * @param object The object to set.
+   */
+  public void setObject(Object object, int objectType) {
+      this.object = object;
+      this.objectType = objectType;
+  }
+  
+  /**
+   * @return Returns the objectType.
+   */
+  public int getObjectType() {
+      return objectType;
+  }
+  /**
+   * @param objectType The objectType to set.
+   */
+  public void setObjectType(int objectType) {
+      this.objectType = objectType;
+  }
+ 
+  /**
+   * @return Returns the parent.
+   */
+  public BaseNode getParent() {
+    return parent;
+  }
+  
+  /**
+   * @param parent The parent to set.
+   */
+  public void setParent(BaseNode parent) {
+    this.parent = parent;
+  }
+
+  /**
+   * @return Returns the children.
+   */
+  public List getChildren() {
+    return childrenList;
+  }    
+
+  public Object removeChild (BaseNode childNode) {
+    if (childrenList == null) {
+      Trace.err(label + " doesn't have children");
+      return null;
+    }
+    if (childrenList.indexOf(childNode) == -1) {
+      Trace.err(label + " doesn't have " + childNode.label + " as child");
+      return null;
+    }
+    return childrenList.remove(childrenList.indexOf(childNode));
+  }   
+
+  public void addChild (BaseNode childNode) {
+    if (childrenList == null) {
+      return ;
+    }
+    childrenList.add (childNode);
+  }
+
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/BaseNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,673 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.SofaFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.resource.metadata.TypeDescription;
+import org.apache.uima.resource.metadata.TypePriorities;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.tools.debug.util.Trace;
+import org.apache.uima.tools.internal.util.CasHelper;
+
+/**
+ * 
+ * 
+ * Notes:
+ *  - Each CAS view may have differently selected types
+ *  
+ *  - CAS defaultView = cas.getView(CAS.NAME_DEFAULT_SOFA);
+ */
+public class CASObjectView implements ICASObjectView
+{
+    static final public String CASDIFF_VIEW_TYPE           = "org.apache.uima.casviewer.CasDiffView";
+    static final public String CASDIFF_VIEW_SUPER_TYPE     = "uima.cas.AnnotationBase";
+    static final public String CASDIFF_VIEW_FEATURE_ADDED    = "addedFeatureStructures";
+    static final public String CASDIFF_VIEW_FEATURE_DELETED  = "deletedFeatureStructures";
+    static final public String CASDIFF_VIEW_FEATURE_CHANGED  = "changedFeatureStructures";
+    static final public String CASDIFF_VIEW_FEATURE_MATCHED  = "matchedFeatureStructures";
+
+    
+    private BaseCASObject           baseCASObject;
+    private SofaFS                  sofa;
+    private String                  sofaId;
+//    private TypeSystemStyle         tsStyle;
+    
+    protected CAS                   casView;
+    protected TypeSystemDescription typeSystemDescription;
+    protected TypePriorities        typePriorities;
+    protected TypeSystem            typeSystem;
+
+    protected CasIndexRepository    casIndexRepository;
+    
+    // Key: type name; Value: list of annotations (AnnotationObject) for that type
+    private Map<String, List<AnnotationObject>> typeName2AnnotationsMap = new HashMap<String, List<AnnotationObject>>(10);    
+
+    // Key: Entity; Value: list of EntityAnnotation's instances for this Entity
+//    private Map             mapEntity2AnnotationList = new HashMap();
+    
+    // List of types having annotations. These "types" are collected from AnnotationIndex.
+    // Therefore, this list may NOT contains all the types in the type system.
+    // The map "typeName2AnnotationsMap" can be used to get all the annotation for a 
+    // particular type name.
+    
+    // List of types having annotations. 
+    private List<Type>      typesHavingAnnotations;
+    
+    // List of annotations indexed by the default AnnotationIndex
+    private LinkedList<AnnotationObject> indexedAnnotationList = new LinkedList<AnnotationObject>();
+    
+    private boolean         isProcessed = false; // used by processAnnotatedTypes()
+    
+    // List of pre-selected types (read from type system style file)
+    protected Set           preSelectedTypes = new HashSet();
+    
+    // List of hidden types (read from type system style file)
+    // These types never appear in UI of CASView
+    protected Set           hiddenTypes = new HashSet();    
+    
+    // List of currently selected Types for this CAS View
+    protected Set           currentlySelectedTypes = new HashSet();
+    
+    protected Set           visibleTypes;
+    private List mHighFrequencyTypes = new ArrayList();
+    
+    //Mode constants
+//    private static final short MODE_ANNOTATIONS = 0;
+//    private static final short MODE_ENTITIES = 1;
+//    private short mViewMode = MODE_ANNOTATIONS;
+    
+    private static String[] DEFAULT_HIDDEN_FEATURES = { "sofa" };
+//    private boolean mConsistentColors = true;
+
+    private Set<String> mHiddenFeatureNames = new HashSet<String>();
+
+//    private Boolean mEntityViewEnabled; //null if user has made no choice
+
+    /*************************************************************************/
+
+    public CASObjectView (BaseCASObject aCASObject, SofaFS aSofaFS) {
+        this(aCASObject, aSofaFS, aSofaFS.getStringValue(aSofaFS.getType().getFeatureByBaseName(CAS.FEATURE_BASE_NAME_SOFAID)));
+    }
+
+    @Deprecated // Use CASObjectView (BaseCASObject aCASObject, SofaFS sofa)
+    protected CASObjectView (BaseCASObject aCASObject, SofaFS sofa, String sofaId) {
+        this.baseCASObject = aCASObject;
+        this.sofa       = sofa;
+        this.sofaId     = sofaId;
+        this.casView = aCASObject.getCAS().getView(sofa);
+        this.typeSystemDescription = aCASObject.typeSystemDescription;
+        this.typePriorities        = aCASObject.typePriorities;
+    }
+    
+    /*************************************************************************/
+
+    // Used by FSIndexSectionPart
+    static public AnnotationObject createAnnotationObjectFromFS (FeatureStructure fs, boolean show)
+    {
+        int begin;
+        int end;
+        Type type = fs.getType();
+        if (fs instanceof AnnotationFS) {
+            begin = fs.getIntValue(type.getFeatureByBaseName("begin"));
+            end = fs.getIntValue(type.getFeatureByBaseName("end"));
+        } else {
+            begin = 0;
+            end = 0;
+        }
+        return new AnnotationObject(fs, begin, end, show);
+    }
+    
+    /*************************************************************************/
+
+    /**
+     * Set the list of types that occur most frequently.  This method assigns
+     * the most distinguishable colors to these types.
+     * 
+     * @param aTypeNames names of types that are occur frequently.  Ideally these should be
+     *    ordered by frequency, with the most frequent being first.
+     */
+    public void setHighFrequencyTypes(String[] aTypeNames)
+    {
+        //store these types for later
+        mHighFrequencyTypes.clear();
+        mHighFrequencyTypes.addAll(Arrays.asList(aTypeNames));
+        // mTypeNameToColorMap.clear();
+        // assignColors(mHighFrequencyTypes);
+    }
+
+    /**
+     * Set the list of types that will be highlighted in the viewer.  Types not in this
+     * list will not appear in the legend and will never be highlighted.  If this method
+     * is not called, the default is to show all types in the CAS (except those specifically
+     * hidden by a call to {@link #setHiddenTypes(String[])}. 
+     * 
+     * @param aTypeNames names of types that are to be highlighted.  Null indicates that
+     *   all types in the CAS should be highlighted.
+     */
+    public void setDisplayedTypes(String[] aDisplayedTypeNames)
+    {
+        if (aDisplayedTypeNames == null) {
+            visibleTypes = null;
+        } else {
+            visibleTypes = new HashSet();
+            visibleTypes.addAll(Arrays.asList(aDisplayedTypeNames));
+        }
+    }
+
+    /**
+     * Set the list of types that will NOT be highlighted in the viewer.
+     * 
+     * @param aTypeNames names of types that are never to be highlighted.
+     */
+    public void setHiddenTypes(String[] aTypeNames)
+    {
+        hiddenTypes.clear();
+        hiddenTypes.addAll(Arrays.asList(aTypeNames));
+    }
+
+    /**
+     * Configures the initially selected types in the viewer.  If not called, all
+     * types will be initially selected.
+     *  
+     * @param aTypeNames array of fully-qualified names of types to be initially selected
+     */
+    public void setInitiallySelectedTypes(String[] aTypeNames)
+    {
+        preSelectedTypes = new HashSet();
+        for (int i = 0; i < aTypeNames.length; i++)
+        {
+            preSelectedTypes.add(aTypeNames[i]);
+        }
+        
+        currentlySelectedTypes.addAll(preSelectedTypes);
+    }
+
+    /**
+     * Configures the viewer to hide certain features in the
+     * annotation deatail pane.
+     *  
+     * @param aFeatureName array of (short) feature names to be hidden
+     */
+    public void setHiddenFeatures(String[] aFeatureNames)
+    {
+        mHiddenFeatureNames.clear();
+        //add default hidden features
+        mHiddenFeatureNames.addAll(Arrays.asList(DEFAULT_HIDDEN_FEATURES));
+        //add user-defined hidden features
+        mHiddenFeatureNames.addAll(Arrays.asList(aFeatureNames));
+    }
+       
+    /*************************************************************************/
+    
+    /* (non-Javadoc)
+     * @see com.ibm.uima.casviewer.core.ICASObjectView#getTypeTree()
+     */    
+    public TypeTree getTypeTree ()
+    {
+        return baseCASObject.getTypeTree();
+    }
+    
+    public TypeTree newTypeTree ()
+    {
+        return baseCASObject.newTypeTree();
+    }
+        
+    /**
+     *  Decorate each TypeNode of TypeTree with AnnotationObjectsNode containing:
+     *   - AnnotationObject(s) 
+     * 
+     * @param typeTree
+     * @return void
+     */
+    public void decorateTypeTreeWithAnnotationObjects (TypeTree typeTree) { 
+        TypeNode typeNode;
+        for (Type type: getTypesHavingAnnotations()) {
+            List<AnnotationObject> annotationlist = getAnnotationsForTypeName(type.getName());
+            if ( CASDIFF_VIEW_TYPE.equals(type.getName()) ) {
+                Trace.err("Found " + CASDIFF_VIEW_TYPE);
+            } else {
+                typeNode = typeTree.getTypeNode(type.getName());
+                if (typeNode != null) {
+                    AnnotationObjectsNode n = typeNode.getAnnotationNode();
+                    if (n == null) {
+                        n = new AnnotationObjectsNode(annotationlist);
+                        typeNode.setAnnotationNode(n);
+                    } else {
+                        // Replace OLD annotations
+                        n.setAnnotationList(annotationlist);
+                    }
+                } else {
+                    Trace.err("Cannot find type in tree: " + type.getName());
+                }
+            }
+        }       
+    }
+    
+    /**
+     * Visit tree from "fromNode" and add annotation objects to 
+     * each type. The AnnotationObject(s) are newly created 
+     * and put under a new BaseNode. 
+     * 
+     *          fromNode
+     *              - AnnotationListNode annotationNode
+     *                       List<AnnotationObject>
+     *                              |- AnnotationObject 1
+     *                              |- AnnotationObject 2
+     *                              |- ...
+     *                                  List<AnnotationObject>
+     * 
+     * @param fromNode
+     * @param casView
+     * @return void
+     */
+    static public void visitTreeAndAddAnnotations (TypeNode fromNode, CAS casView)
+    {        
+        // Get "Type" object to work with FSIndex when retrieving FS from index
+        String typeName = ((TypeDescription) fromNode.getObject()).getName();
+        Type type = casView.getTypeSystem().getType(typeName);
+
+        // Is sub-type of AnnotationBase ?
+        Type annotationBase = casView.getTypeSystem().getType("uima.cas.AnnotationBase");
+        if (!typeName.equals("uima.cas.TOP") &&
+                !casView.getTypeSystem().subsumes(annotationBase, type)) {
+            return;
+        }
+        FSIndex fsIndex = CasHelper.getIndexForType(casView, typeName);
+        if  (!typeName.equals("uima.cas.TOP") && !typeName.equals("uima.cas.AnnotationBase") 
+                && (fsIndex == null || fsIndex.size() == 0)) {
+            // Skip Type having NO Annotation
+            return;
+        }
+
+        // Add FeatureStructures as children of fromNode
+        if (fsIndex != null) {
+            FSIterator iter = fsIndex.iterator();
+            List<AnnotationObject> selfAnnotations = new ArrayList<AnnotationObject>();
+            while (iter.isValid()) {
+                FeatureStructure fs = iter.get();
+                if (fs.getType() == type) {
+                    // Create new object for this type's annotation
+                    String coveredText = null;
+                    if (fs instanceof AnnotationFS) {
+                        coveredText = ((AnnotationFS)fs).getCoveredText();
+                    }
+                    selfAnnotations.add(new AnnotationObject (fs, coveredText));
+                }
+                iter.moveToNext();
+            }
+            if (selfAnnotations.size() > 0) {
+                AnnotationObjectsNode n = new AnnotationObjectsNode(selfAnnotations);
+                fromNode.setAnnotationNode(n);
+            }
+        }
+        
+        // Visit Children Types 
+        if ( fromNode.getChildren() != null ) {
+            // Collection c = fromNode.getChildren().values();
+            Iterator<TypeNode> iter = fromNode.getChildrenIterator();                
+            while (iter.hasNext()) {
+                visitTreeAndAddAnnotations (iter.next(), casView);
+            }                  
+        }        
+    }
+        
+    /*************************************************************************/
+    
+    public void setTypeSelectionByName (List types, boolean selection)
+    {
+        if ( selection ) {
+            currentlySelectedTypes.add(types);
+        } else {
+            if (types == null) {
+                currentlySelectedTypes.clear();
+            } else {  
+                currentlySelectedTypes.remove(types);
+            }
+        }       
+    }
+
+    public List<Type> getTypesHavingAnnotations ()
+    {
+        if (!isProcessed) {
+            processCasView();
+            // processEntities ();
+        }
+        // typeName2TypeMap.values();
+        return typesHavingAnnotations;
+    }
+    
+    public LinkedList<AnnotationObject> getIndexedAnnotations ()
+    {
+        if (!isProcessed) {
+            processCasView();
+        }
+
+        return indexedAnnotationList;        
+    }
+    
+    public String getDocumentText() {
+        if (casView == null) {
+            return "";
+        }
+        return casView.getDocumentText();
+    }
+
+    public Type getTypeFromTypeSystem (String typeName) {
+        return getTypeSystem().getType(typeName);
+    }
+    
+    public List<AnnotationObject> getAnnotationsForTypeName(String typeName) {
+        return typeName2AnnotationsMap.get(typeName);
+    }
+
+    protected void preProcessCasView () {
+    }
+    
+    protected AnnotationObject createAnnotationObject(FeatureStructure fs, 
+                                    int begin, int end, String doc, int maxTextSpan) {
+        AnnotationObject newAnnot = new AnnotationObject (fs, begin, end);
+        newAnnot.setTextSpan(CasHelper.getAnnotationTextSpan(doc, (AnnotationFS) fs, maxTextSpan));
+        
+        return newAnnot;
+    }
+
+    private void processCasView () 
+    {
+        if (isProcessed) return;
+        isProcessed = true;
+        
+        if (typesHavingAnnotations == null) {
+            typesHavingAnnotations = new ArrayList<Type> ();
+        } else {
+            typesHavingAnnotations.clear();
+        }
+        
+        // Clear previous annotations
+        indexedAnnotationList.clear();
+                
+        String  doc = casView.getDocumentText();
+        if (doc == null) {
+            doc = "";
+        }
+
+        preProcessCasView ();
+        
+        // Iterate over the default annotation index.
+        // Create a list "annotListPerType" of annotations for EACH type
+        List<AnnotationObject>    annotListPerType = null;// For each type, list of its annotations    
+        FSIterator iter = casView.getAnnotationIndex().iterator(); // Get the default annotation index.
+        while (iter.isValid())
+        {
+            // Get 1 annotation
+            AnnotationFS fs = (AnnotationFS) iter.get();
+            iter.moveToNext();
+            
+            // Get the type of this annotation
+            Type type = fs.getType();
+            
+            // PrintAnnotations.printFS((FeatureStructure) fs, mTCAS, 1, System.out);
+            int begin = fs.getBegin();  // start from 0
+            int end   = fs.getEnd();
+//          if (begin != end && end == mTCAS.getDocumentText().length()) {
+//              end--;
+//          }
+            if (begin == end) {
+                // Skip 0-length annotations
+                // E.g., SourceDocumentInformation
+                continue;
+            }
+            
+            // See this Type before ?
+            if ( ! typesHavingAnnotations.contains(type) ) {
+                // New Type for Annotations
+                // Check that this type should be displayed.
+                if ((visibleTypes != null && ! typeNamesContains(visibleTypes, type.getName()))
+                        || typeNamesContains(hiddenTypes, type.getName())) {
+                    continue;
+                }
+
+                typesHavingAnnotations.add(type);
+                
+                // Map type name -> Type
+                // typeName2TypeMap.put(type.getName(), type);
+                
+                // Map type name -> annotation list
+                annotListPerType = new ArrayList<AnnotationObject>();
+                typeName2AnnotationsMap.put(type.getName(), annotListPerType);
+            } else {
+                // Existing Type. Get existing annotation list
+                annotListPerType = typeName2AnnotationsMap.get(type.getName());
+            }
+            // Select color for the type 
+//            if (tsStyle != null) {
+//                typeStyle = tsStyle.getTypeStyle(type.getName());
+//            }
+            
+            // Create new object for this type's annotation
+            // Try to reuse AnnotationObject created at somewhere
+            AnnotationObject newAnnot = createAnnotationObject(fs, begin, end, doc, 50);
+            annotListPerType.add(newAnnot);
+                        
+            // Sort Annotations (sortedAnnotationList) by BEGIN feature
+//            AnnotationObject annot;
+//            boolean done = false;
+            // Trace.trace("sortedAnnotationList:" + sortedAnnotationList.size());
+            indexedAnnotationList.add(newAnnot);
+            
+            // Sorted ? Use order set by AnnotationIndexRepository 
+            // addAnnotationToSortedList(indexedAnnotationList, newAnnot);
+                       
+//            if (type.getName().compareTo("uima.tcas.DocumentAnnotation") != 0 && begin != end) {
+//                // Trace.trace( type.getName() + "Begin: " + begin + " ; end: " + end);
+//                StyleRange styleRange = new StyleRange ();
+//                styleRange.foreground = styledTextDoc.getDisplay().getSystemColor(SWT.COLOR_BLUE);
+//                styleRange.start = begin;
+//                styleRange.length= end - begin;
+//                styledTextDoc.setStyleRange(styleRange);
+//            }
+        }
+//        for (int i=0; i<indexedAnnotationList.size(); ++i) {
+//            Annot annot = ((Annot) indexedAnnotationList.get(i));
+//            Trace.trace("annot: " + annot.type.getShortName() + "["
+//                    + annot.begin + " , " + annot.end + "]");
+//        }
+
+        // Trace.trace("annotatedTypes.size(): " + annotatedTypes.size());
+        // Trace.trace("indexedAnnotationList.size(): " + indexedAnnotationList.size());
+    } // processAnnotatedTypes
+       
+
+    /**
+     * Does wildcard matching to determine if a give type name is "contained" in
+     * a Set of type names.
+     * 
+     * @param names
+     *            Type names, which may include wildcards (e.g, uima.tt.*)
+     * @param name
+     *            A type name
+     * @return True iff name matches a name in type names
+     */
+    private boolean typeNamesContains(Set<String> names, String name)
+    {
+      if (names.contains(name))
+        return true;
+      else
+      {
+        Iterator<String> namesIterator = names.iterator();
+        while (namesIterator.hasNext())
+        {
+          String otherName = (String) namesIterator.next();
+          if (otherName.indexOf('*') != -1) {
+            if (wildCardMatch(name, otherName)){
+              return true;
+            }
+          } else {
+            if (otherName.equalsIgnoreCase(name))
+            {
+              return true;
+            }
+          }
+        }
+      }
+      return false;
+    }
+
+    /**
+     * Helper for {@link #typeNamesContains(HashSet, String)}.
+     * 
+     * @param s
+     *            A litteral string
+     * @param pattern
+     *            A string that includes one or more *'s as wildcards
+     * @return True iff the string matches the pattern.   
+     */
+    private boolean wildCardMatch(String s, String pattern)
+    {
+      StringBuffer regexpPatternBuffer = new StringBuffer();
+      for (int i = 0; i < pattern.length(); i++)
+      {
+        char c = pattern.charAt(i);
+        if (c == '*')
+          regexpPatternBuffer.append('.');
+        else if (c == '.')
+          regexpPatternBuffer.append('\\');
+        if (Character.isLetter(c))
+        {
+          regexpPatternBuffer.append('(').append(Character.toLowerCase(c)).append('|').append(
+              Character.toUpperCase(c)).append(')');
+        }
+        else
+        {
+          regexpPatternBuffer.append(c);
+        }
+      }
+
+      return s.matches(new String(regexpPatternBuffer));
+    }
+
+    protected void addAnnotationToSortedList (LinkedList sortedAnnotationList, AnnotationObject newAnnot)
+    {
+        AnnotationObject annot;
+        int begin = newAnnot.begin;
+        int end   = newAnnot.end;
+        boolean done = false;
+        for (int i=0; i<sortedAnnotationList.size(); ++i) {
+            // Trace.trace("" + i);
+            annot = (AnnotationObject) sortedAnnotationList.get(i);
+            int s = annot.begin;
+            int e = annot.end;
+            if (e <= begin) {
+                //       begin<------>end
+                //  s<---->e
+                continue;
+            } else if (e <= end) {
+                if (s > begin) {
+                    //  begin<-------------->end
+                    //         s<-------->e
+                    sortedAnnotationList.add(i, newAnnot);
+                    Trace.bug("Insert annot " + newAnnot.type.getName() + "(begin:" + newAnnot.begin + ")" + " at " + i);
+                    done = true;
+                    break;
+                } else {
+                    // s <= begin
+                    //       begin<-------------->end
+                    //  s<----------->e
+                    continue; // goto next
+                }
+            } else {
+                // e > end
+                //  begin<------>end
+                //  .......-------->e
+                if (s <= begin) {
+                    //  begin<------>end
+                    //  s<------------>e
+                    continue;
+                } else {
+                    // s > begin
+                    //  begin<------>end
+                    //         s<--------->e
+                    sortedAnnotationList.add(i, newAnnot);
+                    Trace.bug("Insert annot " + newAnnot.type.getName() + "(begin:" + newAnnot.begin + ")" + " at " + i);
+                    done = true;
+                    break;
+                } 
+            }                    
+        }
+        if (!done) {
+            if (sortedAnnotationList.size() > 0) {
+                sortedAnnotationList.addLast(newAnnot);
+                // Trace.trace("NEW annot is inserted at LAST");
+            } else {
+                // 1st element
+                sortedAnnotationList.addFirst(newAnnot);
+                // Trace.trace("NEW annot is inserted at FIRST");
+            }
+//        } else {
+//            Trace.trace("NEW annot at " + (indexAnnotation-1) + " is inserted at: " + i);
+        }
+        
+    }
+    
+    /*************************************************************************/
+    
+    public CasIndexRepository getCasIndexRepository () {
+        if (casIndexRepository == null) {
+            casIndexRepository = CasIndexRepository.createInstance(getCurrentView());
+        }
+        return casIndexRepository;
+    }
+    
+    public TypeSystem getTypeSystem () {
+        if (typeSystem == null) {
+            typeSystem = baseCASObject.getTypeSystem();
+        }
+        return typeSystem;
+    }
+    
+    public TypeSystemDescription getTypeSystemDescription() {
+        return typeSystemDescription;
+    }
+    
+    public TypePriorities getTypePriorities() {
+        return typePriorities;
+    }
+
+    public SofaFS getSofa() {
+        return sofa;
+    }
+
+    public String getSofaId() {
+        return sofaId;
+    }
+
+    public CAS getCurrentView() {
+        return casView;
+    }
+
+    public Type getTypeByName(String typeName) {
+        return typeSystem.getType(typeName);
+    }
+
+    /**
+     * @return the baseCASObject
+     */
+    public BaseCASObject getBaseCASObject() {
+        return baseCASObject;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CASObjectView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,179 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIndexRepository;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+
+/**
+ * Create a CasIndexRepository (a tree of TreeNode) and build indexes hierarchy as follows:
+ *      _root
+ *          "AnnotationIndex" - Annotation (default index)
+ *              ... (indexes of subtypes of Annotation) ...
+ *          Index_Name_1    - Type1             (as defined in xml descriptor)
+ *              Index_for_Subtype_of_Type1
+ *              Index_for_Subtype_of_Type1
+ *          Index_Name_2    - Type2             (as defined in xml descriptor)
+ *              ... (indexes of subtypes) ...
+ * 
+ */
+public class CasIndexRepository {
+
+    static public Type      stringType = null;
+    
+    /*************************************************************************/
+    
+    private CAS             aCas = null;
+    private BaseNode        _root = null;
+    
+    // Key: type name; Value: list of annotations for that type
+    // private Map     typeName2AnnotationsMap = new HashMap(10);    
+    private Map     typeName2UFSIndexMap = new HashMap(10);    
+    private Map     typeName2TypeMap     = new HashMap(10);
+    
+    /*************************************************************************/
+    
+    private CasIndexRepository() {
+        super();
+    }
+    
+    protected CasIndexRepository(CAS aCas) {
+        super();
+        this.aCas = aCas;
+        stringType = aCas.getTypeSystem().getType(CAS.TYPE_NAME_STRING);        
+    }
+    
+    /**
+     * Create a CasIndexRepository and build indexes hierarchy as follows:
+     * 
+     * @param aCas
+     * @return
+     * @return CasIndexRepository
+     */
+    public static CasIndexRepository createInstance(CAS aCas)
+    {
+        CasIndexRepository instance = new CasIndexRepository (aCas);
+        instance.createRootIndexTree(aCas);
+        
+        return instance;
+    }
+    
+    /*************************************************************************/
+    
+    public BaseNode getRoot ()
+    {
+        return _root;
+    }
+    
+    public CAS getCas () {
+        return aCas;
+    }
+    
+    /**
+     * Get list of annotations from type full name
+     * 
+     * @param typeName
+     * @return void
+     */
+//    public List getAnnotationListByTypeName (String typeName)
+//    {
+//        UFSIndex uFSIndex = (UFSIndex) typeName2UFSIndexMap.get(typeName);
+//        if (uFSIndex != null) {
+//            return uFSIndex.getFSList();
+//        }
+//        return null;
+//    } // getAnnotationListByTypeName
+    
+    /**
+     * Get UIMA type object by type's full name
+     * 
+     * @param typeName
+     * @return
+     * @return Type
+     */
+    public Type getTypeByName (String typeName) 
+    {
+        return (Type) typeName2TypeMap.get(typeName);
+    } // getTypeByName
+    
+    /*************************************************************************/
+        
+    /**
+     *  Create tree of indexes. The roots are the named indexes as defined
+     *  in the Xml descriptor.
+     *  
+     * @param aCas
+     * @return void
+     */
+    protected void createRootIndexTree(CAS aCas) {
+        if (aCas == null) {
+            return;
+        }
+        if (_root == null) {
+            _root = new BaseNode("root", null, new ArrayList());
+        }
+        
+        FSIndexRepository ir = aCas.getIndexRepository();
+        Iterator it = ir.getLabels();
+        while (it.hasNext()) {
+            String label = (String) it.next();
+            FSIndex index = ir.getIndex(label);
+//            Trace.trace("label: " + label + " ; type: " + index.getType()
+//                    + " ; size: " + index.size());
+            createIndexSubTree(_root, index.getType(), aCas.getTypeSystem(),
+                    label, ir, 1);
+        }        
+    }
+    
+    /**
+     * 
+     *  TreeNode
+     *          - label     : type's name
+     *          - obj type  : ITEM_TYPE_U_FS_INDEX
+     *          - object    : UFSIndex
+     * 
+     * @param root
+     * @param type
+     * @param ts
+     * @param label
+     * @param ir
+     * @param level
+     * @return void
+     */
+    private void createIndexSubTree(BaseNode root, Type type, TypeSystem ts,
+                                String label, FSIndexRepository ir, int level) 
+    {
+        // Get index for (label, type)
+        FSIndex index = ir.getIndex(label, type);
+        UFSIndex uFSIndex = new UFSIndex(this, label, index, level);
+
+        // Add to tree
+        BaseNode node = new BaseNode(type.getShortName(), uFSIndex, new ArrayList());
+        node.setObjectType(IItemTypeConstants.ITEM_TYPE_U_FS_INDEX);
+        root.addChild(node);
+        
+        // Book-keeping (type name,type) and (type name, UFSIndex)
+        if ( ! typeName2TypeMap.containsKey(type.getName()) ) {
+            // New Type
+            typeName2TypeMap.put(type.getName(), type);
+            typeName2UFSIndexMap.put(type.getName(), uFSIndex);
+        }
+        
+        Vector types = ts.getDirectlySubsumedTypes(type);
+        final int max = types.size();
+        for (int i = 0; i < max; i++) {
+            createIndexSubTree(node, (Type) types.get(i), ts, label, ir, level+1);            
+        }        
+    }
+    
+    /*************************************************************************/
+    
+
+} // CasIndexRepository

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/CasIndexRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,69 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.SofaFS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.resource.metadata.TypePriorities;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+
+public interface ICASObjectView {
+
+    /*************************************************************************/
+
+
+    public void setTypeSelectionByName (List types, boolean selection);
+    
+    public TypeTree getTypeTree ();
+    public TypeTree newTypeTree ();
+
+    public List<Type>   getTypesHavingAnnotations();
+    public LinkedList   getIndexedAnnotations ();
+
+    public String       getDocumentText();
+
+//    public Type getTypeByName(String typeName);
+    public Type getTypeFromTypeSystem (String typeName);
+    
+    public List getAnnotationsForTypeName(String typeName);
+
+    /**
+     * @return The TypeSystem associated with this CAS.
+     */
+    public TypeSystem getTypeSystem ();
+    
+    public Type getTypeByName (String typeName);
+    
+    /**
+     * @return Returns the typeSystemDescription.
+     */
+    public TypeSystemDescription getTypeSystemDescription();
+
+    public CasIndexRepository getCasIndexRepository ();
+    
+    /**
+     * @return Returns the typePriorities.
+     */
+    public TypePriorities getTypePriorities();
+
+    public CAS getCurrentView();
+
+    /**
+     * @return the sofa
+     */
+    public SofaFS getSofa();
+
+    /**
+     * @return the sofaId
+     */
+    public String getSofaId();
+
+    /**
+     * @return the baseCASObject
+     */
+    public BaseCASObject getBaseCASObject();
+
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/ICASObjectView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,62 @@
+package org.apache.uima.casviewer.core.internal;
+
+public interface IItemTypeConstants {
+    // Item Type (from com.ibm.uima.repository.model.typesystem
+    // in "com.ibm.uima.repository.core.jar"
+    public final static int ITEM_TYPE_UNKNOW                    = 0;
+    public final static int ITEM_TYPE_TYPE                      = 1;
+    public final static int ITEM_TYPE_FEATURE                   = 2;
+    public final static int ITEM_TYPE_TYPE_SYSTEM               = 3;
+//    public final static int ITEM_TYPE_COMPONENT                 = 4;
+//    public final static int ITEM_TYPE_CATEGORY                  = 5;
+//    public final static int ITEM_TYPE_CONCEPT                   = 6;
+//    public final static int ITEM_TYPE_INPUT_TYPE                = 7;
+//    public final static int ITEM_TYPE_OUTPUT_TYPE               = 8;
+//    public final static int ITEM_TYPE_INPUT_CONCEPT             = 9;
+//    public final static int ITEM_TYPE_OUTPUT_CONCEPT            = 10;
+//
+//    public final static int ITEM_TYPE_CONCEPT_ASSOCIATED_TYPE       = 11;
+//    public final static int ITEM_TYPE_CONCEPT_ASSOCIATED_COMPONENT  = 12;
+//    
+//    public final static int ITEM_TYPE_REPOSITORYVIEW            = 14;
+//    public final static int ITEM_TYPE_VIEWITEM                  = 15;
+//    public final static int ITEM_TYPE_VIEWMAPPING               = 16;
+    
+    public final static int ITEM_TYPE_LABEL_FEATURES            = 20;
+//    public final static int ITEM_TYPE_LABEL_IMPLEMENTED_BY      = 21;
+//    public final static int ITEM_TYPE_LABEL_INPUT_TYPES         = 22;
+//    public final static int ITEM_TYPE_LABEL_OUTPUT_TYPES        = 23;
+//    public final static int ITEM_TYPE_LABEL_INPUT_CONCEPTS      = 24;
+//    public final static int ITEM_TYPE_LABEL_OUTPUT_CONCEPTS     = 25;
+//    
+//    public final static int ITEM_TYPE_LABEL_CONCEPT_ASSOCIATED_TYPES    = 31;
+//    public final static int ITEM_TYPE_LABEL_CONCEPT_ASSOCIATED_COMP_LIST= 32;
+    public final static int ITEM_TYPE_LABEL_COLLECTION_READERS  = 33;
+    public final static int ITEM_TYPE_LABEL_CAS_PROCESSORS      = 34;
+    public final static int ITEM_TYPE_LABEL_CAS_CONSUMERS       = 35;
+    public final static int ITEM_TYPE_LABEL_CAS_INITIALIZERS    = 36;
+    
+    public final static int ITEM_TYPE_FS_INDEX                  = 50;
+    public final static int ITEM_TYPE_LABEL_FS_INDEX            = 55;
+    
+    public final static int ITEM_TYPE_FS                        = 200; // FeatureStructure
+    public final static int ITEM_TYPE_LABEL_FSs                 = 201; // Label of FeatureStructure(s)
+    public final static int ITEM_TYPE_ANNOTATION_OBJECTS        = 202; // List of AnnotationObject Wrapper of FeatureStructure
+    
+//    public final static int ITEM_TYPE_ENTITY_MAP                = 81;
+//    public final static int ITEM_TYPE_ENTITY_OBJECT             = 82;
+//    public final static int ITEM_TYPE_ENTITY_ANNOTATION         = 83;
+//    public final static int ITEM_TYPE_LABEL_ENTITY_MAP          = 84;
+//    public final static int ITEM_TYPE_LABEL_ENTITY_OBJECT       = 85;
+//    public final static int ITEM_TYPE_LABEL_ENTITY_ANNOTATION   = 86;
+    
+    // Item Type
+    public final static int ITEM_TYPE_U_BASE                   = 1000;
+    public final static int ITEM_TYPE_U_FS                      = 1 + ITEM_TYPE_U_BASE;
+    public final static int ITEM_TYPE_U_FS_INDEX                = 2 + ITEM_TYPE_U_BASE;
+    
+    // Labels
+    public final static int ITEM_TYPE_LABEL_U_FS                = 10 + ITEM_TYPE_U_BASE;
+    public final static int ITEM_TYPE_LABEL_U_FS_INDEX          = 11 + ITEM_TYPE_U_BASE;
+    
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/IItemTypeConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,234 @@
+package org.apache.uima.casviewer.core.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.cas.FeatureStructure;
+
+public class TypeNode extends BaseNode {
+    
+ // Temporary hide from view. It is used by Journal to show types changed by AE(s)
+    protected boolean disable = false; // Temporary hide from view
+   	
+    // Used to display "Features" label which contains the definition of features
+    protected TypeNode featuresLabel = null;
+    
+    // Used to contains the annotations of this types
+    // Possible classes:  AnnotationListNode, DiffAnnotationListNode
+    //                    List<FeatureStructure>
+    protected AnnotationObjectsNode annotationNode = null;
+    
+    // Attributes used by Cas Viewer
+    protected int               fsCount = 0;    // number of FS for this type (NOT including number from sub-types)
+    protected int               fsTotal = 0;    // number of FS for this type (including number from sub-types)
+    protected Object            bgColor = null; // background color (Color)
+    protected boolean           hidden = false;
+    
+    /************************************************************************/
+
+	public TypeNode () {
+      super();
+	}
+	
+	public TypeNode (TypeNode parent, String label) {
+        super();
+		this.parent = parent;
+		this.label 	= new String(label);
+	}
+	
+	public TypeNode (TypeNode parent, String label, int objType, Object obj) {
+	    super();
+	    this.parent = parent;
+	    this.label  = new String(label);
+	    this.objectType = objType;
+	    this.object = obj;
+	}
+
+    
+	@Deprecated
+    public void addChildren(TypeNode[] list) {
+        if (childrenList == null) {
+            childrenList = new ArrayList();
+        }
+        // Set parent node for all children to "this"
+        for (int i=0; i<list.length; ++i) {
+            this.childrenList.add(list[i]);
+            list[i].setParent(this);
+        }
+    }
+    
+    public void addChildren(List<TypeNode> list) {
+        if (childrenList == null) {
+            childrenList = new ArrayList();
+        }
+        childrenList.addAll(list);
+        // Set parent node for all children to "this"
+        for (TypeNode node: list) {
+            node.setParent(this);
+        }
+    }
+	
+    public Iterator getChildrenIterator () {
+        if (childrenList == null) return null;
+        return childrenList.iterator();
+    }
+
+    public Object[] getChildrenArray() {
+        if (childrenList == null || childrenList.size() == 0) {
+            return null;
+        }
+        return (TypeNode [])childrenList.toArray(new TypeNode[childrenList.size()]);
+    }    
+     
+    public int getChildrenCount () {
+        return (childrenList == null? 0:childrenList.size());
+    }
+
+    public TypeNode getChildAt(int index) {
+      if (childrenList == null || index >= childrenList.size()) {
+          return null;
+      }
+      return (TypeNode)childrenList.get(index);
+  }    
+
+	
+	public TypeNode insertChild (TypeNode childNode) {
+		if (childrenList == null) {
+		    childrenList = (List<BaseNode>) new ArrayList();
+		    // children = new TreeMap(new MyComparator(false));
+		} else {
+			// Check duplication
+			// if (children.containsKey(childNode.label)) {
+			if (childrenList.contains(childNode)) {
+				// System.out.println("[insertChild] Duplicate Label:" + childNode.label);
+				return (TypeNode) childrenList.get(childrenList.indexOf(childNode));
+			}
+		}
+		// children.put (childNode.label, childNode);
+		childrenList.add (childNode);
+		childNode.parent = this;
+		return null;
+	}
+    
+    /**
+     * @return the bgColor
+     */
+    public Object getBgColor() {
+        return bgColor;
+    }
+
+    /**
+     * @param bgColor the bgColor to set
+     */
+    public void setBgColor(Object bgColor) {
+        this.bgColor = bgColor;
+    }
+
+    /**
+     * @return the grayed
+     */
+//    public boolean isGrayed() {
+//        return grayed;
+//    }
+
+    /**
+     * @param grayed the grayed to set
+     */
+//    public void setGrayed(boolean grayed) {
+//        this.grayed = grayed;
+//    }
+
+    /**
+     * @return Returns the fsTotal.
+     */
+    public int getFsTotal() {
+        return fsTotal;
+    }
+
+    /**
+     * @param fsTotal The fsTotal to set.
+     */
+    public void setFsTotal(int fsTotal) {
+        this.fsTotal = fsTotal;
+    }
+
+    /**
+     * @return Returns the firstChild.
+     */
+    public TypeNode getFirstChild() {
+        return featuresLabel;
+    }
+
+    /**
+     * @param firstChild The firstChild to set.
+     */
+    public void setFirstChild(TypeNode firstChild) {
+        this.featuresLabel = firstChild;
+    }
+
+    /**
+     * @param children The children to set.
+     */
+    public void setChildren(List children) {
+        this.childrenList = children;
+    }
+
+    /**
+     * @return the fsCount
+     */
+    public int getFsCount() {
+        return fsCount;
+    }
+
+    /**
+     * @param fsCount the fsCount to set
+     */
+    public void setFsCount(int fsCount) {
+        this.fsCount = fsCount;
+    }
+
+    /**
+     * @return the hidden
+     */
+    public boolean isHidden() {
+        return hidden;
+    }
+
+    /**
+     * @param hidden the hidden to set
+     */
+    public void setHidden(boolean hidden) {
+        this.hidden = hidden;
+    }
+
+    /**
+     * @return the annotationNode
+     */
+    public AnnotationObjectsNode getAnnotationNode() {
+        return annotationNode;
+    }
+
+    /**
+     * @param annotationNode the annotationNode to set
+     */
+    public void setAnnotationNode(AnnotationObjectsNode annotationNode) {
+        this.annotationNode = annotationNode;
+    }
+
+    /**
+     * @return the disable
+     */
+    public boolean isDisable() {
+        return disable;
+    }
+
+    /**
+     * @param disable the disable to set
+     */
+    public void setDisable(boolean disable) {
+        this.disable = disable;
+    }
+
+    
+} // TypeNode

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/core/internal/TypeNode.java
------------------------------------------------------------------------------
    svn:eol-style = native