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 2016/11/13 16:08:26 UTC
svn commit: r1769510 [3/8] - in /uima/uimaj/branches/experiment-v3-jcas:
uimaj-adapter-soap/src/main/java/org/apache/uima/adapter/soap/
uimaj-adapter-soap/src/main/java/org/apache/uima/adapter/soap/axis11/
uimaj-component-test-util/src/main/java/org/ap...
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java Sun Nov 13 16:08:24 2016
@@ -50,6 +50,7 @@ import javax.swing.tree.TreeModel;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.TypeSystem;
+// TODO: Auto-generated Javadoc
/**
* TODO: add type comment for <code>AnnotationDisplayCustomizationFrame</code>.
*
@@ -57,12 +58,29 @@ import org.apache.uima.cas.TypeSystem;
*/
public class AnnotationDisplayCustomizationFrame extends JFrame {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -6695661439132793537L;
+ /**
+ * The listener interface for receiving typeTreeSelection events.
+ * The class that is interested in processing a typeTreeSelection
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addTypeTreeSelectionListener</code> method. When
+ * the typeTreeSelection event occurs, that object's appropriate
+ * method is invoked.
+ *
+ * @see TypeTreeSelectionEvent
+ */
private class TypeTreeSelectionListener implements TreeSelectionListener {
+
/**
+ * Value changed.
+ *
+ * @param event the event
* @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
*/
+ @Override
public void valueChanged(TreeSelectionEvent event) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) AnnotationDisplayCustomizationFrame.this.tree
.getLastSelectedPathComponent();
@@ -75,8 +93,15 @@ public class AnnotationDisplayCustomizat
}
+ /**
+ * The Class CustomizeBgButtonHandler.
+ */
private class CustomizeBgButtonHandler implements ActionListener {
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent event) {
Color color = JColorChooser.showDialog(AnnotationDisplayCustomizationFrame.this,
"Choose color", AnnotationDisplayCustomizationFrame.this.bgColor);
@@ -92,8 +117,15 @@ public class AnnotationDisplayCustomizat
}
+ /**
+ * The Class CustomizeFgButtonHandler.
+ */
private class CustomizeFgButtonHandler implements ActionListener {
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent event) {
Color color = JColorChooser.showDialog(AnnotationDisplayCustomizationFrame.this,
"Choose color", AnnotationDisplayCustomizationFrame.this.fgColor);
@@ -109,8 +141,15 @@ public class AnnotationDisplayCustomizat
}
+ /**
+ * The Class AcceptButtonHandler.
+ */
private class AcceptButtonHandler implements ActionListener {
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent event) {
Style style = AnnotationDisplayCustomizationFrame.this.styleMap
.get(AnnotationDisplayCustomizationFrame.this.currentTypeName);
@@ -131,8 +170,15 @@ public class AnnotationDisplayCustomizat
}
+ /**
+ * The Class CancelButtonHandler.
+ */
private class CancelButtonHandler implements ActionListener {
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent event) {
Style style = AnnotationDisplayCustomizationFrame.this.styleMap
.get(AnnotationDisplayCustomizationFrame.this.currentTypeName);
@@ -154,68 +200,97 @@ public class AnnotationDisplayCustomizat
}
+ /** The Constant FG. */
private static final int FG = 0;
+ /** The Constant BG. */
private static final int BG = 1;
+ /** The split pane. */
private JSplitPane splitPane;
+ /** The fg color. */
private Color fgColor;
+ /** The bg color. */
private Color bgColor;
+ /** The fg icon. */
private ColorIcon fgIcon;
+ /** The bg icon. */
private ColorIcon bgIcon;
+ /** The text pane. */
private JTextPane textPane;
+ /** The Constant defaultStyleName. */
private static final String defaultStyleName = "defaultUnannotStyle";
+ /** The Constant currentStyleName. */
private static final String currentStyleName = "currentStyle";
+ /** The current style. */
private Style currentStyle;
+ /** The current type name. */
private String currentTypeName;
+ /** The accept button. */
private JButton acceptButton;
+ /** The cancel button. */
private JButton cancelButton;
+ /** The style map. */
private Map<String, Style> styleMap;
+ /** The tree. */
private JTree tree;
/**
- * @throws java.awt.HeadlessException
+ * Instantiates a new annotation display customization frame.
+ *
+ * @throws java.awt.HeadlessException the java.awt. headless exception
*/
public AnnotationDisplayCustomizationFrame() {
super();
}
/**
- * @param arg0
+ * Instantiates a new annotation display customization frame.
+ *
+ * @param arg0 the arg 0
*/
public AnnotationDisplayCustomizationFrame(GraphicsConfiguration arg0) {
super(arg0);
}
/**
- * @param arg0
- * @throws java.awt.HeadlessException
+ * Instantiates a new annotation display customization frame.
+ *
+ * @param arg0 the arg 0
+ * @throws java.awt.HeadlessException the java.awt. headless exception
*/
public AnnotationDisplayCustomizationFrame(String arg0) {
super(arg0);
}
/**
- * @param arg0
- * @param arg1
+ * Instantiates a new annotation display customization frame.
+ *
+ * @param arg0 the arg 0
+ * @param arg1 the arg 1
*/
public AnnotationDisplayCustomizationFrame(String arg0, GraphicsConfiguration arg1) {
super(arg0, arg1);
}
+ /**
+ * Sets the current style.
+ *
+ * @param style the new current style
+ */
private void setCurrentStyle(Style style) {
// Copy style.
this.currentStyle = this.textPane.addStyle(currentStyleName, style);
@@ -223,11 +298,22 @@ public class AnnotationDisplayCustomizat
StyleConstants.setBackground(this.currentStyle, StyleConstants.getBackground(style));
}
+ /**
+ * Enable buttons.
+ *
+ * @param flag the flag
+ */
private void enableButtons(boolean flag) {
this.acceptButton.setEnabled(flag);
this.cancelButton.setEnabled(flag);
}
+ /**
+ * Inits the.
+ *
+ * @param styleMap1 the style map 1
+ * @param cas the cas
+ */
public void init(Map<String, Style> styleMap1, CAS cas) {
this.styleMap = styleMap1;
this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
@@ -239,6 +325,12 @@ public class AnnotationDisplayCustomizat
this.splitPane.setRightComponent(createCustomizationPanel(CAS.TYPE_NAME_ANNOTATION));
}
+ /**
+ * Creates the customization panel.
+ *
+ * @param typeName the type name
+ * @return the j panel
+ */
private JPanel createCustomizationPanel(String typeName) {
this.currentTypeName = typeName;
String defaultAnnotStyleName = CAS.TYPE_NAME_ANNOTATION;
@@ -267,6 +359,11 @@ public class AnnotationDisplayCustomizat
return topPanel;
}
+ /**
+ * Sets the customization panel.
+ *
+ * @param typeName the new customization panel
+ */
private void setCustomizationPanel(String typeName) {
this.currentTypeName = typeName;
Style defaultAnnotStyle = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
@@ -286,6 +383,11 @@ public class AnnotationDisplayCustomizat
this.repaint();
}
+ /**
+ * Creates the button panel.
+ *
+ * @param buttonPanel the button panel
+ */
private void createButtonPanel(JPanel buttonPanel) {
this.acceptButton = new JButton("OK");
this.acceptButton.addActionListener(new AcceptButtonHandler());
@@ -296,6 +398,9 @@ public class AnnotationDisplayCustomizat
enableButtons(false);
}
+ /**
+ * Sets the text pane.
+ */
private void setTextPane() {
Style defaultStyle = this.textPane.getStyle(defaultStyleName);
// Style style = textPane.getStyle(typeName);
@@ -316,6 +421,14 @@ public class AnnotationDisplayCustomizat
this.textPane.repaint();
}
+ /**
+ * Creates the color panel.
+ *
+ * @param text the text
+ * @param icon the icon
+ * @param buttonType the button type
+ * @return the j panel
+ */
private JPanel createColorPanel(String text, ColorIcon icon, int buttonType) {
JPanel colorPanel = new JPanel();
JLabel label = new JLabel(text);
@@ -332,6 +445,12 @@ public class AnnotationDisplayCustomizat
return colorPanel;
}
+ /**
+ * Creates the tree model.
+ *
+ * @param ts the ts
+ * @return the tree model
+ */
private TreeModel createTreeModel(TypeSystem ts) {
String typeName = CAS.TYPE_NAME_ANNOTATION;
DefaultMutableTreeNode node = new DefaultMutableTreeNode(typeName);
@@ -342,6 +461,13 @@ public class AnnotationDisplayCustomizat
return treeModel;
}
+ /**
+ * Adds the children.
+ *
+ * @param node the node
+ * @param type the type
+ * @param ts the ts
+ */
private static void addChildren(DefaultMutableTreeNode node, org.apache.uima.cas.Type type,
TypeSystem ts) {
// UIMA-2565 - Clash btw. cas.Type and Window.Type on JDK 7
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationExtent.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationExtent.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationExtent.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationExtent.java Sun Nov 13 16:08:24 2016
@@ -21,19 +21,29 @@ package org.apache.uima.tools.cvd;
import javax.swing.text.Style;
+// TODO: Auto-generated Javadoc
/**
- *
- *
+ * The Class AnnotationExtent.
*/
public class AnnotationExtent {
+ /** The start. */
private int start;
+ /** The end. */
private int end;
+ /** The style. */
private Style style;
+ /**
+ * Instantiates a new annotation extent.
+ *
+ * @param start the start
+ * @param end the end
+ * @param style the style
+ */
public AnnotationExtent(int start, int end, Style style) {
super();
this.start = start;
@@ -41,15 +51,27 @@ public class AnnotationExtent {
this.style = style;
}
+ /**
+ * Gets the length.
+ *
+ * @return the length
+ */
public int getLength() {
return this.end - this.start;
}
+ /**
+ * Gets the style.
+ *
+ * @return the style
+ */
public Style getStyle() {
return this.style;
}
/**
+ * Gets the end.
+ *
* @return int
*/
public int getEnd() {
@@ -57,6 +79,8 @@ public class AnnotationExtent {
}
/**
+ * Gets the start.
+ *
* @return int
*/
public int getStart() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ArrayNode.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ArrayNode.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ArrayNode.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ArrayNode.java Sun Nov 13 16:08:24 2016
@@ -19,6 +19,7 @@
package org.apache.uima.tools.cvd;
+// TODO: Auto-generated Javadoc
/**
* TODO: add type comment for <code>ArrayNode</code>.
*
@@ -26,29 +27,53 @@ package org.apache.uima.tools.cvd;
*/
public class ArrayNode extends FSTreeNode {
+ /** The Constant CUTOFF. */
public static final int CUTOFF = 100;
+ /** The Constant MULT. */
public static final int MULT = 10;
+ /** The start. */
private int start;
+ /** The end. */
private int end;
+ /**
+ * Instantiates a new array node.
+ *
+ * @param start the start
+ * @param end the end
+ */
public ArrayNode(int start, int end) {
super();
this.start = start;
this.end = end;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
public String toString() {
return "[" + this.start + ".." + this.end + "]";
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.cvd.FSTreeNode#initChildren()
+ */
+ @Override
protected void initChildren() {
// Does nothing.
}
+ /**
+ * Degree.
+ *
+ * @param i the i
+ * @return the int
+ */
// Compute the degree of i: (number of decimals of (i-1)) - 1.
static int degree(int i) {
if (i == 1) {
@@ -59,6 +84,8 @@ public class ArrayNode extends FSTreeNod
}
/**
+ * Gets the end.
+ *
* @return int
*/
public int getEnd() {
@@ -66,6 +93,8 @@ public class ArrayNode extends FSTreeNod
}
/**
+ * Gets the start.
+ *
* @return int
*/
public int getStart() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AutoFoldingMenu.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AutoFoldingMenu.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AutoFoldingMenu.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AutoFoldingMenu.java Sun Nov 13 16:08:24 2016
@@ -22,6 +22,7 @@ package org.apache.uima.tools.cvd;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+// TODO: Auto-generated Javadoc
/**
* Auto-folding menu. It overrides the add(JMenuItem) method only.
*
@@ -30,23 +31,41 @@ import javax.swing.JMenuItem;
*/
public class AutoFoldingMenu extends JMenu {
+ /** The Constant DEFAULT_MENU_SIZE. */
public static final int DEFAULT_MENU_SIZE = 12;
+ /** The max size. */
private final int maxSize;
+ /** The count. */
private int count = 0;
+ /** The submenu. */
private AutoFoldingMenu submenu = null;
+ /**
+ * Instantiates a new auto folding menu.
+ *
+ * @param title the title
+ * @param max the max
+ */
public AutoFoldingMenu(String title, int max) {
super(title);
this.maxSize = max;
}
+ /**
+ * Instantiates a new auto folding menu.
+ *
+ * @param title the title
+ */
public AutoFoldingMenu(String title) {
this(title, DEFAULT_MENU_SIZE);
}
+ /* (non-Javadoc)
+ * @see javax.swing.JMenu#add(javax.swing.JMenuItem)
+ */
@Override
public JMenuItem add(JMenuItem c) {
if (this.count < this.maxSize) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/CVD.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/CVD.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/CVD.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/CVD.java Sun Nov 13 16:08:24 2016
@@ -30,6 +30,7 @@ import org.apache.uima.internal.util.Com
import org.apache.uima.resource.RelativePathResolver;
import org.apache.uima.tools.images.Images;
+// TODO: Auto-generated Javadoc
/**
* The main class for the CAS Visual Debugger.
*
@@ -37,30 +38,52 @@ import org.apache.uima.tools.images.Imag
*/
public class CVD {
+ /** The Constant MAN_PATH_PROPERTY. */
public static final String MAN_PATH_PROPERTY = "uima.tools.cvd.manpath";
+ /** The Constant TEXT_FILE_PARAM. */
private static final String TEXT_FILE_PARAM = "-text";
+ /** The Constant DESC_FILE_PARAM. */
private static final String DESC_FILE_PARAM = "-desc";
+ /** The Constant EXECUTE_SWITCH. */
private static final String EXECUTE_SWITCH = "-exec";
+ /** The Constant DATA_PATH_PARAM. */
private static final String DATA_PATH_PARAM = "-datapath";
+ /** The Constant INI_FILE_PARAM. */
private static final String INI_FILE_PARAM = "-ini";
+ /** The Constant LOOK_AND_FEEL_PARAM. */
private static final String LOOK_AND_FEEL_PARAM = "-lookandfeel";
+ /** The Constant XMI_FILE_PARAM. */
private static final String XMI_FILE_PARAM = "-xmi";
+ /**
+ * Instantiates a new cvd.
+ */
private CVD() {
super();
}
+ /**
+ * Creates the main frame.
+ *
+ * @return the main frame
+ */
public static MainFrame createMainFrame() {
return createMainFrame(null);
}
+ /**
+ * Creates the main frame.
+ *
+ * @param iniFile the ini file
+ * @return the main frame
+ */
public static MainFrame createMainFrame(File iniFile) {
final MainFrame frame = new MainFrame(iniFile);
// Set icon.
@@ -71,6 +94,7 @@ public class CVD {
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
frame.pack();
frame.setVisible(true);
@@ -85,6 +109,11 @@ public class CVD {
return frame;
}
+ /**
+ * Creates the cmd line parser.
+ *
+ * @return the command line parser
+ */
private static final CommandLineParser createCmdLineParser() {
CommandLineParser parser = new CommandLineParser();
parser.addParameter(TEXT_FILE_PARAM, true);
@@ -97,6 +126,9 @@ public class CVD {
return parser;
}
+ /**
+ * Prints the usage.
+ */
private static final void printUsage() {
System.out
.println("Usage: java org.apache.uima.cvd.CVD [-text <TextFile>] [-desc <XmlDescriptor>] [-datapath <DataPath>] [-exec]");
@@ -104,6 +136,12 @@ public class CVD {
System.out.println(" -lookandfeel <LookAndFeelClassName>");
}
+ /**
+ * Check cmd line syntax.
+ *
+ * @param clp the clp
+ * @return true, if successful
+ */
private static final boolean checkCmdLineSyntax(CommandLineParser clp) {
if (clp.getRestArgs().length > 0) {
System.err.println("Error parsing CVD command line: unknown argument(s):");
@@ -126,6 +164,11 @@ public class CVD {
return true;
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(String[] args) {
try {
CommandLineParser clp = createCmdLineParser();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ColorIcon.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ColorIcon.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ColorIcon.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/ColorIcon.java Sun Nov 13 16:08:24 2016
@@ -25,6 +25,7 @@ import java.awt.Graphics;
import javax.swing.Icon;
+// TODO: Auto-generated Javadoc
/**
* TODO: add type comment for <code>ColorIcon</code>.
*
@@ -32,20 +33,35 @@ import javax.swing.Icon;
*/
public class ColorIcon implements Icon {
+ /** The Constant size. */
private static final int size = 20;
+ /** The color. */
private Color color = Color.black;
+ /**
+ * Instantiates a new color icon.
+ */
public ColorIcon() {
super();
}
+ /**
+ * Instantiates a new color icon.
+ *
+ * @param color the color
+ */
public ColorIcon(Color color) {
this();
this.color = color;
}
+ /**
+ * Sets the color.
+ *
+ * @param color the new color
+ */
public void setColor(Color color) {
this.color = color;
}
@@ -55,6 +71,7 @@ public class ColorIcon implements Icon {
*
* @see javax.swing.Icon#paintIcon(java.awt.Component, java.awt.Graphics, int, int)
*/
+ @Override
public void paintIcon(Component arg0, Graphics graphics, int x, int y) {
graphics.setColor(this.color);
graphics.fill3DRect(x, y, size, size, true);
@@ -65,6 +82,7 @@ public class ColorIcon implements Icon {
*
* @see javax.swing.Icon#getIconWidth()
*/
+ @Override
public int getIconWidth() {
return size;
}
@@ -74,6 +92,7 @@ public class ColorIcon implements Icon {
*
* @see javax.swing.Icon#getIconHeight()
*/
+ @Override
public int getIconHeight() {
return size;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSNode.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSNode.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSNode.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSNode.java Sun Nov 13 16:08:24 2016
@@ -42,6 +42,7 @@ import org.apache.uima.jcas.cas.StringAr
import org.apache.uima.jcas.cas.TOP;
import org.apache.uima.jcas.tcas.Annotation;
+// TODO: Auto-generated Javadoc
/**
* A node in the FS Tree Model
*
@@ -49,54 +50,81 @@ import org.apache.uima.jcas.tcas.Annotat
* - an Feature Structure array
* -- elements may be other nodes
* - a primitive value, including Strings
- * - a Feature Structure
+ * - a Feature Structure.
*/
public class FSNode extends FSTreeNode {
+ /** The Constant maxStringLength. */
private static final int maxStringLength = 100;
+ /** The s tree model. */
private final FSTreeModel fSTreeModel;
+ /** The Constant INT_FS. */
static final int INT_FS = 0;
+ /** The Constant FLOAT_FS. */
static final int FLOAT_FS = 1;
+ /** The Constant STRING_FS. */
static final int STRING_FS = 2;
+ /** The Constant ARRAY_FS. */
static final int ARRAY_FS = 3;
+ /** The Constant STD_FS. */
static final int STD_FS = 4;
+ /** The Constant DISPLAY_NODE. */
static final int DISPLAY_NODE = 5;
+ /** The Constant BYTE_FS. */
static final int BYTE_FS = 6;
+ /** The Constant BOOL_FS. */
static final int BOOL_FS = 7;
+ /** The Constant SHORT_FS. */
static final int SHORT_FS = 8;
+ /** The Constant LONG_FS. */
static final int LONG_FS = 9;
+ /** The Constant DOUBLE_FS. */
static final int DOUBLE_FS = 10;
+ /** The node class. */
private final int nodeClass;
+ /** The int or long like value. */
private final long intOrLongLikeValue;
+ /** The fs. */
private final TOP fs;
+ /** The string. */
private final String string;
+ /** The feat. */
private final Feature feat;
+ /** The array elem idx. */
private final int arrayElemIdx;
+ /** The is array elem. */
private final boolean isArrayElem;
+ /** The is shortened string. */
// Remember if we're displaying a shortened string.
private boolean isShortenedString = false;
+ /**
+ * K 2 nc.
+ *
+ * @param kind the kind
+ * @return the int
+ */
private int k2nc(SlotKind kind) {
switch(kind) {
case Slot_Boolean:
@@ -115,6 +143,15 @@ public class FSNode extends FSTreeNode {
}
}
+ /**
+ * Instantiates a new FS node.
+ *
+ * @param fSTreeModel the f S tree model
+ * @param nodeClass the node class
+ * @param fsOrString the fs or string
+ * @param intOrLongLikeValue the int or long like value
+ * @param feat the feat
+ */
FSNode(FSTreeModel fSTreeModel, int nodeClass, Object fsOrString, long intOrLongLikeValue, Feature feat) {
super();
this.fSTreeModel = fSTreeModel;
@@ -127,6 +164,15 @@ public class FSNode extends FSTreeNode {
this.isArrayElem = false;
}
+ /**
+ * Instantiates a new FS node.
+ *
+ * @param fSTreeModel the f S tree model
+ * @param nodeClass the node class
+ * @param fsOrString the fs or string
+ * @param intOrLongLikeValue the int or long like value
+ * @param elementIndex the element index
+ */
FSNode(FSTreeModel fSTreeModel, int nodeClass, Object fsOrString, long intOrLongLikeValue, int elementIndex) {
super();
this.fSTreeModel = fSTreeModel;
@@ -139,10 +185,19 @@ public class FSNode extends FSTreeNode {
this.isArrayElem = true;
}
+ /**
+ * Gets the node class.
+ *
+ * @return the node class
+ */
int getNodeClass() {
return this.nodeClass;
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.cvd.FSTreeNode#initChildren()
+ */
+ @Override
protected void initChildren() {
if (this.children != null) {
return;
@@ -260,6 +315,12 @@ public class FSNode extends FSTreeNode {
}
}
+ /**
+ * Make nodes.
+ *
+ * @param arrayNodes the array nodes
+ * @param newFSNode the new FS node
+ */
private void makeNodes(List<FSNode> arrayNodes, IntFunction<FSNode> newFSNode) {
final int size = arrayNodes.size();
for (int idx = 0; idx < size; idx++) {
@@ -267,6 +328,10 @@ public class FSNode extends FSTreeNode {
}
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
public String toString() {
if (this.nodeClass == DISPLAY_NODE) {
return this.fSTreeModel.getRootString();
@@ -286,12 +351,18 @@ public class FSNode extends FSTreeNode {
return buf.toString();
}
+ /**
+ * Gets the feature string.
+ *
+ * @return the feature string
+ */
private String getFeatureString() {
return "<i>" + this.feat.getShortName() + "</i>";
}
/**
- *
+ * Checks if is shortened string.
+ *
* @return if this is a string node displaying a shortened string
*/
boolean isShortenedString() {
@@ -308,6 +379,11 @@ public class FSNode extends FSTreeNode {
return this.string;
}
+ /**
+ * Gets the value string.
+ *
+ * @return the value string
+ */
private String getValueString() {
switch (this.nodeClass) {
@@ -356,6 +432,12 @@ public class FSNode extends FSTreeNode {
return null;
}
+ /**
+ * Shorten string.
+ *
+ * @param s the s
+ * @return the string
+ */
private static final String shortenString(String s) {
if (s.length() <= maxStringLength) {
return s;
@@ -366,6 +448,12 @@ public class FSNode extends FSTreeNode {
return buf.toString();
}
+ /**
+ * Escape lt.
+ *
+ * @param s the s
+ * @return the string
+ */
private static final String escapeLt(String s) {
final int max = s.length();
int i = 0;
@@ -390,26 +478,56 @@ public class FSNode extends FSTreeNode {
return buf.toString();
}
+ /**
+ * Gets the null string.
+ *
+ * @return the null string
+ */
private String getNullString() {
return "<null>";
}
+ /**
+ * Gets the array pos.
+ *
+ * @return the array pos
+ */
int getArrayPos() {
return this.arrayElemIdx;
}
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
TypeImpl getType() {
return fs._getTypeImpl();
}
+ /**
+ * Checks if is annotation.
+ *
+ * @return true, if is annotation
+ */
public boolean isAnnotation() {
return fs != null && fs instanceof Annotation;
}
+ /**
+ * Gets the start.
+ *
+ * @return the start
+ */
public int getStart() {
return isAnnotation() ? ((Annotation)fs).getBegin() : -1;
}
+ /**
+ * Gets the end.
+ *
+ * @return the end
+ */
public int getEnd() {
return isAnnotation() ? ((Annotation)fs).getEnd() : -1;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeModel.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeModel.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeModel.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeModel.java Sun Nov 13 16:08:24 2016
@@ -37,23 +37,30 @@ import org.apache.uima.cas.impl.TypeImpl
import org.apache.uima.cas.impl.TypeSystemConstants;
import org.apache.uima.jcas.cas.TOP;
+// TODO: Auto-generated Javadoc
/**
- * Swing Tree Model for Feature Structures
+ * Swing Tree Model for Feature Structures.
*/
public class FSTreeModel implements TreeModel {
+ /** The root. */
private FSTreeNode root;
+ /** The cas. */
private CASImpl cas;
+ /** The tree model listeners. */
private List<TreeModelListener> treeModelListeners = new ArrayList<TreeModelListener>();
+ /** The fss. */
private List<FSNode> fss;
+ /** The Constant defaultRootString. */
private static final String defaultRootString = "<html><b>" + MainFrame.htmlGrayColor
+ "FS List - no selection</b></html>";
+ /** The root string. */
private String rootString = defaultRootString;
/**
@@ -65,6 +72,13 @@ public class FSTreeModel implements Tree
this.root.setChildren(new ArrayList<FSTreeNode>());
}
+ /**
+ * Update.
+ *
+ * @param indexName the index name
+ * @param index the index
+ * @param cas1 the cas 1
+ */
public void update(String indexName, FSIndex index, CAS cas1) {
// this.indexName = indexName;
this.cas = (CASImpl) cas1;
@@ -90,6 +104,9 @@ public class FSTreeModel implements Tree
}
}
+ /**
+ * Reset.
+ */
public void reset() {
this.root.removeAllChildren();
this.rootString = defaultRootString;
@@ -102,20 +119,35 @@ public class FSTreeModel implements Tree
}
+ /**
+ * Gets the f ss.
+ *
+ * @return the f ss
+ */
public List<FSNode> getFSs() {
return this.fss;
}
/**
+ * Gets the root.
+ *
+ * @return the root
* @see javax.swing.tree.TreeModel#getRoot()
*/
+ @Override
public Object getRoot() {
return this.root;
}
/**
+ * Gets the child.
+ *
+ * @param parent the parent
+ * @param index the index
+ * @return the child
* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
*/
+ @Override
public Object getChild(Object parent, int index) {
FSTreeNode node = (FSTreeNode) parent;
node.initChildren();
@@ -150,7 +182,13 @@ public class FSTreeModel implements Tree
// return FSNode.STD_FS;
// }
- int getNodeType(Type type) {
+ /**
+ * Gets the node type.
+ *
+ * @param type the type
+ * @return the node type
+ */
+int getNodeType(Type type) {
if (type instanceof TypeImpl_string) {
return FSNode.STRING_FS;
} else {
@@ -169,30 +207,51 @@ public class FSTreeModel implements Tree
}
/**
+ * Gets the child count.
+ *
+ * @param parent the parent
+ * @return the child count
* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
*/
+ @Override
public int getChildCount(Object parent) {
return ((FSTreeNode) parent).getChildCount();
}
/**
+ * Checks if is leaf.
+ *
+ * @param node the node
+ * @return true, if is leaf
* @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
*/
+ @Override
public boolean isLeaf(Object node) {
return (getChildCount(node) == 0);
}
/**
+ * Value for path changed.
+ *
+ * @param path the path
+ * @param newValue the new value
* @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
* java.lang.Object)
*/
+ @Override
public void valueForPathChanged(TreePath path, Object newValue) {
// Does nothing.
}
/**
+ * Gets the index of child.
+ *
+ * @param parent the parent
+ * @param child the child
+ * @return the index of child
* @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
*/
+ @Override
public int getIndexOfChild(Object parent, Object child) {
FSTreeNode node = (FSTreeNode) parent;
node.initChildren();
@@ -200,20 +259,30 @@ public class FSTreeModel implements Tree
}
/**
+ * Adds the tree model listener.
+ *
+ * @param arg0 the arg 0
* @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
*/
+ @Override
public void addTreeModelListener(TreeModelListener arg0) {
this.treeModelListeners.add(arg0);
}
/**
+ * Removes the tree model listener.
+ *
+ * @param arg0 the arg 0
* @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
*/
+ @Override
public void removeTreeModelListener(TreeModelListener arg0) {
this.treeModelListeners.remove(arg0);
}
/**
+ * Gets the cas.
+ *
* @return CASImpl
*/
CASImpl getCas() {
@@ -221,12 +290,23 @@ public class FSTreeModel implements Tree
}
/**
+ * Gets the root string.
+ *
* @return String
*/
String getRootString() {
return this.rootString;
}
+ /**
+ * Creates the array children.
+ *
+ * @param start the start
+ * @param end the end
+ * @param array the array
+ * @param model the model
+ * @return the list
+ */
static List<FSTreeNode> createArrayChildren(int start, int end, List<FSNode> array, FSTreeModel model) {
ArrayList<FSTreeNode> kids = new ArrayList<FSTreeNode>();
final int size = end - start;
@@ -265,6 +345,12 @@ public class FSTreeModel implements Tree
return kids;
}
+ /**
+ * Path to node.
+ *
+ * @param fsNum the fs num
+ * @return the tree path
+ */
public TreePath pathToNode(int fsNum) {
List<FSTreeNode> p = new ArrayList<FSTreeNode>();
p.add(this.root);
@@ -273,6 +359,14 @@ public class FSTreeModel implements Tree
return path;
}
+ /**
+ * Gets the path to node.
+ *
+ * @param n the n
+ * @param dtrs the dtrs
+ * @param path the path
+ * @return the path to node
+ */
private void getPathToNode(int n, List<FSTreeNode> dtrs, List<FSTreeNode> path) {
// Do a linear search. The branching factor is small, so this should not
// be a problem.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeNode.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeNode.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeNode.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/FSTreeNode.java Sun Nov 13 16:08:24 2016
@@ -22,6 +22,7 @@ package org.apache.uima.tools.cvd;
import java.util.ArrayList;
import java.util.List;
+// TODO: Auto-generated Javadoc
/**
* TODO: add type comment for <code>FSTreeNode</code>.
*
@@ -29,26 +30,48 @@ import java.util.List;
*/
public abstract class FSTreeNode {
+ /** The children. */
protected List<FSTreeNode> children = null;
+ /**
+ * Instantiates a new FS tree node.
+ */
public FSTreeNode() {
super();
// TODO Auto-generated constructor stub
}
+ /**
+ * Removes the all children.
+ */
void removeAllChildren() {
this.children = new ArrayList<FSTreeNode>();
}
+ /**
+ * Sets the children.
+ *
+ * @param children the new children
+ */
void setChildren(List<FSTreeNode> children) {
this.children = children;
}
+ /**
+ * Gets the children.
+ *
+ * @return the children
+ */
List<FSTreeNode> getChildren() {
return this.children;
}
+ /**
+ * Gets the child count.
+ *
+ * @return the child count
+ */
int getChildCount() {
initChildren();
if (this.children == null) {
@@ -57,6 +80,9 @@ public abstract class FSTreeNode {
return this.children.size();
}
+ /**
+ * Inits the children.
+ */
protected abstract void initChildren();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/IndexTreeNode.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/IndexTreeNode.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/IndexTreeNode.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/IndexTreeNode.java Sun Nov 13 16:08:24 2016
@@ -21,6 +21,7 @@ package org.apache.uima.tools.cvd;
import org.apache.uima.cas.Type;
+// TODO: Auto-generated Javadoc
/**
* Class comment for IndexTreeNode.java goes here.
*
@@ -28,12 +29,22 @@ import org.apache.uima.cas.Type;
*/
public class IndexTreeNode {
+ /** The name. */
private final String name;
+ /** The type. */
private final Type type;
+ /** The size. */
private final int size;
+ /**
+ * Instantiates a new index tree node.
+ *
+ * @param name the name
+ * @param type the type
+ * @param size the size
+ */
public IndexTreeNode(String name, Type type, int size) {
super();
this.name = name;
@@ -51,6 +62,10 @@ public class IndexTreeNode {
this.size = 0;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
public String toString() {
return "<html><font color=green>" + this.name + "</font> [" + this.size + "]</html>";
}
@@ -73,10 +88,18 @@ public class IndexTreeNode {
return this.type;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
public boolean equals(Object o) {
return (this == o);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
public int hashCode() {
return super.hashCode();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/LogFileViewer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/LogFileViewer.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/LogFileViewer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/LogFileViewer.java Sun Nov 13 16:08:24 2016
@@ -41,6 +41,7 @@ import javax.swing.text.DefaultEditorKit
import org.apache.uima.util.FileUtils;
+// TODO: Auto-generated Javadoc
/**
* Simple file viewer for viewing log files.
*
@@ -48,44 +49,62 @@ import org.apache.uima.util.FileUtils;
*/
public class LogFileViewer extends JFrame {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 3599235286749804258L;
+ /** The log file. */
private File logFile;
+ /** The scroll pane. */
private JScrollPane scrollPane;
+ /** The text area. */
private JTextArea textArea;
/**
- * @throws java.awt.HeadlessException
- */
+ * Instantiates a new log file viewer.
+ *
+ * @throws java.awt.HeadlessException the java.awt. headless exception
+ */
public LogFileViewer() {
super();
}
/**
- * @param arg0
- */
+ * Instantiates a new log file viewer.
+ *
+ * @param arg0 the arg 0
+ */
public LogFileViewer(GraphicsConfiguration arg0) {
super(arg0);
}
/**
- * @param arg0
- * @throws java.awt.HeadlessException
- */
+ * Instantiates a new log file viewer.
+ *
+ * @param arg0 the arg 0
+ * @throws java.awt.HeadlessException the java.awt. headless exception
+ */
public LogFileViewer(String arg0) {
super(arg0);
}
/**
- * @param arg0
- * @param arg1
- */
+ * Instantiates a new log file viewer.
+ *
+ * @param arg0 the arg 0
+ * @param arg1 the arg 1
+ */
public LogFileViewer(String arg0, GraphicsConfiguration arg1) {
super(arg0, arg1);
}
+ /**
+ * Inits the.
+ *
+ * @param file the file
+ * @param d the d
+ */
public void init(File file, Dimension d) {
createMenus();
this.logFile = file;
@@ -107,6 +126,9 @@ public class LogFileViewer extends JFram
this.setVisible(true);
}
+ /**
+ * Creates the menus.
+ */
private void createMenus() {
JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
@@ -114,20 +136,27 @@ public class LogFileViewer extends JFram
menuBar.add(fileMenu);
JMenuItem reload = new JMenuItem("Reload Log File");
reload.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
+ @Override
+ public void actionPerformed(ActionEvent event) {
loadFile();
}
});
fileMenu.add(reload);
JMenuItem exit = new JMenuItem("Close Window");
exit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
+ @Override
+ public void actionPerformed(ActionEvent event) {
LogFileViewer.this.dispose();
}
});
fileMenu.add(exit);
}
+ /**
+ * Load file.
+ *
+ * @return true, if successful
+ */
private boolean loadFile() {
if (!this.logFile.exists()) {
JOptionPane.showMessageDialog(this, "The log file \"" + this.logFile.getAbsolutePath()
@@ -146,6 +175,11 @@ public class LogFileViewer extends JFram
return true;
}
+ /**
+ * Handle exception.
+ *
+ * @param e the e
+ */
protected void handleException(Exception e) {
boolean hasAsserts = false;
// assert(hasAsserts = true);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java Sun Nov 13 16:08:24 2016
@@ -159,6 +159,7 @@ import org.apache.uima.util.Logger;
import org.apache.uima.util.ProcessTrace;
import org.apache.uima.util.XMLInputSource;
+// TODO: Auto-generated Javadoc
/**
* Class comment for MainFrame.java goes here.
*
@@ -166,8 +167,10 @@ import org.apache.uima.util.XMLInputSour
*/
public class MainFrame extends JFrame {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -1357410768440678886L;
+ /** The log levels. */
public static List<Level> logLevels = new ArrayList<Level>(9);
static {
logLevels.add(Level.OFF);
@@ -181,235 +184,342 @@ public class MainFrame extends JFrame {
logLevels.add(Level.ALL);
}
+ /** The Constant loggerPropertiesFileName. */
private static final String loggerPropertiesFileName = "org/apache/uima/tools/annot_view/Logger.properties";
+ /** The Constant defaultText. */
private static final String defaultText =
"Load or edit text here.";
+ /** The Constant titleText. */
private static final String titleText = "CAS Visual Debugger (CVD)";
+ /** The Constant htmlGrayColor. */
static final String htmlGrayColor = "<font color=#808080>";
+ /** The Constant indexReposRootLabel. */
private static final String indexReposRootLabel = "<html><b>CAS Index Repository</b></html>";
+ /** The Constant noIndexReposLabel. */
private static final String noIndexReposLabel = "<html><b>" + htmlGrayColor
+ "CAS Index Repository</b></html>";
+ /** The text area. */
// The content areas.
private JTextArea textArea;
+ /** The index tree. */
private JTree indexTree;
+ /** The fs tree. */
private JTree fsTree;
+ /** The status panel. */
private JPanel statusPanel;
+ /** The status bar. */
private JTextField statusBar;
+ /** The file status. */
private JTextField fileStatus;
+ /** The ae status. */
private JTextField aeStatus;
+ /** The caret status. */
private JTextField caretStatus;
+ /** The text title border. */
private Border textTitleBorder;
+ /** The is dirty. */
// Dirty flag for the editor.
private boolean isDirty;
+ /** The text scroll pane. */
// The scroll panels.
private JScrollPane textScrollPane;
+ /** The index tree scroll pane. */
private JScrollPane indexTreeScrollPane;
+ /** The fs tree scroll pane. */
private JScrollPane fsTreeScrollPane;
+ /** The file menu. */
// Menus
private JMenu fileMenu = null;
+ /** The file save item. */
private JMenuItem fileSaveItem = null;
+ /** The edit menu. */
private JMenu editMenu;
+ /** The undo item. */
private JMenuItem undoItem;
+ /** The undo mgr. */
private UndoMgr undoMgr;
+ /** The cut action. */
private Action cutAction;
+ /** The copy action. */
private Action copyAction;
+ /** The all annotation viewer item. */
private JMenuItem allAnnotationViewerItem;
+ /** The acd item. */
private JMenuItem acdItem;
+ /** The ts viewer item. */
private JMenuItem tsViewerItem;
+ /** The re run menu. */
private JMenuItem reRunMenu;
+ /** The run CPC menu. */
private JMenuItem runCPCMenu;
+ /** The run on cas menu item. */
private JMenuItem runOnCasMenuItem;
+ /** The show perf report item. */
private JMenuItem showPerfReportItem;
+ /** The text popup. */
private JPopupMenu textPopup;
+ /** The xcas read item. */
private JMenuItem xcasReadItem;
+ /** The xcas write item. */
private JMenuItem xcasWriteItem;
+ /** The xmi cas read item. */
private JMenuItem xmiCasReadItem;
+ /** The xmi cas write item. */
private JMenuItem xmiCasWriteItem;
+ /** The type system write item. */
private JMenuItem typeSystemWriteItem;
+ /** The type system read item. */
private JMenuItem typeSystemReadItem;
+ /** The recent text file menu. */
private JMenu recentTextFileMenu;
+ /** The recent desc file menu. */
private JMenu recentDescFileMenu;
+ /** The ini file. */
// Ini file
private File iniFile = null;
// Code pages
+ /** The code pages. */
private List<String> codePages = null;
+ /** The code page. */
private String codePage = null;
+ /** The cp menu. */
private JMenu cpMenu;
+ /** The cp buttons. */
private ButtonGroup cpButtons;
+ /** The language prefs list. */
// Language support
String languagePrefsList = null;
+ /** The languages. */
// private String defaultLanguagePref = null;
private List<String> languages = null;
+ /** The lang menu. */
private JMenu langMenu;
+ /** The lang buttons. */
private ButtonGroup langButtons;
+ /** The Constant LANGUAGE_DEFAULT. */
private static final String LANGUAGE_DEFAULT = "en";
+ /** The language. */
private String language;
+ /** The Constant defaultLanguages. */
private static final String defaultLanguages = "de,en,fr,ja,ko-kr,pt-br,zh-cn,zh-tw,x-unspecified";
+ /** The text file. */
private File textFile = null;
+ /** The file open dir. */
private File fileOpenDir = null;
+ /** The annot open dir. */
private File annotOpenDir = null;
+ /** The xcas file open dir. */
private File xcasFileOpenDir = null;
+ /** The color settings dir. */
private File colorSettingsDir = null;
+ /** The index label. */
// Selected index
private String indexLabel = null;
+ /** The index. */
private FSIndex index = null;
+ /** The is annotation index. */
private boolean isAnnotationIndex = false;
+ /** The cas. */
private CAS cas = null;
+ /** The ae descriptor file. */
private File aeDescriptorFile = null;
+ /** The ae. */
private AnalysisEngine ae = null;
+ /** The log file. */
private File logFile = null;
+ /** The log. */
private Logger log = null;
+ /** The color setting file. */
private File colorSettingFile;
+ /** The Constant selectionColor. */
private static final Color selectionColor = Color.orange;
+ /** The preferences. */
private Properties preferences;
+ /** The last run process trace. */
private ProcessTrace lastRunProcessTrace = null;
+ /** The Constant textDirPref. */
public static final String textDirPref = "dir.open.text";
+ /** The Constant aeDirPref. */
public static final String aeDirPref = "dir.open.tae";
+ /** The Constant xcasDirPref. */
public static final String xcasDirPref = "dir.open.xcas";
+ /** The Constant textSizePref. */
public static final String textSizePref = "textArea.size";
+ /** The Constant indexTreeSizePref. */
public static final String indexTreeSizePref = "indexTree.size";
+ /** The Constant fsTreeSizePref. */
public static final String fsTreeSizePref = "fsTree.size";
+ /** The Constant tsWindowSizePref. */
public static final String tsWindowSizePref = "tsWindow.size";
+ /** The Constant annotViewSizePref. */
public static final String annotViewSizePref = "annotViewWindow.size";
+ /** The Constant logViewSizePref. */
public static final String logViewSizePref = "logViewWindow.size";
+ /** The Constant widthSuffix. */
public static final String widthSuffix = ".width";
+ /** The Constant heightSuffix. */
public static final String heightSuffix = ".height";
+ /** The Constant colorFilePref. */
private static final String colorFilePref = "colors.file";
+ /** The Constant colorDirPref. */
private static final String colorDirPref = "colors.dir";
+ /** The Constant cpCurrentPref. */
private static final String cpCurrentPref = "cp.selected";
+ /** The Constant langCurrentPref. */
private static final String langCurrentPref = "lang.selected";
+ /** The Constant langListPref. */
private static final String langListPref = "lang.list";
+ /** The Constant textFileListPref. */
private static final String textFileListPref = "file.text.list";
+ /** The Constant descFileListPref. */
private static final String descFileListPref = "file.desc.list";
+ /** The Constant dataPathPref. */
private static final String dataPathPref = "datapath";
+ /** The Constant textDimensionDefault. */
private static final Dimension textDimensionDefault = new Dimension(500, 400);
+ /** The Constant fsTreeDimensionDefault. */
private static final Dimension fsTreeDimensionDefault = new Dimension(200, 200);
+ /** The Constant logFileDimensionDefault. */
private static final Dimension logFileDimensionDefault = new Dimension(500, 600);
+ /** The Constant DEFAULT_STYLE_NAME. */
public static final String DEFAULT_STYLE_NAME = "defaultStyle";
+ /** The style map. */
private Map<String, Style> styleMap = new HashMap<String, Style>();
+ /** The Constant maxRecentSize. */
// For recently used text and descriptor files.
private static final int maxRecentSize = 8;
+ /** The recent text files. */
private final RecentFilesList recentTextFiles = new RecentFilesList(maxRecentSize);
+ /** The text file name list. */
private final List<String> textFileNameList = new ArrayList<String>();
+ /** The recent desc files. */
private final RecentFilesList recentDescFiles = new RecentFilesList(maxRecentSize);
+ /** The desc file name list. */
private final List<String> descFileNameList = new ArrayList<String>();
+ /** The cursor owning components. */
// For cursor handling (busy cursor). Is there a better way?
private List<Component> cursorOwningComponents = new ArrayList<Component>();
+ /** The cursor cache. */
private List<Cursor> cursorCache = null;
+ /** The data path name. */
private String dataPathName;
+ /** The sofa selection combo box. */
private JComboBox sofaSelectionComboBox;
+ /** The sofa selection panel. */
private JPanel sofaSelectionPanel;
+ /** The exit on close. */
private boolean exitOnClose = true;
/**
* Constructor for MainFrame.
- *
+ *
+ * @param iniFile the ini file
* @throws HeadlessException -
*/
public MainFrame(File iniFile) {
@@ -418,6 +528,11 @@ public class MainFrame extends JFrame {
init();
}
+ /**
+ * Run AE.
+ *
+ * @param doCasReset the do cas reset
+ */
public void runAE(boolean doCasReset) {
setStatusbarMessage("Running Annotator.");
Timer timer = new Timer();
@@ -436,6 +551,9 @@ public class MainFrame extends JFrame {
this.runOnCasMenuItem.setEnabled(true);
}
+ /**
+ * Run CPC.
+ */
public void runCPC() {
setStatusbarMessage("Running CollectionProcessComplete.");
Timer timer = new Timer();
@@ -459,10 +577,20 @@ public class MainFrame extends JFrame {
this.runOnCasMenuItem.setEnabled(true);
}
+ /**
+ * Sets the data path.
+ *
+ * @param dataPath the new data path
+ */
public void setDataPath(String dataPath) {
this.dataPathName = dataPath;
}
+ /**
+ * Load AE descriptor.
+ *
+ * @param descriptorFile the descriptor file
+ */
public void loadAEDescriptor(File descriptorFile) {
addRecentDescFile(descriptorFile);
setWaitCursor();
@@ -511,11 +639,22 @@ public class MainFrame extends JFrame {
resetCursor();
}
+ /**
+ * Handle exception.
+ *
+ * @param e the e
+ */
public void handleException(Throwable e) {
StringBuffer msg = new StringBuffer();
handleException(e, msg);
}
+ /**
+ * Handle exception.
+ *
+ * @param e the e
+ * @param msg the msg
+ */
protected void handleException(Throwable e, StringBuffer msg) {
msg.append(e.getClass().getName() + ": ");
if (e.getMessage() != null) {
@@ -538,10 +677,18 @@ public class MainFrame extends JFrame {
}
+ /**
+ * Show error.
+ *
+ * @param msg the msg
+ */
private void showError(String msg) {
JOptionPane.showMessageDialog(this, msg, "Error", JOptionPane.ERROR_MESSAGE);
}
+ /**
+ * Load file.
+ */
public void loadFile() {
try {
if (this.textFile.exists() && this.textFile.canRead()) {
@@ -567,6 +714,11 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Load xmi file.
+ *
+ * @param xmiCasFile the xmi cas file
+ */
public void loadXmiFile(File xmiCasFile) {
try {
setXcasFileOpenDir(xmiCasFile.getParentFile());
@@ -591,6 +743,12 @@ public class MainFrame extends JFrame {
}
+ /**
+ * Gets the mnemonic.
+ *
+ * @param i the i
+ * @return the mnemonic
+ */
private static final int getMnemonic(int i) {
switch (i) {
case 1:
@@ -616,6 +774,13 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Creates the recent text file item.
+ *
+ * @param num the num
+ * @param file the file
+ * @return the j menu item
+ */
private final JMenuItem createRecentTextFileItem(int num, File file) {
String fileShortName = file.getName();
JMenuItem item = new JMenuItem(num + " " + fileShortName, getMnemonic(num));
@@ -624,6 +789,11 @@ public class MainFrame extends JFrame {
return item;
}
+ /**
+ * Adds the recent text file.
+ *
+ * @param file the file
+ */
private void addRecentTextFile(File file) {
this.recentTextFiles.addFile(file);
this.recentTextFileMenu.removeAll();
@@ -634,6 +804,13 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Creates the recent desc file item.
+ *
+ * @param num the num
+ * @param file the file
+ * @return the j menu item
+ */
private final JMenuItem createRecentDescFileItem(int num, File file) {
String fileShortName = file.getName();
JMenuItem item = new JMenuItem(num + " " + fileShortName, getMnemonic(num));
@@ -642,6 +819,11 @@ public class MainFrame extends JFrame {
return item;
}
+ /**
+ * Adds the recent desc file.
+ *
+ * @param file the file
+ */
private void addRecentDescFile(File file) {
this.recentDescFiles.addFile(file);
this.recentDescFileMenu.removeAll();
@@ -675,6 +857,11 @@ public class MainFrame extends JFrame {
loadFile();
}
+ /**
+ * Sets the text no title.
+ *
+ * @param text the new text no title
+ */
// Set the text.
public void setTextNoTitle(String text) {
this.textArea.setText(text);
@@ -682,6 +869,9 @@ public class MainFrame extends JFrame {
this.isDirty = false;
}
+ /**
+ * Sets the title.
+ */
public void setTitle() {
StringBuffer buf = new StringBuffer();
buf.append(titleText);
@@ -694,6 +884,11 @@ public class MainFrame extends JFrame {
this.setTitle(buf.toString());
}
+ /**
+ * Save file.
+ *
+ * @return true, if successful
+ */
public boolean saveFile() {
if (this.textFile.exists() && !this.textFile.canWrite()) {
showError("File is not writable: " + this.textFile.getAbsolutePath());
@@ -730,6 +925,12 @@ public class MainFrame extends JFrame {
return true;
}
+ /**
+ * Confirm overwrite.
+ *
+ * @param f the f
+ * @return true, if successful
+ */
public boolean confirmOverwrite(File f) {
if (f.exists()) {
Object[] options = {"Yes, Overwrite.",
@@ -750,6 +951,9 @@ public class MainFrame extends JFrame {
return true;
}
+ /**
+ * Creates the text area.
+ */
private void createTextArea() {
try {
this.textArea = new JTextArea();
@@ -774,6 +978,9 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Populate edit menu.
+ */
private void populateEditMenu() {
this.undoItem = new JMenuItem("Undo");
this.undoItem.addActionListener(this.undoMgr);
@@ -811,6 +1018,11 @@ public class MainFrame extends JFrame {
this.editMenu.add(pasteItem);
}
+ /**
+ * Creates the edit action map.
+ *
+ * @return the hash map
+ */
private HashMap<Object, Action> createEditActionMap() {
HashMap<Object, Action> map = new HashMap<Object, Action>();
Action[] ar = this.textArea.getActions();
@@ -821,6 +1033,11 @@ public class MainFrame extends JFrame {
return map;
}
+ /**
+ * Creates the menu bar.
+ *
+ * @return the j menu bar
+ */
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
createFileMenu();
@@ -832,6 +1049,11 @@ public class MainFrame extends JFrame {
return menuBar;
}
+ /**
+ * Creates the edit menu.
+ *
+ * @return the j menu
+ */
private JMenu createEditMenu() {
this.editMenu = new JMenu("Edit");
this.editMenu.setMnemonic(KeyEvent.VK_E);
@@ -839,6 +1061,11 @@ public class MainFrame extends JFrame {
return this.editMenu;
}
+ /**
+ * Creates the help menu.
+ *
+ * @return the j menu
+ */
private JMenu createHelpMenu() {
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic(KeyEvent.VK_H);
@@ -858,6 +1085,9 @@ public class MainFrame extends JFrame {
return helpMenu;
}
+ /**
+ * Creates the file menu.
+ */
private void createFileMenu() {
this.fileMenu = new JMenu("File");
@@ -933,6 +1163,9 @@ public class MainFrame extends JFrame {
setEnableCasFileReadingAndWriting();
}
+ /**
+ * Sets the enable cas file reading and writing.
+ */
public final void setEnableCasFileReadingAndWriting() {
final boolean enable = this.cas != null;
this.xcasReadItem.setEnabled(enable);
@@ -941,10 +1174,18 @@ public class MainFrame extends JFrame {
this.xmiCasWriteItem.setEnabled(enable);
}
+ /**
+ * Adds the cursor owning component.
+ *
+ * @param comp the comp
+ */
private final void addCursorOwningComponent(Component comp) {
this.cursorOwningComponents.add(comp);
}
+ /**
+ * Sets the wait cursor.
+ */
private final void setWaitCursor() {
this.setEnabled(false);
this.cursorCache = new ArrayList<Cursor>();
@@ -955,6 +1196,9 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Reset cursor.
+ */
public final void resetCursor() {
if (this.cursorCache == null) {
return;
@@ -966,6 +1210,9 @@ public class MainFrame extends JFrame {
this.setEnabled(true);
}
+ /**
+ * Creates the code pages.
+ */
public void createCodePages() {
// Get supported encodings from JVM
Map<String, Charset> charsetMap = Charset.availableCharsets();
@@ -986,16 +1233,25 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Reset trees.
+ */
public void resetTrees() {
updateIndexTree(false);
}
+ /**
+ * Creates the CP menu.
+ */
private void createCPMenu() {
createCodePages();
this.cpMenu = new AutoFoldingMenu("Code Page", 20);
resetCPMenu();
}
+ /**
+ * Reset CP menu.
+ */
public void resetCPMenu() {
this.cpMenu.removeAll();
this.cpButtons = new ButtonGroup();
@@ -1014,6 +1270,11 @@ public class MainFrame extends JFrame {
}
+ /**
+ * Adds the language.
+ *
+ * @param language1 the language 1
+ */
public void addLanguage(String language1) {
this.language = language1;
if (!this.languages.contains(language1)) {
@@ -1022,12 +1283,18 @@ public class MainFrame extends JFrame {
resetLangMenu();
}
+ /**
+ * Creates the lang menu.
+ */
private void createLangMenu() {
createLanguages();
this.langMenu = new JMenu("Language");
resetLangMenu();
}
+ /**
+ * Reset lang menu.
+ */
public void resetLangMenu() {
this.langMenu.removeAll();
this.langButtons = new ButtonGroup();
@@ -1059,6 +1326,9 @@ public class MainFrame extends JFrame {
this.langMenu.add(restoreDefaultsItem);
}
+ /**
+ * Creates the languages.
+ */
public void createLanguages() {
this.languages = new ArrayList<String>();
if (this.languagePrefsList == null) {
@@ -1077,6 +1347,11 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Creates the run menu.
+ *
+ * @return the j menu
+ */
private JMenu createRunMenu() {
JMenu runMenu = new JMenu("Run");
runMenu.setMnemonic(KeyEvent.VK_R);
@@ -1102,6 +1377,7 @@ public class MainFrame extends JFrame {
this.showPerfReportItem = new JMenuItem("Performance report");
this.showPerfReportItem.setEnabled(false);
this.showPerfReportItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
if (MainFrame.this.lastRunProcessTrace == null) {
MainFrame.this.showError("No performance report to show.");
@@ -1129,6 +1405,11 @@ public class MainFrame extends JFrame {
return runMenu;
}
+ /**
+ * Creates the tools menu.
+ *
+ * @return the j menu
+ */
private JMenu createToolsMenu() {
JMenu toolsMenu = new JMenu("Tools");
toolsMenu.setMnemonic(KeyEvent.VK_T);
@@ -1169,6 +1450,7 @@ public class MainFrame extends JFrame {
JMenuItem logViewer = new JMenuItem("View Log File", KeyEvent.VK_L);
logViewer.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent event) {
LogFileViewer viewer = new LogFileViewer("Log file: "
+ MainFrame.this.logFile.getAbsolutePath());
@@ -1185,6 +1467,9 @@ public class MainFrame extends JFrame {
return toolsMenu;
}
+ /**
+ * Creates the status bar.
+ */
private void createStatusBar() {
this.statusPanel = new JPanel();
// statusPanel.setBorder(BorderFactory.createLineBorder(Color.gray));
@@ -1231,6 +1516,12 @@ public class MainFrame extends JFrame {
setAEStatusMessage();
}
+ /**
+ * Sets the caret status.
+ *
+ * @param dot the dot
+ * @param mark the mark
+ */
public void setCaretStatus(final int dot, final int mark) {
if (dot == mark) {
this.caretStatus.setText("Cursor: " + dot);
@@ -1251,6 +1542,9 @@ public class MainFrame extends JFrame {
this.copyAction.setEnabled(enable);
}
+ /**
+ * Sets the file status message.
+ */
public void setFileStatusMessage() {
Border textBorder;
if (this.textFile == null) {
@@ -1264,6 +1558,9 @@ public class MainFrame extends JFrame {
this.textScrollPane.revalidate();
}
+ /**
+ * Sets the AE status message.
+ */
private void setAEStatusMessage() {
if (this.ae == null || this.aeDescriptorFile == null) {
this.aeStatus.setText("(No AE Loaded)");
@@ -1276,6 +1573,11 @@ public class MainFrame extends JFrame {
this.statusPanel.revalidate();
}
+ /**
+ * Sets the statusbar message.
+ *
+ * @param message the new statusbar message
+ */
public void setStatusbarMessage(String message) {
// Date date = new Date();
Calendar calendar = Calendar.getInstance();
@@ -1305,6 +1607,9 @@ public class MainFrame extends JFrame {
this.statusPanel.revalidate();
}
+ /**
+ * Initialize logging.
+ */
private void initializeLogging() {
// set log file path
@@ -1339,6 +1644,9 @@ public class MainFrame extends JFrame {
this.log = UIMAFramework.getLogger();
}
+ /**
+ * Inits the.
+ */
private void init() {
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
@@ -1427,6 +1735,9 @@ public class MainFrame extends JFrame {
setStatusbarMessage("Ready.");
}
+ /**
+ * Inits the file lists.
+ */
private final void initFileLists() {
int numFiles = this.textFileNameList.size();
int max = numFiles < maxRecentSize ? numFiles : maxRecentSize;
@@ -1444,6 +1755,12 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Setup AE.
+ *
+ * @param aeFile the ae file
+ * @return true, if successful
+ */
protected boolean setupAE(File aeFile) {
try {
ResourceManager rsrcMgr = null;
@@ -1508,11 +1825,19 @@ public class MainFrame extends JFrame {
return true;
}
+ /**
+ * Inits the cas.
+ */
private final void initCas() {
this.cas.setDocumentLanguage(this.language);
this.cas.setDocumentText(this.textArea.getText());
}
+ /**
+ * Internal run AE.
+ *
+ * @param doCasReset the do cas reset
+ */
protected void internalRunAE(boolean doCasReset) {
try {
if (doCasReset) {
@@ -1557,6 +1882,9 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Inits the IR tree.
+ */
private void initIRTree() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(noIndexReposLabel);
DefaultTreeModel model = new DefaultTreeModel(root);
@@ -1574,6 +1902,9 @@ public class MainFrame extends JFrame {
this.indexTree.setCellRenderer(cellRenderer);
}
+ /**
+ * Inits the FS tree.
+ */
private void initFSTree() {
FSTreeModel treeModel = new FSTreeModel();
this.fsTree = new JTree(treeModel);
@@ -1591,10 +1922,18 @@ public class MainFrame extends JFrame {
this.fsTree.setCellRenderer(cellRenderer);
}
+ /**
+ * Delete FS tree.
+ */
private void deleteFSTree() {
((FSTreeModel) this.fsTree.getModel()).reset();
}
+ /**
+ * Update index tree.
+ *
+ * @param useCAS the use CAS
+ */
@SuppressWarnings("unchecked")
public void updateIndexTree(boolean useCAS) {
deleteFSTree();
@@ -1632,11 +1971,24 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Update FS tree.
+ *
+ * @param indexName the index name
+ * @param index1 the index 1
+ */
public void updateFSTree(String indexName, FSIndex index1) {
FSTreeModel treeModel = (FSTreeModel) this.fsTree.getModel();
treeModel.update(indexName, index1, this.cas);
}
+ /**
+ * Gets the annotations at pos.
+ *
+ * @param pos the pos
+ * @param annots the annots
+ * @return the annotations at pos
+ */
private ArrayList<FSNode> getAnnotationsAtPos(int pos, List<FSNode> annots) {
ArrayList<FSNode> res = new ArrayList<FSNode>();
FSNode annot;
@@ -1653,6 +2005,15 @@ public class MainFrame extends JFrame {
return res;
}
+ /**
+ * Creates the type tree.
+ *
+ * @param type the type
+ * @param ts the ts
+ * @param label the label
+ * @param ir the ir
+ * @return the default mutable tree node
+ */
private DefaultMutableTreeNode createTypeTree(org.apache.uima.cas.Type type, TypeSystem ts,
String label, FSIndexRepository ir) {
int size = ir.getIndex(label, type).size();
@@ -1672,6 +2033,11 @@ public class MainFrame extends JFrame {
return node;
}
+ /**
+ * Load program preferences.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private void loadProgramPreferences() throws IOException {
if (this.iniFile == null) {
File home = new File(System.getProperty("user.home"));
@@ -1735,11 +2101,23 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Sets the preferred size.
+ *
+ * @param comp the comp
+ * @param propPrefix the prop prefix
+ */
public void setPreferredSize(JComponent comp, String propPrefix) {
// assert(comp != null);
comp.setPreferredSize(getDimension(propPrefix));
}
+ /**
+ * Gets the dimension.
+ *
+ * @param propPrefix the prop prefix
+ * @return the dimension
+ */
public Dimension getDimension(String propPrefix) {
if (this.preferences == null) {
return null;
@@ -1763,6 +2141,12 @@ public class MainFrame extends JFrame {
return d;
}
+ /**
+ * String list to string.
+ *
+ * @param list the list
+ * @return the string
+ */
private static final String stringListToString(List<String> list) {
if (list.size() < 1) {
return "";
@@ -1776,6 +2160,12 @@ public class MainFrame extends JFrame {
return buf.toString();
}
+ /**
+ * String to array list.
+ *
+ * @param s the s
+ * @return the list
+ */
private static final List<String> stringToArrayList(String s) {
List<String> list = new ArrayList<String>();
if (s.length() > 0) {
@@ -1787,6 +2177,11 @@ public class MainFrame extends JFrame {
return list;
}
+ /**
+ * Save program preferences.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
public void saveProgramPreferences() throws IOException {
// File open dialog preferences.
if (this.preferences == null) {
@@ -1844,6 +2239,12 @@ public class MainFrame extends JFrame {
this.preferences.store(out, "Automatically generated preferences file for Annotation Viewer");
}
+ /**
+ * Save color preferences.
+ *
+ * @param file the file
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
public void saveColorPreferences(File file) throws IOException {
Properties prefs1 = new Properties();
Iterator<String> it = this.styleMap.keySet().iterator();
@@ -1861,6 +2262,12 @@ public class MainFrame extends JFrame {
prefs1.store(out, "Color preferences for annotation viewer.");
}
+ /**
+ * Load color preferences.
+ *
+ * @param file the file
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
public void loadColorPreferences(File file) throws IOException {
Style parent = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
StyleContext sc = StyleContext.getDefaultStyleContext();
@@ -1890,6 +2297,9 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Inits the key map.
+ */
private void initKeyMap() {
// Create a key map for focussing the index repository tree panel.
Action focusIRAction = new FocusIRAction(this);
@@ -1917,6 +2327,12 @@ public class MainFrame extends JFrame {
this.textArea.getActionMap().put(textContextActionName, textContextAction);
}
+ /**
+ * Show text popup.
+ *
+ * @param x the x
+ * @param y the y
+ */
@SuppressWarnings("unchecked")
public void showTextPopup(int x, int y) {
final int pos = this.textArea.getCaretPosition();
@@ -1938,115 +2354,251 @@ public class MainFrame extends JFrame {
this.textPopup.show(this.textArea, x, y);
}
+ /**
+ * Gets the index tree.
+ *
+ * @return the index tree
+ */
public JTree getIndexTree() {
return this.indexTree;
}
+ /**
+ * Gets the fs tree.
+ *
+ * @return the fs tree
+ */
public JTree getFsTree() {
return this.fsTree;
}
+ /**
+ * Gets the text area.
+ *
+ * @return the text area
+ */
public JTextArea getTextArea() {
return this.textArea;
}
+ /**
+ * Gets the cas.
+ *
+ * @return the cas
+ */
public CAS getCas() {
return this.cas;
}
+ /**
+ * Checks if is dirty.
+ *
+ * @return true, if is dirty
+ */
public boolean isDirty() {
return this.isDirty;
}
+ /**
+ * Sets the dirty.
+ *
+ * @param isDirty the new dirty
+ */
public void setDirty(boolean isDirty) {
this.isDirty = isDirty;
}
+ /**
+ * Gets the preferences.
+ *
+ * @return the preferences
+ */
public Properties getPreferences() {
return this.preferences;
}
+ /**
+ * Gets the index label.
+ *
+ * @return the index label
+ */
public String getIndexLabel() {
return this.indexLabel;
}
+ /**
+ * Gets the index.
+ *
+ * @return the index
+ */
public FSIndex getIndex() {
return this.index;
}
+ /**
+ * Gets the style map.
+ *
+ * @return the style map
+ */
public Map<String, Style> getStyleMap() {
return this.styleMap;
}
+ /**
+ * Gets the ae.
+ *
+ * @return the ae
+ */
public AnalysisEngine getAe() {
return this.ae;
}
+ /**
+ * Sets the index label.
+ *
+ * @param indexLabel the new index label
+ */
public void setIndexLabel(String indexLabel) {
this.indexLabel = indexLabel;
}
+ /**
+ * Checks if is annotation index.
+ *
+ * @return true, if is annotation index
+ */
public boolean isAnnotationIndex() {
return this.isAnnotationIndex;
}
+ /**
+ * Sets the annotation index.
+ *
+ * @param isAnnotationIndex the new annotation index
+ */
public void setAnnotationIndex(boolean isAnnotationIndex) {
this.isAnnotationIndex = isAnnotationIndex;
}
+ /**
+ * Sets the index.
+ *
+ * @param index the new index
+ */
public void setIndex(FSIndex index) {
this.index = index;
}
+ /**
+ * Sets the all annotation viewer item enable.
+ *
+ * @param enabled the new all annotation viewer item enable
+ */
public void setAllAnnotationViewerItemEnable(boolean enabled) {
this.allAnnotationViewerItem.setEnabled(enabled);
}
+ /**
+ * Gets the file open dir.
+ *
+ * @return the file open dir
+ */
public File getFileOpenDir() {
return this.fileOpenDir;
}
+ /**
+ * Sets the file open dir.
+ *
+ * @param fileOpenDir the new file open dir
+ */
public void setFileOpenDir(File fileOpenDir) {
this.fileOpenDir = fileOpenDir;
}
+ /**
+ * Gets the text file.
+ *
+ * @return the text file
+ */
public File getTextFile() {
return this.textFile;
}
+ /**
+ * Sets the text file.
+ *
+ * @param textFile the new text file
+ */
public void setTextFile(File textFile) {
this.textFile = textFile;
}
+ /**
+ * Sets the save text file enable.
+ *
+ * @param enabled the new save text file enable
+ */
public void setSaveTextFileEnable(boolean enabled) {
this.fileSaveItem.setEnabled(enabled);
}
+ /**
+ * Gets the undo mgr.
+ *
+ * @return the undo mgr
+ */
public UndoMgr getUndoMgr() {
return this.undoMgr;
}
+ /**
+ * Sets the undo enabled.
+ *
+ * @param enabled the new undo enabled
+ */
public void setUndoEnabled(boolean enabled) {
this.undoItem.setEnabled(enabled);
}
+ /**
+ * Gets the xcas file open dir.
+ *
+ * @return the xcas file open dir
+ */
public File getXcasFileOpenDir() {
return this.xcasFileOpenDir;
}
+ /**
+ * Sets the xcas file open dir.
+ *
+ * @param xcasFileOpenDir the new xcas file open dir
+ */
public void setXcasFileOpenDir(File xcasFileOpenDir) {
this.xcasFileOpenDir = xcasFileOpenDir;
}
+ /**
+ * Sets the cas.
+ *
+ * @param cas the new cas
+ */
public void setCas(CAS cas) {
this.cas = cas;
}
+ /**
+ * Sets the run on cas enabled.
+ */
public void setRunOnCasEnabled() {
// Enable the "Run on CAS" menu item when we have both an AE and a CAS.
this.runOnCasMenuItem.setEnabled(this.ae != null && this.cas != null);
}
+ /**
+ * Destroy ae.
+ */
public void destroyAe() {
this.cas = null;
if (this.ae != null) {
@@ -2055,80 +2607,173 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Sets the rerun enabled.
+ *
+ * @param enabled the new rerun enabled
+ */
public void setRerunEnabled(boolean enabled) {
this.reRunMenu.setEnabled(enabled);
this.runCPCMenu.setEnabled(enabled);
}
+ /**
+ * Sets the type system viewer enabled.
+ *
+ * @param enabled the new type system viewer enabled
+ */
public void setTypeSystemViewerEnabled(boolean enabled) {
this.tsViewerItem.setEnabled(enabled);
}
+ /**
+ * Gets the color settings dir.
+ *
+ * @return the color settings dir
+ */
public File getColorSettingsDir() {
return this.colorSettingsDir;
}
+ /**
+ * Sets the color settings dir.
+ *
+ * @param colorSettingsDir the new color settings dir
+ */
public void setColorSettingsDir(File colorSettingsDir) {
this.colorSettingsDir = colorSettingsDir;
}
+ /**
+ * Gets the color setting file.
+ *
+ * @return the color setting file
+ */
public File getColorSettingFile() {
return this.colorSettingFile;
}
+ /**
+ * Sets the color setting file.
+ *
+ * @param colorSettingFile the new color setting file
+ */
public void setColorSettingFile(File colorSettingFile) {
this.colorSettingFile = colorSettingFile;
}
+ /**
+ * Gets the annot open dir.
+ *
+ * @return the annot open dir
+ */
public File getAnnotOpenDir() {
return this.annotOpenDir;
}
+ /**
+ * Sets the annot open dir.
+ *
+ * @param annotOpenDir the new annot open dir
+ */
public void setAnnotOpenDir(File annotOpenDir) {
this.annotOpenDir = annotOpenDir;
}
+ /**
+ * Gets the data path name.
+ *
+ * @return the data path name
+ */
public String getDataPathName() {
return this.dataPathName;
}
+ /**
+ * Sets the data path name.
+ *
+ * @param dataPathName the new data path name
+ */
public void setDataPathName(String dataPathName) {
this.dataPathName = dataPathName;
}
+ /**
+ * Gets the code page.
+ *
+ * @return the code page
+ */
public String getCodePage() {
return this.codePage;
}
+ /**
+ * Sets the code page.
+ *
+ * @param codePage the new code page
+ */
public void setCodePage(String codePage) {
this.codePage = codePage;
}
+ /**
+ * Gets the code pages.
+ *
+ * @return the code pages
+ */
public List<String> getCodePages() {
return this.codePages;
}
+ /**
+ * Gets the language.
+ *
+ * @return the language
+ */
public String getLanguage() {
return this.language;
}
+ /**
+ * Sets the language.
+ *
+ * @param language the new language
+ */
public void setLanguage(String language) {
this.language = language;
}
+ /**
+ * Gets the languages.
+ *
+ * @return the languages
+ */
public List<String> getLanguages() {
return this.languages;
}
+ /**
+ * Gets the language prefs list.
+ *
+ * @return the language prefs list
+ */
public String getLanguagePrefsList() {
return this.languagePrefsList;
}
+ /**
+ * Sets the language prefs list.
+ *
+ * @param languagePrefsList the new language prefs list
+ */
public void setLanguagePrefsList(String languagePrefsList) {
this.languagePrefsList = languagePrefsList;
}
+ /**
+ * Handle sofas.
+ */
public void handleSofas() {
// Populate sofa combo box with the names of all text
// Sofas in the CAS
@@ -2180,6 +2825,11 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Checks if is exit on close.
+ *
+ * @return true, if is exit on close
+ */
public boolean isExitOnClose() {
return this.exitOnClose;
}
@@ -2188,8 +2838,8 @@ public class MainFrame extends JFrame {
* Set exit-on-close behavior. Normally, CVD will shut down the JVM it's running in when it's main
* window is being closed. Calling <code>setExitOnClose(false)</code> prevents that. It is then
* the caller's task to shut down the JVM.
- *
- * @param exitOnClose
+ *
+ * @param exitOnClose the new exit on close
*/
public void setExitOnClose(boolean exitOnClose) {
this.exitOnClose = exitOnClose;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MarkupExtent.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MarkupExtent.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MarkupExtent.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MarkupExtent.java Sun Nov 13 16:08:24 2016
@@ -19,6 +19,7 @@
package org.apache.uima.tools.cvd;
+// TODO: Auto-generated Javadoc
/**
* Represents an element in a list of markup extents. Knows about the length of the extent, as well
* as the depth of markup. Depth of markup means, how many annotations cover this extent?
@@ -27,13 +28,23 @@ package org.apache.uima.tools.cvd;
*/
public class MarkupExtent {
+ /** The start. */
private int start;
+ /** The end. */
private int end;
+ /** The markup depth. */
private int markupDepth;
+ /**
+ * Instantiates a new markup extent.
+ *
+ * @param start the start
+ * @param end the end
+ * @param markupDepth the markup depth
+ */
public MarkupExtent(int start, int end, int markupDepth) {
super();
this.start = start;
@@ -41,15 +52,27 @@ public class MarkupExtent {
this.markupDepth = markupDepth;
}
+ /**
+ * Gets the length.
+ *
+ * @return the length
+ */
public int getLength() {
return this.end - this.start;
}
+ /**
+ * Gets the markup depth.
+ *
+ * @return the markup depth
+ */
public int getMarkupDepth() {
return this.markupDepth;
}
/**
+ * Gets the end.
+ *
* @return int
*/
public int getEnd() {
@@ -57,6 +80,8 @@ public class MarkupExtent {
}
/**
+ * Gets the start.
+ *
* @return int
*/
public int getStart() {