You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2006/11/22 18:10:08 UTC

svn commit: r478244 [4/18] - in /incubator/uima/uimaj/trunk/uimaj-tools/src: main/java/org/apache/uima/klt/ main/java/org/apache/uima/tools/ main/java/org/apache/uima/tools/annot_view/ main/java/org/apache/uima/tools/annot_view/ts_editor/ main/java/org...

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeModel.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeModel.java?view=diff&rev=478244&r1=478243&r2=478244
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeModel.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeModel.java Wed Nov 22 09:10:04 2006
@@ -19,6 +19,13 @@
 
 package org.apache.uima.tools.annot_view;
 
+import java.util.ArrayList;
+
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.FSIndex;
 import org.apache.uima.cas.FSIterator;
@@ -28,13 +35,6 @@
 import org.apache.uima.cas.impl.FeatureImpl;
 import org.apache.uima.cas.impl.TCASImpl;
 
-import java.util.ArrayList;
-
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
 /**
  * Insert comment for enclosing_type here.
  * 
@@ -42,274 +42,264 @@
  */
 public class FSTreeModel implements TreeModel {
 
-    private FSTreeNode root;
-
-    private TCASImpl cas;
-
-    private ArrayList treeModelListeners = new ArrayList();
-
-    private ArrayList fss;
-
-    private static final String defaultRootString = "<html><b>"
-            + MainFrame.htmlGrayColor + "FS List - no selection</b></html>";
-
-    private String rootString = defaultRootString;
-
-    /**
-     * Constructor for FSTreeModel.
-     */
-    public FSTreeModel() {
-        super();
-        this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
-        this.root.setChildren(new ArrayList());
-    }
-
-    public void update(String indexName, FSIndex index, CAS cas1) {
-        // this.indexName = indexName;
-        this.cas = (TCASImpl) cas1;
-        final int size = index.size();
-        this.rootString = "<html><font color=green>" + indexName
-                + "</font> - <font color=blue>" + index.getType().getName()
-                + "</font> [" + size + "]</html>";
-        this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
-        this.fss = new ArrayList();
-        FSIterator it = index.iterator();
-        int count = 0;
-        for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
-            FeatureStructure fs = it.get();
-            this.fss.add(new FSNode(this, getNodeType(fs.getType()), fs
-                    .hashCode(), count));
-            ++count;
-        }
-        ArrayList kids = createArrayChildren(0, size, this.fss, this);
-        this.root.setChildren(kids);
-        Object[] path = new Object[1];
-        path[0] = this.root;
-        TreeModelEvent event = new TreeModelEvent(this.root, path);
-        for (int i = 0; i < this.treeModelListeners.size(); i++) {
-            ((TreeModelListener) this.treeModelListeners.get(i))
-                    .treeStructureChanged(event);
-        }
-    }
-
-    public void reset() {
-        this.root.removeAllChildren();
-        this.rootString = defaultRootString;
-        Object[] path = new Object[1];
-        path[0] = this.root;
-        TreeModelEvent event = new TreeModelEvent(this.root, path);
-        for (int i = 0; i < this.treeModelListeners.size(); i++) {
-            ((TreeModelListener) this.treeModelListeners.get(i))
-                    .treeStructureChanged(event);
-        }
-
-    }
-
-    public ArrayList getFSs() {
-        return this.fss;
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#getRoot()
-     */
-    public Object getRoot() {
-        return this.root;
-    }
+  private FSTreeNode root;
 
-    /**
-     * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
-     */
-    public Object getChild(Object parent, int index) {
-        FSTreeNode node = (FSTreeNode) parent;
-        node.initChildren();
-        return node.getChildren().get(index);
-    }
+  private TCASImpl cas;
 
-    int getNodeType(int addr, Feature feat) {
-        Type domType = feat.getRange();
-        if (this.cas.isStringType(domType)) {
-            return FSNode.STRING_FS;
-        } else if (this.cas.isIntType(domType)) {
-            return FSNode.INT_FS;
-        } else if (this.cas.isFloatType(domType)) {
-            return FSNode.FLOAT_FS;
-        } else if (this.cas.isByteType(domType)) {
-          return FSNode.BYTE_FS;
-        } else if (this.cas.isBooleanType(domType)) {
-          return FSNode.BOOL_FS;
-        } else if (this.cas.isShortType(domType)) {
-          return FSNode.SHORT_FS;
-        } else if (this.cas.isLongType(domType)) {
-          return FSNode.LONG_FS;
-        } else if (this.cas.isDoubleType(domType)) {
-          return FSNode.DOUBLE_FS;
-        } else if (this.cas.isAbstractArrayType(domType)) {
-            final int featAddr = this.cas.getFeatureValue(addr,
-                    ((FeatureImpl) feat).getCode());
-            if (this.cas.isArrayType(this.cas.getTypeSystemImpl().getType(
-                    this.cas.getHeapValue(featAddr)))) {
-                return FSNode.ARRAY_FS;
-            }
-        }
-        return FSNode.STD_FS;
-    }
+  private ArrayList treeModelListeners = new ArrayList();
 
-    int getNodeType(Type type) {
-        if (this.cas.isStringType(type)) {
-            return FSNode.STRING_FS;
-        } else if (this.cas.isIntType(type)) {
-            return FSNode.INT_FS;
-        } else if (this.cas.isFloatType(type)) {
-            return FSNode.FLOAT_FS;
-        } else if (this.cas.isArrayType(type)) {
-            return FSNode.ARRAY_FS;
-        } else if (cas.isByteArrayType(type)) {
-          return FSNode.BYTE_FS;
-        } else if (cas.isBooleanArrayType(type)) {
-          return FSNode.BOOL_FS;
-        } else if (cas.isShortArrayType(type)) {
-          return FSNode.SHORT_FS;
-        } else if (cas.isLongArrayType(type)) {
-          return FSNode.LONG_FS;
-        } else if (cas.isDoubleArrayType(type)) {
-          return FSNode.DOUBLE_FS;
-        }
-        return FSNode.STD_FS;
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
-     */
-    public int getChildCount(Object parent) {
-        return ((FSTreeNode) parent).getChildCount();
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
-     */
-    public boolean isLeaf(Object node) {
-        return (getChildCount(node) == 0);
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
-     *      java.lang.Object)
-     */
-    public void valueForPathChanged(TreePath path, Object newValue) {
-        // Does nothing.
-    }
+  private ArrayList fss;
 
-    /**
-     * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object,
-     *      java.lang.Object)
-     */
-    public int getIndexOfChild(Object parent, Object child) {
-        FSTreeNode node = (FSTreeNode) parent;
-        node.initChildren();
-        return node.getChildren().indexOf(child);
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
-     */
-    public void addTreeModelListener(TreeModelListener arg0) {
-        this.treeModelListeners.add(arg0);
-    }
-
-    /**
-     * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
-     */
-    public void removeTreeModelListener(TreeModelListener arg0) {
-        this.treeModelListeners.remove(arg0);
-    }
-
-    /**
-     * @return TCASImpl
-     */
-    TCASImpl getCas() {
-        return this.cas;
-    }
-
-    /**
-     * @return String
-     */
-    String getRootString() {
-        return this.rootString;
-    }
-
-    static ArrayList createArrayChildren(int start, int end, ArrayList array,
-            FSTreeModel model) {
-        ArrayList kids = new ArrayList();
-        final int size = end - start;
-        if (size <= ArrayNode.CUTOFF) {
-            kids.ensureCapacity(size);
-            for (int i = start; i < end; i++) {
-                kids.add(array.get(i));
-            }
+  private static final String defaultRootString = "<html><b>" + MainFrame.htmlGrayColor
+                  + "FS List - no selection</b></html>";
+
+  private String rootString = defaultRootString;
+
+  /**
+   * Constructor for FSTreeModel.
+   */
+  public FSTreeModel() {
+    super();
+    this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
+    this.root.setChildren(new ArrayList());
+  }
+
+  public void update(String indexName, FSIndex index, CAS cas1) {
+    // this.indexName = indexName;
+    this.cas = (TCASImpl) cas1;
+    final int size = index.size();
+    this.rootString = "<html><font color=green>" + indexName + "</font> - <font color=blue>"
+                    + index.getType().getName() + "</font> [" + size + "]</html>";
+    this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
+    this.fss = new ArrayList();
+    FSIterator it = index.iterator();
+    int count = 0;
+    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
+      FeatureStructure fs = it.get();
+      this.fss.add(new FSNode(this, getNodeType(fs.getType()), fs.hashCode(), count));
+      ++count;
+    }
+    ArrayList kids = createArrayChildren(0, size, this.fss, this);
+    this.root.setChildren(kids);
+    Object[] path = new Object[1];
+    path[0] = this.root;
+    TreeModelEvent event = new TreeModelEvent(this.root, path);
+    for (int i = 0; i < this.treeModelListeners.size(); i++) {
+      ((TreeModelListener) this.treeModelListeners.get(i)).treeStructureChanged(event);
+    }
+  }
+
+  public void reset() {
+    this.root.removeAllChildren();
+    this.rootString = defaultRootString;
+    Object[] path = new Object[1];
+    path[0] = this.root;
+    TreeModelEvent event = new TreeModelEvent(this.root, path);
+    for (int i = 0; i < this.treeModelListeners.size(); i++) {
+      ((TreeModelListener) this.treeModelListeners.get(i)).treeStructureChanged(event);
+    }
+
+  }
+
+  public ArrayList getFSs() {
+    return this.fss;
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#getRoot()
+   */
+  public Object getRoot() {
+    return this.root;
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
+   */
+  public Object getChild(Object parent, int index) {
+    FSTreeNode node = (FSTreeNode) parent;
+    node.initChildren();
+    return node.getChildren().get(index);
+  }
+
+  int getNodeType(int addr, Feature feat) {
+    Type domType = feat.getRange();
+    if (this.cas.isStringType(domType)) {
+      return FSNode.STRING_FS;
+    } else if (this.cas.isIntType(domType)) {
+      return FSNode.INT_FS;
+    } else if (this.cas.isFloatType(domType)) {
+      return FSNode.FLOAT_FS;
+    } else if (this.cas.isByteType(domType)) {
+      return FSNode.BYTE_FS;
+    } else if (this.cas.isBooleanType(domType)) {
+      return FSNode.BOOL_FS;
+    } else if (this.cas.isShortType(domType)) {
+      return FSNode.SHORT_FS;
+    } else if (this.cas.isLongType(domType)) {
+      return FSNode.LONG_FS;
+    } else if (this.cas.isDoubleType(domType)) {
+      return FSNode.DOUBLE_FS;
+    } else if (this.cas.isAbstractArrayType(domType)) {
+      final int featAddr = this.cas.getFeatureValue(addr, ((FeatureImpl) feat).getCode());
+      if (this.cas.isArrayType(this.cas.getTypeSystemImpl()
+                      .getType(this.cas.getHeapValue(featAddr)))) {
+        return FSNode.ARRAY_FS;
+      }
+    }
+    return FSNode.STD_FS;
+  }
+
+  int getNodeType(Type type) {
+    if (this.cas.isStringType(type)) {
+      return FSNode.STRING_FS;
+    } else if (this.cas.isIntType(type)) {
+      return FSNode.INT_FS;
+    } else if (this.cas.isFloatType(type)) {
+      return FSNode.FLOAT_FS;
+    } else if (this.cas.isArrayType(type)) {
+      return FSNode.ARRAY_FS;
+    } else if (cas.isByteArrayType(type)) {
+      return FSNode.BYTE_FS;
+    } else if (cas.isBooleanArrayType(type)) {
+      return FSNode.BOOL_FS;
+    } else if (cas.isShortArrayType(type)) {
+      return FSNode.SHORT_FS;
+    } else if (cas.isLongArrayType(type)) {
+      return FSNode.LONG_FS;
+    } else if (cas.isDoubleArrayType(type)) {
+      return FSNode.DOUBLE_FS;
+    }
+    return FSNode.STD_FS;
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
+   */
+  public int getChildCount(Object parent) {
+    return ((FSTreeNode) parent).getChildCount();
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
+   */
+  public boolean isLeaf(Object node) {
+    return (getChildCount(node) == 0);
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
+   *      java.lang.Object)
+   */
+  public void valueForPathChanged(TreePath path, Object newValue) {
+    // Does nothing.
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
+   */
+  public int getIndexOfChild(Object parent, Object child) {
+    FSTreeNode node = (FSTreeNode) parent;
+    node.initChildren();
+    return node.getChildren().indexOf(child);
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
+   */
+  public void addTreeModelListener(TreeModelListener arg0) {
+    this.treeModelListeners.add(arg0);
+  }
+
+  /**
+   * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
+   */
+  public void removeTreeModelListener(TreeModelListener arg0) {
+    this.treeModelListeners.remove(arg0);
+  }
+
+  /**
+   * @return TCASImpl
+   */
+  TCASImpl getCas() {
+    return this.cas;
+  }
+
+  /**
+   * @return String
+   */
+  String getRootString() {
+    return this.rootString;
+  }
+
+  static ArrayList createArrayChildren(int start, int end, ArrayList array, FSTreeModel model) {
+    ArrayList kids = new ArrayList();
+    final int size = end - start;
+    if (size <= ArrayNode.CUTOFF) {
+      kids.ensureCapacity(size);
+      for (int i = start; i < end; i++) {
+        kids.add(array.get(i));
+      }
+    } else {
+      final int deg = ArrayNode.degree(size);
+      final int divisor = (int) Math.pow(ArrayNode.MULT, deg);
+      final int buckets = size / divisor;
+      final int rem = size % divisor;
+      int start_i, end_i;
+      for (int i = 0; i < buckets; i++) {
+        start_i = (start + (i * divisor));
+        end_i = start_i + divisor;
+        ArrayNode node = new ArrayNode(start_i, end_i - 1);
+        ArrayList grandkids = createArrayChildren(start_i, end_i, array, model);
+        node.setChildren(grandkids);
+        kids.add(node);
+      }
+      if (rem > 0) {
+        final int start_rem = start + (buckets * divisor);
+        if (rem <= ArrayNode.CUTOFF) {
+          for (int i = start_rem; i < end; i++) {
+            kids.add(array.get(i));
+          }
         } else {
-            final int deg = ArrayNode.degree(size);
-            final int divisor = (int) Math.pow(ArrayNode.MULT, deg);
-            final int buckets = size / divisor;
-            final int rem = size % divisor;
-            int start_i, end_i;
-            for (int i = 0; i < buckets; i++) {
-                start_i = (start + (i * divisor));
-                end_i = start_i + divisor;
-                ArrayNode node = new ArrayNode(start_i, end_i - 1);
-                ArrayList grandkids = createArrayChildren(start_i, end_i,
-                        array, model);
-                node.setChildren(grandkids);
-                kids.add(node);
-            }
-            if (rem > 0) {
-                final int start_rem = start + (buckets * divisor);
-                if (rem <= ArrayNode.CUTOFF) {
-                    for (int i = start_rem; i < end; i++) {
-                        kids.add(array.get(i));
-                    }
-                } else {
-                    ArrayNode node = new ArrayNode(start_rem, end - 1);
-                    node.setChildren(createArrayChildren(start_rem, end, array,
-                            model));
-                    kids.add(node);
-                }
-            }
+          ArrayNode node = new ArrayNode(start_rem, end - 1);
+          node.setChildren(createArrayChildren(start_rem, end, array, model));
+          kids.add(node);
         }
-        return kids;
+      }
     }
+    return kids;
+  }
 
-    public TreePath pathToNode(int fsNum) {
-        ArrayList p = new ArrayList();
-        p.add(this.root);
-        getPathToNode(fsNum, this.root.getChildren(), p);
-        TreePath path = new TreePath(p.toArray());
-        return path;
-    }
-
-    private void getPathToNode(int n, ArrayList dtrs, ArrayList path) {
-        // Do a linear search. The branching factor is small, so this should not
-        // be a problem.
-        FSTreeNode node;
-        ArrayNode arrayNode;
-        FSNode fsNode;
-        for (int i = 0; i < dtrs.size(); i++) {
-            node = (FSTreeNode) dtrs.get(i);
-            if (node instanceof ArrayNode) {
-                arrayNode = (ArrayNode) node;
-                if (arrayNode.getEnd() >= n) {
-                    path.add(node);
-                    getPathToNode(n, node.getChildren(), path);
-                    return;
-                }
-            } else {
-                fsNode = (FSNode) node;
-                if (fsNode.getArrayPos() == n) {
-                    path.add(node);
-                    return;
-                }
-            }
+  public TreePath pathToNode(int fsNum) {
+    ArrayList p = new ArrayList();
+    p.add(this.root);
+    getPathToNode(fsNum, this.root.getChildren(), p);
+    TreePath path = new TreePath(p.toArray());
+    return path;
+  }
+
+  private void getPathToNode(int n, ArrayList dtrs, ArrayList path) {
+    // Do a linear search. The branching factor is small, so this should not
+    // be a problem.
+    FSTreeNode node;
+    ArrayNode arrayNode;
+    FSNode fsNode;
+    for (int i = 0; i < dtrs.size(); i++) {
+      node = (FSTreeNode) dtrs.get(i);
+      if (node instanceof ArrayNode) {
+        arrayNode = (ArrayNode) node;
+        if (arrayNode.getEnd() >= n) {
+          path.add(node);
+          getPathToNode(n, node.getChildren(), path);
+          return;
+        }
+      } else {
+        fsNode = (FSNode) node;
+        if (fsNode.getArrayPos() == n) {
+          path.add(node);
+          return;
         }
+      }
     }
-
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeNode.java?view=diff&rev=478244&r1=478243&r2=478244
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeNode.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/FSTreeNode.java Wed Nov 22 09:10:04 2006
@@ -28,37 +28,36 @@
  */
 public abstract class FSTreeNode {
 
-    protected ArrayList children = null;
+  protected ArrayList children = null;
 
-    /**
-     * 
-     */
-    public FSTreeNode() {
-        super();
-        // TODO Auto-generated constructor stub
+  /**
+   * 
+   */
+  public FSTreeNode() {
+    super();
+    // TODO Auto-generated constructor stub
+  }
+
+  void removeAllChildren() {
+    this.children = new ArrayList();
+  }
+
+  void setChildren(ArrayList children) {
+    this.children = children;
+  }
+
+  ArrayList getChildren() {
+    return this.children;
+  }
+
+  int getChildCount() {
+    initChildren();
+    if (this.children == null) {
+      return 0;
     }
+    return this.children.size();
+  }
 
-    void removeAllChildren() {
-        this.children = new ArrayList();
-    }
-
-    void setChildren(ArrayList children) {
-        this.children = children;
-    }
-
-    ArrayList getChildren() {
-        return this.children;
-    }
-
-    int getChildCount() {
-        initChildren();
-        if (this.children == null) {
-            return 0;
-        }
-        return this.children.size();
-    }
-
-    protected abstract void initChildren();
-
+  protected abstract void initChildren();
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/Gladis.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/Gladis.java?view=diff&rev=478244&r1=478243&r2=478244
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/Gladis.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/Gladis.java Wed Nov 22 09:10:04 2006
@@ -26,9 +26,9 @@
 import javax.swing.UIManager;
 import javax.swing.UnsupportedLookAndFeelException;
 
+import org.apache.uima.internal.util.CommandLineParser;
 import org.apache.uima.resource.RelativePathResolver;
 import org.apache.uima.tools.images.Images;
-import org.apache.uima.internal.util.CommandLineParser;
 
 /**
  * The main class for the CAS Visual Debugger.
@@ -37,113 +37,105 @@
  */
 public class Gladis {
 
-   private static final String TEXT_FILE_PARAM = "-text";
+  private static final String TEXT_FILE_PARAM = "-text";
 
-   private static final String DESC_FILE_PARAM = "-desc";
+  private static final String DESC_FILE_PARAM = "-desc";
 
-   private static final String EXECUTE_SWITCH = "-exec";
+  private static final String EXECUTE_SWITCH = "-exec";
 
-   private static final String DATA_PATH_PARAM = "-datapath";
+  private static final String DATA_PATH_PARAM = "-datapath";
 
-   private Gladis() {
-      super();
-   }
-
-   public static MainFrame createMainFrame() throws ClassNotFoundException,
-                                            InstantiationException,
-                                            IllegalAccessException,
-                                            UnsupportedLookAndFeelException {
-      // Set look-and-feel.
-      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-      final MainFrame frame = new MainFrame();
-      // Set icon.
-      ImageIcon icon = Images.getImageIcon(Images.MICROSCOPE);
-      if (icon != null) {
-         frame.setIconImage(icon.getImage());
-      }
-      javax.swing.SwingUtilities.invokeLater(new Runnable() {
-
-         public void run() {
-            frame.pack();
-            frame.show();
-         }
-      });
-      return frame;
-   }
-
-   private static final CommandLineParser createCmdLineParser() {
-      CommandLineParser parser = new CommandLineParser();
-      parser.addParameter(TEXT_FILE_PARAM, true);
-      parser.addParameter(DESC_FILE_PARAM, true);
-      parser.addParameter(DATA_PATH_PARAM, true);
-      parser.addParameter(EXECUTE_SWITCH);
-      return parser;
-   }
-
-   private static final void printUsage() {
-      System.out
-               .println("Usage: java org.apache.uima.annot_view.Gladis [-text <TextFile>] [-desc <XmlDescriptor>] [-datapath <DataPath>] [-exec]");
-   }
-
-   private static final boolean checkCmdLineSyntax(CommandLineParser clp) {
-      if (clp.getRestArgs().length > 0) {
-         System.err
-                  .println("Error parsing CVD command line: unknown argument(s):");
-         String[] args = clp.getRestArgs();
-         for (int i = 0; i < args.length; i++) {
-            System.err.print(" ");
-            System.err.print(args[i]);
-         }
-         System.err.println();
-         return false;
-      }
-      if (clp.isInArgsList(EXECUTE_SWITCH)
-          && !clp.isInArgsList(DESC_FILE_PARAM)) {
-         System.err
-                  .println("Error parsing CVD command line: -exec switch requires -desc parameter.");
-         return false;
-      }
-      return true;
-   }
-
-   public static void main(String[] args) {
-      try {        
-         CommandLineParser clp = createCmdLineParser();
-         clp.parseCmdLine(args);
-         if (!checkCmdLineSyntax(clp)) {
-            printUsage();
-            System.exit(2);
-         }
-         SplashScreen splashScreen = new SplashScreen(new JWindow());
-         splashScreen.start();
-         MainFrame frame = createMainFrame();
-         splashScreen.close();
-         splashScreen.join();
-         splashScreen = null;
-         if (clp.isInArgsList(TEXT_FILE_PARAM)) {
-            frame.loadTextFile(new File(clp.getParamArgument(TEXT_FILE_PARAM)));
-         }
-         if (clp.isInArgsList(DATA_PATH_PARAM)) {
-            frame.setDataPath(clp.getParamArgument(DATA_PATH_PARAM));
-         } else {
-            String dataProp = System
-                     .getProperty(RelativePathResolver.UIMA_DATAPATH_PROP);
-            if (dataProp != null) {
-               frame.setDataPath(dataProp);
-            }
-         }
-         if (clp.isInArgsList(DESC_FILE_PARAM)) {
-            frame.loadAEDescriptor(new File(clp
-                     .getParamArgument(DESC_FILE_PARAM)));
-         }
-         if (clp.isInArgsList(EXECUTE_SWITCH)) {
-            frame.runAE(true);
-         }
-      } catch (Exception e) {
-         e.printStackTrace();
-         System.exit(1);
+  private Gladis() {
+    super();
+  }
+
+  public static MainFrame createMainFrame() throws ClassNotFoundException, InstantiationException,
+                  IllegalAccessException, UnsupportedLookAndFeelException {
+    // Set look-and-feel.
+    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+    final MainFrame frame = new MainFrame();
+    // Set icon.
+    ImageIcon icon = Images.getImageIcon(Images.MICROSCOPE);
+    if (icon != null) {
+      frame.setIconImage(icon.getImage());
+    }
+    javax.swing.SwingUtilities.invokeLater(new Runnable() {
+
+      public void run() {
+        frame.pack();
+        frame.show();
       }
-   }
-
+    });
+    return frame;
+  }
+
+  private static final CommandLineParser createCmdLineParser() {
+    CommandLineParser parser = new CommandLineParser();
+    parser.addParameter(TEXT_FILE_PARAM, true);
+    parser.addParameter(DESC_FILE_PARAM, true);
+    parser.addParameter(DATA_PATH_PARAM, true);
+    parser.addParameter(EXECUTE_SWITCH);
+    return parser;
+  }
+
+  private static final void printUsage() {
+    System.out
+                    .println("Usage: java org.apache.uima.annot_view.Gladis [-text <TextFile>] [-desc <XmlDescriptor>] [-datapath <DataPath>] [-exec]");
+  }
+
+  private static final boolean checkCmdLineSyntax(CommandLineParser clp) {
+    if (clp.getRestArgs().length > 0) {
+      System.err.println("Error parsing CVD command line: unknown argument(s):");
+      String[] args = clp.getRestArgs();
+      for (int i = 0; i < args.length; i++) {
+        System.err.print(" ");
+        System.err.print(args[i]);
+      }
+      System.err.println();
+      return false;
+    }
+    if (clp.isInArgsList(EXECUTE_SWITCH) && !clp.isInArgsList(DESC_FILE_PARAM)) {
+      System.err.println("Error parsing CVD command line: -exec switch requires -desc parameter.");
+      return false;
+    }
+    return true;
+  }
+
+  public static void main(String[] args) {
+    try {
+      CommandLineParser clp = createCmdLineParser();
+      clp.parseCmdLine(args);
+      if (!checkCmdLineSyntax(clp)) {
+        printUsage();
+        System.exit(2);
+      }
+      SplashScreen splashScreen = new SplashScreen(new JWindow());
+      splashScreen.start();
+      MainFrame frame = createMainFrame();
+      splashScreen.close();
+      splashScreen.join();
+      splashScreen = null;
+      if (clp.isInArgsList(TEXT_FILE_PARAM)) {
+        frame.loadTextFile(new File(clp.getParamArgument(TEXT_FILE_PARAM)));
+      }
+      if (clp.isInArgsList(DATA_PATH_PARAM)) {
+        frame.setDataPath(clp.getParamArgument(DATA_PATH_PARAM));
+      } else {
+        String dataProp = System.getProperty(RelativePathResolver.UIMA_DATAPATH_PROP);
+        if (dataProp != null) {
+          frame.setDataPath(dataProp);
+        }
+      }
+      if (clp.isInArgsList(DESC_FILE_PARAM)) {
+        frame.loadAEDescriptor(new File(clp.getParamArgument(DESC_FILE_PARAM)));
+      }
+      if (clp.isInArgsList(EXECUTE_SWITCH)) {
+        frame.runAE(true);
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+      System.exit(1);
+    }
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/IndexTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/IndexTreeNode.java?view=diff&rev=478244&r1=478243&r2=478244
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/IndexTreeNode.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/IndexTreeNode.java Wed Nov 22 09:10:04 2006
@@ -28,58 +28,57 @@
  */
 public class IndexTreeNode {
 
-    private final String name;
+  private final String name;
 
-    private final Type type;
+  private final Type type;
 
-    private final int size;
+  private final int size;
 
-    public IndexTreeNode(String name, Type type, int size) {
-        super();
-        this.name = name;
-        this.type = type;
-        this.size = size;
-    }
-
-    /**
-     * Constructor for IndexTreeNode.
-     */
-    public IndexTreeNode() {
-        super();
-        this.name = null;
-        this.type = null;
-        this.size = 0;
-    }
-
-    public String toString() {
-        return "<html><font color=green>" + this.name + "</font> [" + this.size
-                + "]</html>";
-    }
-
-    /**
-     * Returns the name.
-     * 
-     * @return String
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * Returns the type.
-     * 
-     * @return Type
-     */
-    public Type getType() {
-        return this.type;
-    }
-
-    public boolean equals(Object o) {
-        return (this == o);
-    }
-
-    public int hashCode() {
-        return super.hashCode();
-    }
+  public IndexTreeNode(String name, Type type, int size) {
+    super();
+    this.name = name;
+    this.type = type;
+    this.size = size;
+  }
+
+  /**
+   * Constructor for IndexTreeNode.
+   */
+  public IndexTreeNode() {
+    super();
+    this.name = null;
+    this.type = null;
+    this.size = 0;
+  }
+
+  public String toString() {
+    return "<html><font color=green>" + this.name + "</font> [" + this.size + "]</html>";
+  }
+
+  /**
+   * Returns the name.
+   * 
+   * @return String
+   */
+  public String getName() {
+    return this.name;
+  }
+
+  /**
+   * Returns the type.
+   * 
+   * @return Type
+   */
+  public Type getType() {
+    return this.type;
+  }
+
+  public boolean equals(Object o) {
+    return (this == o);
+  }
+
+  public int hashCode() {
+    return super.hashCode();
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/LogFileViewer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/LogFileViewer.java?view=diff&rev=478244&r1=478243&r2=478244
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/LogFileViewer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/annot_view/LogFileViewer.java Wed Nov 22 09:10:04 2006
@@ -19,8 +19,6 @@
 
 package org.apache.uima.tools.annot_view;
 
-import org.apache.uima.internal.util.FileUtils;
-
 import java.awt.Dimension;
 import java.awt.GraphicsConfiguration;
 import java.awt.event.ActionEvent;
@@ -41,6 +39,8 @@
 import javax.swing.KeyStroke;
 import javax.swing.text.DefaultEditorKit;
 
+import org.apache.uima.internal.util.FileUtils;
+
 /**
  * Simple file viewer for viewing log files.
  * 
@@ -48,102 +48,101 @@
  */
 public class LogFileViewer extends JFrame {
 
-    private File logFile;
-
-    private JScrollPane scrollPane;
+  private static final long serialVersionUID = 3599235286749804258L;
 
-    private JTextArea textArea;
-
-    /**
-     * @throws java.awt.HeadlessException
-     */
-    public LogFileViewer() {
-        super();
-    }
-
-    /**
-     * @param arg0
-     */
-    public LogFileViewer(GraphicsConfiguration arg0) {
-        super(arg0);
-    }
+  private File logFile;
 
-    /**
-     * @param arg0
-     * @throws java.awt.HeadlessException
-     */
-    public LogFileViewer(String arg0) {
-        super(arg0);
-    }
+  private JScrollPane scrollPane;
 
-    /**
-     * @param arg0
-     * @param arg1
-     */
-    public LogFileViewer(String arg0, GraphicsConfiguration arg1) {
-        super(arg0, arg1);
-    }
+  private JTextArea textArea;
 
-    public void init(File file, Dimension d) {
-        createMenus();
-        this.logFile = file;
-        this.textArea = new JTextArea();
-        // Copy
-        Action copyAction = this.textArea.getActionMap().get(
-                DefaultEditorKit.copyAction);
-        copyAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
-                KeyEvent.VK_C, InputEvent.CTRL_MASK));
-        copyAction.setEnabled(true);
-        this.scrollPane = new JScrollPane(this.textArea);
-        this.setContentPane(this.scrollPane);
-        this.scrollPane.setPreferredSize(d);
+  /**
+   * @throws java.awt.HeadlessException
+   */
+  public LogFileViewer() {
+    super();
+  }
+
+  /**
+   * @param arg0
+   */
+  public LogFileViewer(GraphicsConfiguration arg0) {
+    super(arg0);
+  }
+
+  /**
+   * @param arg0
+   * @throws java.awt.HeadlessException
+   */
+  public LogFileViewer(String arg0) {
+    super(arg0);
+  }
+
+  /**
+   * @param arg0
+   * @param arg1
+   */
+  public LogFileViewer(String arg0, GraphicsConfiguration arg1) {
+    super(arg0, arg1);
+  }
+
+  public void init(File file, Dimension d) {
+    createMenus();
+    this.logFile = file;
+    this.textArea = new JTextArea();
+    // Copy
+    Action copyAction = this.textArea.getActionMap().get(DefaultEditorKit.copyAction);
+    copyAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,
+                    InputEvent.CTRL_MASK));
+    copyAction.setEnabled(true);
+    this.scrollPane = new JScrollPane(this.textArea);
+    this.setContentPane(this.scrollPane);
+    this.scrollPane.setPreferredSize(d);
+    loadFile();
+    this.pack();
+    this.show();
+  }
+
+  private void createMenus() {
+    JMenuBar menuBar = new JMenuBar();
+    this.setJMenuBar(menuBar);
+    JMenu fileMenu = new JMenu("File");
+    menuBar.add(fileMenu);
+    JMenuItem reload = new JMenuItem("Reload Log File");
+    reload.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent event) {
         loadFile();
-        this.pack();
-        this.show();
-    }
-
-    private void createMenus() {
-        JMenuBar menuBar = new JMenuBar();
-        this.setJMenuBar(menuBar);
-        JMenu fileMenu = new JMenu("File");
-        menuBar.add(fileMenu);
-        JMenuItem reload = new JMenuItem("Reload Log File");
-        reload.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                loadFile();
-            }
-        });
-        fileMenu.add(reload);
-        JMenuItem exit = new JMenuItem("Close Window");
-        exit.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                LogFileViewer.this.dispose();
-            }
-        });
-        fileMenu.add(exit);
-    }
-
-    private void loadFile() {
-        String text = null;
-        try {
-            text = FileUtils.file2String(this.logFile, "UTF-8");
-        } catch (IOException e) {
-            handleException(e);
-            return;
-        }
-        this.textArea.setText(text);
-    }
-
-    protected void handleException(Exception e) {
-        boolean hasAsserts = false;
-        // assert(hasAsserts = true);
-        if (hasAsserts) {
-            e.printStackTrace();
-        }
-        JOptionPane.showMessageDialog(this, e.getMessage(), "Exception",
-                JOptionPane.ERROR_MESSAGE);
-
+      }
+    });
+    fileMenu.add(reload);
+    JMenuItem exit = new JMenuItem("Close Window");
+    exit.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent event) {
+        LogFileViewer.this.dispose();
+      }
+    });
+    fileMenu.add(exit);
+  }
+
+  private void loadFile() {
+    String text = null;
+    try {
+      text = FileUtils.file2String(this.logFile, "UTF-8");
+    } catch (IOException e) {
+      handleException(e);
+      return;
+    }
+    this.textArea.setText(text);
+  }
+
+  protected void handleException(Exception e) {
+    boolean hasAsserts = false;
+    // assert(hasAsserts = true);
+    if (hasAsserts) {
+      e.printStackTrace();
     }
+    JOptionPane.showMessageDialog(this, e.getMessage(), "Exception", JOptionPane.ERROR_MESSAGE);
 
+  }
 
 }