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 [5/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/control/XCASSaveHandler.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASSaveHandler.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/control/XCASSaveHandler.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASSaveHandler.java Sun Nov 13 16:08:24 2016
@@ -35,17 +35,31 @@ import org.apache.uima.tools.cvd.MainFra
import org.apache.uima.util.XMLSerializer;
import org.xml.sax.SAXException;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class XCASSaveHandler.
+ */
public class XCASSaveHandler implements ActionListener {
+ /** The main. */
private final MainFrame main;
+ /**
+ * Instantiates a new XCAS save handler.
+ *
+ * @param frame the frame
+ */
public XCASSaveHandler(MainFrame frame) {
this.main = frame;
}
/**
+ * Action performed.
+ *
+ * @param event the event
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Save XCAS file");
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASSaveTSHandler.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASSaveTSHandler.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/control/XCASSaveTSHandler.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASSaveTSHandler.java Sun Nov 13 16:08:24 2016
@@ -34,17 +34,31 @@ import org.apache.uima.cas.impl.TypeSyst
import org.apache.uima.tools.cvd.MainFrame;
import org.xml.sax.SAXException;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class XCASSaveTSHandler.
+ */
public class XCASSaveTSHandler implements ActionListener {
+ /** The main. */
private final MainFrame main;
+ /**
+ * Instantiates a new XCAS save TS handler.
+ *
+ * @param frame the frame
+ */
public XCASSaveTSHandler(MainFrame frame) {
this.main = frame;
}
/**
+ * Action performed.
+ *
+ * @param event the event
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Save type system file");
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasFileOpenHandler.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasFileOpenHandler.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/control/XmiCasFileOpenHandler.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasFileOpenHandler.java Sun Nov 13 16:08:24 2016
@@ -27,13 +27,18 @@ import javax.swing.JFileChooser;
import org.apache.uima.tools.cvd.MainFrame;
+// TODO: Auto-generated Javadoc
/**
* Load a CAS from an XMI file.
*/
public class XmiCasFileOpenHandler implements ActionListener {
+ /** The main. */
final MainFrame main;
+ /**
+ * Instantiates a new xmi cas file open handler.
+ */
// Default constructor, not used.
@SuppressWarnings("unused")
private XmiCasFileOpenHandler() {
@@ -41,6 +46,11 @@ public class XmiCasFileOpenHandler imple
this.main = null;
}
+ /**
+ * Instantiates a new xmi cas file open handler.
+ *
+ * @param main the main
+ */
public XmiCasFileOpenHandler(MainFrame main) {
super();
this.main = main;
@@ -49,6 +59,7 @@ public class XmiCasFileOpenHandler imple
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Open XMI CAS file");
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasSaveHandler.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasSaveHandler.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/control/XmiCasSaveHandler.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XmiCasSaveHandler.java Sun Nov 13 16:08:24 2016
@@ -28,20 +28,23 @@ import java.io.IOException;
import java.io.OutputStream;
import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-
import org.apache.uima.cas.impl.XmiCasSerializer;
import org.apache.uima.tools.cvd.MainFrame;
import org.apache.uima.util.XMLSerializer;
import org.xml.sax.SAXException;
+// TODO: Auto-generated Javadoc
/**
* Save CAS to disk as XMI.
*/
public class XmiCasSaveHandler implements ActionListener {
+ /** The main. */
private final MainFrame main;
+ /**
+ * Instantiates a new xmi cas save handler.
+ */
// Default constructor
@SuppressWarnings("unused")
private XmiCasSaveHandler() {
@@ -49,6 +52,11 @@ public class XmiCasSaveHandler implement
this.main = null;
}
+ /**
+ * Instantiates a new xmi cas save handler.
+ *
+ * @param main the main
+ */
public XmiCasSaveHandler(MainFrame main) {
super();
this.main = main;
@@ -57,6 +65,7 @@ public class XmiCasSaveHandler implement
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Save XMI CAS file");
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/FeatureTableModel.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/FeatureTableModel.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/tsview/FeatureTableModel.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/FeatureTableModel.java Sun Nov 13 16:08:24 2016
@@ -26,6 +26,7 @@ import javax.swing.table.AbstractTableMo
import org.apache.uima.cas.Feature;
import org.apache.uima.cas.Type;
+// TODO: Auto-generated Javadoc
/**
* Insert comment for enclosing_type here.
*
@@ -33,29 +34,46 @@ import org.apache.uima.cas.Type;
*/
public class FeatureTableModel extends AbstractTableModel {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -6010925680514336742L;
+ /** The Constant columnHeaders. */
static final String[] columnHeaders = { "Feature", "Value Type", "Defined On" };
+ /** The type. */
private Type type = null;
+ /**
+ * Instantiates a new feature table model.
+ */
public FeatureTableModel() {
super();
}
/**
* Constructor for FeatureTableModel.
+ *
+ * @param type the type
*/
public FeatureTableModel(Type type) {
super();
this.type = type;
}
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
public void setType(Type type) {
this.type = type;
fireTableDataChanged();
}
+ /* (non-Javadoc)
+ * @see javax.swing.table.AbstractTableModel#getColumnName(int)
+ */
+ @Override
public String getColumnName(int i) {
if (i < 0 || i >= columnHeaders.length) {
return "";
@@ -64,8 +82,12 @@ public class FeatureTableModel extends A
}
/**
+ * Gets the row count.
+ *
+ * @return the row count
* @see javax.swing.table.TableModel#getRowCount()
*/
+ @Override
public int getRowCount() {
if (this.type == null) {
return 0;
@@ -74,15 +96,25 @@ public class FeatureTableModel extends A
}
/**
+ * Gets the column count.
+ *
+ * @return the column count
* @see javax.swing.table.TableModel#getColumnCount()
*/
+ @Override
public int getColumnCount() {
return 3;
}
/**
+ * Gets the value at.
+ *
+ * @param rowIndex the row index
+ * @param columnIndex the column index
+ * @return the value at
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
+ @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (this.type == null) {
return null;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/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/tsview/MainFrame.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java Sun Nov 13 16:08:24 2016
@@ -48,6 +48,7 @@ import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.admin.CASFactory;
import org.apache.uima.cas.admin.CASMgr;
+// TODO: Auto-generated Javadoc
/**
* Insert comment for enclosing_type here.
*
@@ -55,12 +56,29 @@ import org.apache.uima.cas.admin.CASMgr;
*/
public class MainFrame extends JFrame {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 5606886216212480040L;
+ /**
+ * 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) {
// System.out.println("");
DefaultMutableTreeNode node = (DefaultMutableTreeNode) MainFrame.this.typeTree
@@ -77,13 +95,17 @@ public class MainFrame extends JFrame {
}
}
+ /** The ts. */
TypeSystem ts = null;
+ /** The selected type. */
// UIMA-2565 - Clash btw. cas.Type and Window.Type on JDK 7
private org.apache.uima.cas.Type selectedType;
+ /** The feature table. */
private JTable featureTable = null;
+ /** The type tree. */
private JTree typeTree = null;
/**
@@ -98,8 +120,8 @@ public class MainFrame extends JFrame {
/**
* Constructor for MainFrame.
- *
- * @param gc
+ *
+ * @param gc the gc
*/
public MainFrame(GraphicsConfiguration gc) {
super(gc);
@@ -108,8 +130,8 @@ public class MainFrame extends JFrame {
/**
* Constructor for MainFrame.
- *
- * @param title
+ *
+ * @param title the title
* @throws HeadlessException -
*/
public MainFrame(String title) {
@@ -119,15 +141,18 @@ public class MainFrame extends JFrame {
/**
* Constructor for MainFrame.
- *
- * @param title
- * @param gc
+ *
+ * @param title the title
+ * @param gc the gc
*/
public MainFrame(String title, GraphicsConfiguration gc) {
super(title, gc);
init();
}
+ /**
+ * Inits the.
+ */
private void init() {
// Set the title.
this.setTitle("Type System Editor");
@@ -160,12 +185,20 @@ public class MainFrame extends JFrame {
this.setJMenuBar(createMenuBar());
}
+ /**
+ * Show annot feats.
+ */
public void showAnnotFeats() {
// Debug...
this.selectedType = this.ts.getType(CAS.TYPE_NAME_ANNOTATION);
updateFeatureTable();
}
+ /**
+ * Creates the menu bar.
+ *
+ * @return the j menu bar
+ */
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu optionsMenu = new JMenu("Options");
@@ -175,6 +208,9 @@ public class MainFrame extends JFrame {
return menuBar;
}
+ /**
+ * Update feature table.
+ */
private void updateFeatureTable() {
if (this.selectedType == null) {
return;
@@ -182,6 +218,12 @@ public class MainFrame extends JFrame {
((FeatureTableModel) this.featureTable.getModel()).setType(this.selectedType);
}
+ /**
+ * Creates the type tree.
+ *
+ * @param type the type
+ * @return the default mutable tree node
+ */
private DefaultMutableTreeNode createTypeTree(org.apache.uima.cas.Type type) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(type);
// UIMA-2565 - Clash btw. cas.Type and Window.Type on JDK 7
@@ -195,6 +237,9 @@ public class MainFrame extends JFrame {
return node;
}
+ /**
+ * Update type tree.
+ */
private void updateTypeTree() {
if (this.ts == null) {
return;
@@ -222,6 +267,12 @@ public class MainFrame extends JFrame {
}
}
+ /**
+ * Gets the tree model listeners.
+ *
+ * @param model the model
+ * @return the tree model listeners
+ */
public static TreeModelListener[] getTreeModelListeners(DefaultTreeModel model) {
EventListener[] eventListeners = model.getListeners(TreeModelListener.class);
TreeModelListener[] modelListeners = new TreeModelListener[eventListeners.length];
@@ -231,11 +282,21 @@ public class MainFrame extends JFrame {
return modelListeners;
}
+ /**
+ * Sets the type system.
+ *
+ * @param ts the new type system
+ */
public void setTypeSystem(TypeSystem ts) {
this.ts = ts;
updateTypeTree();
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(String[] args) {
try {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java Sun Nov 13 16:08:24 2016
@@ -59,6 +59,7 @@ import javax.swing.ListCellRenderer;
import javax.swing.SpringLayout;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.WindowConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
@@ -92,6 +93,7 @@ import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.SAXException;
+// TODO: Auto-generated Javadoc
/**
* Dialog that loads analyzed documents stored in XMI or XCAS format and allows them to be viewed
* using the Java-based CAS viewer or a web browser, in either an HTML/Javascript format or in the
@@ -100,63 +102,73 @@ import org.xml.sax.SAXException;
*/
public class AnnotationViewerDialog extends JDialog implements ActionListener {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -7259891069111863433L;
+ /** The temp dir. */
private File tempDir = createTempDir();
+ /** The annotation view generator. */
protected AnnotationViewGenerator annotationViewGenerator; // JMP
+ /** The style map editor. */
private StyleMapEditor styleMapEditor;
+ /** The med 1. */
private PrefsMediator med1;
+ /** The style map file. */
private File styleMapFile;
+ /** The analyzed results list. */
JList analyzedResultsList;
+ /** The input dir path. */
String inputDirPath = null;
+ /** The type system. */
TypeSystem typeSystem = null;
+ /** The types to display. */
String[] typesToDisplay = null;
+ /** The java viewer RB. */
JRadioButton javaViewerRB = null;
+ /** The java viewer UCRB. */
JRadioButton javaViewerUCRB = null;
+ /** The html RB. */
JRadioButton htmlRB = null;
+ /** The xml RB. */
JRadioButton xmlRB = null;
+ /** The cas. */
private CAS cas;
+ /** The processed style map. */
private boolean processedStyleMap = false;
+ /** The default cas view name. */
private String defaultCasViewName = CAS.NAME_DEFAULT_SOFA;
/**
- * Create an AnnotationViewer Dialog
- *
- * @param aParentFrame
- * frame containing this panel
- * @param aDialogTitle
- * title to display for the dialog
- * @param med
- *
- * @param aStyleMapFile
- * filename of style map to be used to view files in HTML
- * @param aPerformanceStats
- * string representaiton of performance statistics, optional.
- * @param aTypeSystem
- * the CAS Type System to which the XCAS files must conform.
- * @param aTypesToDisplay
- * array of types that should be highlighted in the viewer. This can be set to the output
+ * Create an AnnotationViewer Dialog.
+ *
+ * @param aParentFrame frame containing this panel
+ * @param aDialogTitle title to display for the dialog
+ * @param med the med
+ * @param aStyleMapFile filename of style map to be used to view files in HTML
+ * @param aPerformanceStats string representaiton of performance statistics, optional.
+ * @param aTypeSystem the CAS Type System to which the XCAS files must conform.
+ * @param aTypesToDisplay array of types that should be highlighted in the viewer. This can be set to the output
* types of the Analysis Engine. A value of null means to display all types.
- * @param interactiveTempFN
- * @param javaViewerRBisSelected
- * @param javaViewerUCRBisSelected
- * @param xmlRBisSelected
- * @param cas
+ * @param interactiveTempFN the interactive temp FN
+ * @param javaViewerRBisSelected the java viewer R bis selected
+ * @param javaViewerUCRBisSelected the java viewer UCR bis selected
+ * @param xmlRBisSelected the xml R bis selected
+ * @param cas the cas
*/
public AnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, PrefsMediator med,
File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem,
@@ -173,6 +185,19 @@ public class AnnotationViewerDialog exte
tempDir);
}
+ /**
+ * Instantiates a new annotation viewer dialog.
+ *
+ * @param aParentFrame the a parent frame
+ * @param aDialogTitle the a dialog title
+ * @param med the med
+ * @param aStyleMapFile the a style map file
+ * @param aPerformanceStats the a performance stats
+ * @param aTypeSystem the a type system
+ * @param aTypesToDisplay the a types to display
+ * @param generatedStyleMap the generated style map
+ * @param cas the cas
+ */
public AnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, PrefsMediator med,
File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem,
final String[] aTypesToDisplay, boolean generatedStyleMap, CAS cas) {
@@ -280,6 +305,7 @@ public class AnnotationViewerDialog exte
if (performanceStats != null) {
JButton perfStatsButton = new JButton("Performance Stats");
perfStatsButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ae) {
JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null,
JOptionPane.PLAIN_MESSAGE);
@@ -300,13 +326,14 @@ public class AnnotationViewerDialog exte
// event for the closeButton button
closeButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ae) {
AnnotationViewerDialog.this.setVisible(false);
}
});
// event for analyzedResultsDialog window closing
- this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setLF(); // set default look and feel
analyzedResultsList.setCellRenderer(new MyListCellRenderer());
@@ -322,7 +349,11 @@ public class AnnotationViewerDialog exte
}
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
// unwound from small anonymous inner class
+ @Override
public void actionPerformed(ActionEvent arg0) {
// read style map XML file if it exists
String styleMapXml = null;
@@ -359,9 +390,14 @@ public class AnnotationViewerDialog exte
}
/**
- * Filter to not show the two interactive-mode directories in the file list
+ * Filter to not show the two interactive-mode directories in the file list.
*/
static class InteractiveFilter implements FilenameFilter {
+
+ /* (non-Javadoc)
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ @Override
public boolean accept(File dir, String name) {
if (name.equals("interactive_temp"))
return false;
@@ -374,6 +410,8 @@ public class AnnotationViewerDialog exte
/**
* Gets the name of the CAS View that will be displayed first in
* the annotation viewer.
+ *
+ * @return the default cas view name
*/
public String getDefaultCasViewName() {
return defaultCasViewName;
@@ -382,6 +420,8 @@ public class AnnotationViewerDialog exte
/**
* Sets the name of the CAS View that will be displayed first in
* the annotation viewer. It not set, defaults to {@link CAS#NAME_DEFAULT_SOFA}.
+ *
+ * @param defaultCasViewName the new default cas view name
*/
public void setDefaultCasViewName(String defaultCasViewName) {
this.defaultCasViewName = defaultCasViewName;
@@ -391,6 +431,19 @@ public class AnnotationViewerDialog exte
// Interactive modes
// JMP
+ /**
+ * Launch that viewer.
+ *
+ * @param inputDirPath the input dir path
+ * @param fileName the file name
+ * @param typeSystem the type system
+ * @param aTypesToDisplay the a types to display
+ * @param javaViewerRBisSelected the java viewer R bis selected
+ * @param javaViewerUCRBisSelected the java viewer UCR bis selected
+ * @param xmlRBisSelected the xml R bis selected
+ * @param styleMapFile the style map file
+ * @param viewerDirectory the viewer directory
+ */
public void launchThatViewer(String inputDirPath, String fileName, TypeSystem typeSystem,
final String[] aTypesToDisplay, boolean javaViewerRBisSelected,
boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, File styleMapFile,
@@ -486,6 +539,9 @@ public class AnnotationViewerDialog exte
/**
* Assumes node has a text field and extracts its value. JMP
+ *
+ * @param node the node
+ * @return the text value
*/
static public String getTextValue(Node node) {
Node first = node.getFirstChild();
@@ -498,6 +554,10 @@ public class AnnotationViewerDialog exte
/**
* Gets the first child with a given name. JMP
+ *
+ * @param node the node
+ * @param name the name
+ * @return the first child by name
*/
static public Node getFirstChildByName(Node node, String name) {
NodeList children = node.getChildNodes();
@@ -512,6 +572,9 @@ public class AnnotationViewerDialog exte
/**
* Reads in annotation-color associations from stylemap file. JMP Also reads checked value if
* present.
+ *
+ * @param viewer the viewer
+ * @param aStyleMapFile the a style map file
*/
public void getColorsForTypesFromFile(CasAnnotationViewer viewer, File aStyleMapFile) {
@@ -664,8 +727,11 @@ public class AnnotationViewerDialog exte
/**
* If the current AE filename is not know ask for it. Then parse the selected file and return the
* AnalysisEngineDescription object.
- *
+ *
* @return the selected AnalysisEngineDescription, null if the user cancelled
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InvalidXMLException the invalid XML exception
+ * @throws ResourceInitializationException the resource initialization exception
*/
protected AnalysisEngineDescription promptForAE() throws IOException, InvalidXMLException,
ResourceInitializationException {
@@ -690,7 +756,9 @@ public class AnnotationViewerDialog exte
}
}
- /** set default look and feel */
+ /**
+ * set default look and feel.
+ */
private static void setLF() {
// Force SwingApp to come up in the System L&F
String laf = UIManager.getSystemLookAndFeelClassName();
@@ -703,6 +771,11 @@ public class AnnotationViewerDialog exte
}
}
+ /**
+ * Creates the temp dir.
+ *
+ * @return the file
+ */
private File createTempDir() {
File temp = new File(System.getProperty("java.io.tmpdir"), System.getProperty("user.name"));
temp.mkdir();
@@ -710,14 +783,26 @@ public class AnnotationViewerDialog exte
}
// create and call the list cell renderer to set the selected color and
+ /**
+ * The Class MyListCellRenderer.
+ */
// image icon
static class MyListCellRenderer extends JLabel implements ListCellRenderer {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 7231915634689270693L;
+ /**
+ * Instantiates a new my list cell renderer.
+ */
public MyListCellRenderer() {
setOpaque(true);
}
+ /* (non-Javadoc)
+ * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
+ */
+ @Override
public Component getListCellRendererComponent(JList analyzedResultsList, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
ImageIcon xmlIcon = Images.getImageIcon(Images.XML_DOC);
@@ -729,8 +814,15 @@ public class AnnotationViewerDialog exte
}
}
+ /**
+ * The Class ListMouseAdapter.
+ */
class ListMouseAdapter extends MouseAdapter {
+ /* (non-Javadoc)
+ * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
+ */
+ @Override
public void mouseClicked(MouseEvent e) {
try {
if (e.getClickCount() == 2) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java Sun Nov 13 16:08:24 2016
@@ -99,6 +99,7 @@ import org.apache.uima.util.FileUtils;
import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.XMLInputSource;
+// TODO: Auto-generated Javadoc
/**
* A simple GUI for the RunTextAnalysis application library. Note that currently this will only run
* under Windows since it relies on Windows-specific commands for invoking a web browser to view the
@@ -108,8 +109,11 @@ import org.apache.uima.util.XMLInputSour
*
*/
public class DocumentAnalyzer extends JFrame implements StatusCallbackListener, ActionListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 8795969283257780425L;
+ /** The Constant HELP_MESSAGE. */
private static final String HELP_MESSAGE = "Instructions for using UIMA Document Analyzer:\n\n"
+ "* In the \"Input Directory\" field, either type or use the browse\n"
+ "button to select a directory containing the documents that you want\n"
@@ -134,84 +138,122 @@ public class DocumentAnalyzer extends JF
+ "be displayed. Select the view format (Java Viewer is recommended),\n"
+ "and double-click on a document to view it.\n\n";
+ /** The input file selector. */
private FileSelector inputFileSelector;
+ /** The input file format combo box. */
private JComboBox inputFileFormatComboBox;
+ /** The lenient checkbox. */
private JCheckBox lenientCheckbox;
+ /** The output file selector. */
protected FileSelector outputFileSelector; // JMP
+ /** The xml file selector. */
protected FileSelector xmlFileSelector; // JMP
+ /** The output file selected. */
protected String outputFileSelected = null; // JMP
+ /** The run parameters field. */
private JTextField runParametersField;
+ /** The language combo box. */
private JComboBox languageComboBox;
+ /** The encoding combo box. */
private JComboBox encodingComboBox;
+ /** The progress monitor. */
private ProgressMonitor progressMonitor;
+ /** The current type system. */
protected TypeSystem currentTypeSystem; // JMP
+ /** The current tae output types. */
protected String[] currentTaeOutputTypes; // JMP
+ /** The user style map file. */
private File userStyleMapFile;
+ /** The use generated style map. */
protected boolean useGeneratedStyleMap = false; // JMP
+ /** The collection reader. */
private FileSystemCollectionReader collectionReader;
+ /** The m CPM. */
private CollectionProcessingManager mCPM;
+ /** The interactive temp FN. */
protected String interactiveTempFN = "__DAtemp__.txt"; // JMP
+ /** The about dialog. */
private JDialog aboutDialog;
+ /** The num docs. */
private int numDocs;
+ /** The num docs processed. */
private int numDocsProcessed = 0;
/** Directory in which this program will write its output files. */
private File outputDirectory;
+ /** The run button. */
private JButton runButton;
+ /** The inter button. */
private JButton interButton;
+ /** The interactive. */
protected boolean interactive = false; // JMP
+ /** The java viewer RB. */
private final JRadioButton javaViewerRB = new JRadioButton("Java Viewer");
+ /** The java viewer UCRB. */
private final JRadioButton javaViewerUCRB = new JRadioButton(
"<html><font color=maroon>JV user colors</font></html>");
+ /** The html RB. */
private final JRadioButton htmlRB = new JRadioButton("HTML");
+ /** The xml RB. */
protected final JRadioButton xmlRB = new JRadioButton("XML"); // JMP
+ /** The analyze input dialog. */
private JDialog analyzeInputDialog = null;
+ /** The java viewer R bis selected. */
protected boolean javaViewerRBisSelected = false; // JMP
+ /** The java viewer UCR bis selected. */
protected boolean javaViewerUCRBisSelected = false; // JMP
+ /** The prefs med. */
protected PrefsMediator prefsMed; // JMP
+ /** The stats string. */
protected String statsString; // JMP
+ /** The tae desc file. */
protected File taeDescFile; // JMP
+ /** The tae desc file name. */
protected String taeDescFileName; // JMP
+ /** The ae specifier file. */
private File aeSpecifierFile;
+ /** The cas. */
protected CAS cas; // JMP
+ /** The progress timer. */
private Timer progressTimer;
+ /** The using xml detagger. */
private boolean usingXmlDetagger;
/**
@@ -221,6 +263,13 @@ public class DocumentAnalyzer extends JF
this(null, false, false);
}
+ /**
+ * Instantiates a new document analyzer.
+ *
+ * @param outputFileSelected the output file selected
+ * @param interactiveDA the interactive DA
+ * @param jvucrbis the jvucrbis
+ */
public DocumentAnalyzer(String outputFileSelected, boolean interactiveDA, boolean jvucrbis) {
super("Document Analyzer");
prefsMed = new PrefsMediator();
@@ -343,6 +392,7 @@ public class DocumentAnalyzer extends JF
inputFileFormatComboBox.setEditable(false);
inputFileFormatComboBox.setSelectedItem(prefsMed.getInputFileFormat());
inputFileFormatComboBox.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
String inputFileFormat = (String) inputFileFormatComboBox.getSelectedItem();
lenientCheckbox.setEnabled(
@@ -424,6 +474,7 @@ public class DocumentAnalyzer extends JF
// Event Handlling of "Exit" Menu Item
exitMenuItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent evt) {
savePreferences();
System.exit(0);
@@ -432,6 +483,7 @@ public class DocumentAnalyzer extends JF
// Event Handlling of "About" Menu Item
aboutMenuItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent evt) {
aboutDialog.setVisible(true);
}
@@ -439,6 +491,7 @@ public class DocumentAnalyzer extends JF
// Event Handlling of "Help" Menu Item
helpMenuItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent evt) {
JOptionPane.showMessageDialog(DocumentAnalyzer.this, HELP_MESSAGE,
"Document Analyzer Help", JOptionPane.PLAIN_MESSAGE);
@@ -481,6 +534,7 @@ public class DocumentAnalyzer extends JF
// Event Handling of run Button
runButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ee) {
interactive = false;
savePreferences();
@@ -490,6 +544,7 @@ public class DocumentAnalyzer extends JF
// Event Handling of interactive Button
interButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ee) {
if (outputFileSelector.getSelected().length() == 0)
displayError("Need to specify an output directory for temporary results.");
@@ -511,6 +566,7 @@ public class DocumentAnalyzer extends JF
restorePreferences();
progressTimer = new Timer(100, new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ee) {
checkProgressMonitor();
}
@@ -538,7 +594,11 @@ public class DocumentAnalyzer extends JF
}
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
// View button clicked
+ @Override
public void actionPerformed(ActionEvent e) {
savePreferences();
try {
@@ -556,6 +616,8 @@ public class DocumentAnalyzer extends JF
* documents and generates the output. Displays a progress bar while processing is occuring. When
* processing is complete, allows the user to view the results. JMP added arg for input text to
* analyze.
+ *
+ * @param analysisText the analysis text
*/
public void analyzeDocuments(String analysisText) {
// get field values from GUI
@@ -681,6 +743,9 @@ public class DocumentAnalyzer extends JF
}
}
+ /**
+ * Check progress monitor.
+ */
private void checkProgressMonitor() {
// if user has clicked cancel, abort
if (progressMonitor.isCanceled()) {
@@ -691,13 +756,18 @@ public class DocumentAnalyzer extends JF
}
/**
+ * Entity process complete.
+ *
+ * @param aCas the a cas
+ * @param aStatus the a status
* @see org.apache.uima.collection.StatusCallbackListener#entityProcessComplete(org.apache.uima.cas.CAS,
* org.apache.uima.collection.EntityProcessStatus)
*/
+ @Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
// if an error occurred, display error
if (aStatus.isException()) {
- displayError((Throwable) aStatus.getExceptions().get(0));
+ displayError(aStatus.getExceptions().get(0));
// CPM will stop itself on error, we don't need to call
// mCPM.stop(). In fact it causes a hang to do so, since
// this code is callback code is executing within a CPM thread.
@@ -710,8 +780,11 @@ public class DocumentAnalyzer extends JF
}
/**
+ * Aborted.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#aborted()
*/
+ @Override
public void aborted() {
// close progress monitor
if (progressMonitor != null) {
@@ -725,14 +798,20 @@ public class DocumentAnalyzer extends JF
}
/**
+ * Batch process complete.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#batchProcessComplete()
*/
+ @Override
public void batchProcessComplete() {
}
/**
+ * Collection process complete.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#collectionProcessComplete()
*/
+ @Override
public void collectionProcessComplete() {
// invoke ProcessingCompleteRunnable in Swing event handler thread
// SwingUtilities.invokeLater(new ProcessingCompleteRunnable());
@@ -755,20 +834,29 @@ public class DocumentAnalyzer extends JF
}
/**
+ * Initialization complete.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#initializationComplete()
*/
+ @Override
public void initializationComplete() {
}
/**
+ * Paused.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#paused()
*/
+ @Override
public void paused() {
}
/**
+ * Resumed.
+ *
* @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#resumed()
*/
+ @Override
public void resumed() {
}
@@ -787,6 +875,11 @@ public class DocumentAnalyzer extends JF
show_analysis(aOutputDir);
}
+ /**
+ * Show analysis results.
+ *
+ * @param aOutputDir the a output dir
+ */
// this call is used when you click the "View" button
public void showAnalysisResults(File aOutputDir) {
@@ -820,7 +913,9 @@ public class DocumentAnalyzer extends JF
/**
* Creates a CAS from an descriptor. Supports both local AE descriptors and remote service
* specifiers. In the latter case the service is contacted to obtain its type system.
- *
+ *
+ * @param aDescriptorFile the a descriptor file
+ * @return the cas
* @throws ResourceInitializationException -
* @throws InvalidXMLException -
* @throws IOException -
@@ -837,6 +932,12 @@ public class DocumentAnalyzer extends JF
}
}
+ /**
+ * Read stylemap file.
+ *
+ * @param smapFile the smap file
+ * @return the string
+ */
protected String readStylemapFile(File smapFile) // JMP
{
String styleMapXml = "";
@@ -853,6 +954,11 @@ public class DocumentAnalyzer extends JF
return styleMapXml;
}
+ /**
+ * Show analysis.
+ *
+ * @param outputDir the output dir
+ */
private void show_analysis(File outputDir) {
File styleMapFile = getStyleMapFile();
// added the following to prevent NPE when "View" button is used
@@ -970,6 +1076,8 @@ public class DocumentAnalyzer extends JF
/**
* Runs the application.
+ *
+ * @param args the arguments
*/
public static void main(String[] args) {
final DocumentAnalyzer frame = new DocumentAnalyzer();
@@ -981,15 +1089,21 @@ public class DocumentAnalyzer extends JF
}
/**
- * Class for dialog in which user types in text to be analyzed, and sets browser parameters
+ * Class for dialog in which user types in text to be analyzed, and sets browser parameters.
*/
class TextAreaViewer extends JPanel {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -7503162930412929062L;
+ /** The text pane. */
private JTextPane textPane = new JTextPane();
/**
- * Constructor for dialog
+ * Constructor for dialog.
+ *
+ * @param aiDialog the ai dialog
+ * @param generatedStyleMap the generated style map
*/
public TextAreaViewer(final JDialog aiDialog, boolean generatedStyleMap) {
@@ -1079,6 +1193,7 @@ public class DocumentAnalyzer extends JF
mainPanel.add(southernPanel);
// Event Handling of analyze Button
analyzeButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ee) {
analyzeTextArea();
}
@@ -1087,6 +1202,7 @@ public class DocumentAnalyzer extends JF
// event for the closeButton button
closeButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent evt) {
setVisible(false);
aiDialog.dispose();
@@ -1098,6 +1214,9 @@ public class DocumentAnalyzer extends JF
}
+ /**
+ * Analyze text area.
+ */
public void analyzeTextArea() {
String text = textPane.getText();
analyzeDocuments(text);
@@ -1105,6 +1224,18 @@ public class DocumentAnalyzer extends JF
}
+ /**
+ * Run processing thread.
+ *
+ * @param inputDir the input dir
+ * @param inputFileFormat the input file format
+ * @param lenient the lenient
+ * @param outputDir the output dir
+ * @param aeSpecifierFile the ae specifier file
+ * @param xmlTag the xml tag
+ * @param language the language
+ * @param encoding the encoding
+ */
public void runProcessingThread(File inputDir, String inputFileFormat, Boolean lenient, File outputDir, File aeSpecifierFile,
String xmlTag, String language, String encoding) {
try {
@@ -1296,23 +1427,47 @@ public class DocumentAnalyzer extends JF
}
}
+ /**
+ * The Class ProcessingThread.
+ */
class ProcessingThread extends Thread {
+
+ /** The input dir. */
File inputDir;
+ /** The input file format. */
String inputFileFormat;
+ /** The output dir. */
File outputDir;
+ /** The tae specifier file. */
File taeSpecifierFile;
+ /** The xml tag. */
String xmlTag;
+ /** The language. */
String language;
+ /** The encoding. */
String encoding;
+ /** The lenient. */
Boolean lenient;
+ /**
+ * Instantiates a new processing thread.
+ *
+ * @param inputDir the input dir
+ * @param inputFileFormat the input file format
+ * @param lenient the lenient
+ * @param outputDir the output dir
+ * @param taeSpecifierFile the tae specifier file
+ * @param xmlTag the xml tag
+ * @param language the language
+ * @param encoding the encoding
+ */
ProcessingThread(File inputDir, String inputFileFormat, Boolean lenient, File outputDir, File taeSpecifierFile, String xmlTag,
String language, String encoding) {
this.inputDir = inputDir;
@@ -1325,6 +1480,9 @@ public class DocumentAnalyzer extends JF
this.lenient = lenient;
}
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
@Override
public void run() {
// Code moved outside class to make accessible by programs that call
@@ -1334,6 +1492,8 @@ public class DocumentAnalyzer extends JF
}
/**
+ * Gets the style map file.
+ *
* @return Returns the styleMapFile.
*/
public File getStyleMapFile() {
@@ -1344,8 +1504,9 @@ public class DocumentAnalyzer extends JF
}
/**
- * @param styleMapFile
- * The styleMapFile to set.
+ * Sets the style map file.
+ *
+ * @param styleMapFile The styleMapFile to set.
*/
public void setStyleMapFile(File styleMapFile) {
this.userStyleMapFile = styleMapFile;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelector.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelector.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelector.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelector.java Sun Nov 13 16:08:24 2016
@@ -39,6 +39,7 @@ import javax.swing.SwingUtilities;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
+// TODO: Auto-generated Javadoc
/**
*
*
@@ -47,20 +48,35 @@ import javax.swing.filechooser.FileFilte
*/
public class FileSelector extends JPanel implements FocusListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -8710960143421949274L;
+ /** The field. */
private JTextField field;
+ /** The browse button. */
private BrowseButton browseButton;
+ /** The file chooser. */
private JFileChooser fileChooser;
+ /** The file selector listener. */
private FileSelectorListener fileSelectorListener;
+ /** The previous value. */
private String previousValue;
+ /** The external fl. */
private FocusListener externalFl;
+ /**
+ * Instantiates a new file selector.
+ *
+ * @param initialValue the initial value
+ * @param fileChooserTitle the file chooser title
+ * @param selectionMode the selection mode
+ */
public FileSelector(String initialValue, String fileChooserTitle, int selectionMode) // Can be
// either
// JFileChooser.FILES_ONLY,
@@ -70,6 +86,14 @@ public class FileSelector extends JPanel
this(initialValue, fileChooserTitle, selectionMode, null);
}
+ /**
+ * Instantiates a new file selector.
+ *
+ * @param initialValue the initial value
+ * @param fileChooserTitle the file chooser title
+ * @param selectionMode the selection mode
+ * @param currentDir the current dir
+ */
public FileSelector(String initialValue, String fileChooserTitle, int selectionMode, // Can be
// either
// JFileChooser.FILES_ONLY,
@@ -100,6 +124,7 @@ public class FileSelector extends JPanel
// hoping this will fix ArrayIndexOutOfBoundsException
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
if (selected != null && selected.exists()) {
fileChooser.setSelectedFile(selected);
@@ -108,6 +133,7 @@ public class FileSelector extends JPanel
});
browseButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
int returnVal = fileChooser.showOpenDialog(browseButton);
@@ -134,6 +160,7 @@ public class FileSelector extends JPanel
});
field.addFocusListener(new FocusAdapter() {
+ @Override
public void focusLost(FocusEvent e) {
// did text change?
String fileString = field.getText();
@@ -159,6 +186,7 @@ public class FileSelector extends JPanel
}
field.addKeyListener(new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
String fileString = field.getText();
@@ -182,24 +210,48 @@ public class FileSelector extends JPanel
});
}
+ /**
+ * Adds the file selector listener.
+ *
+ * @param aFileSelectorListener the a file selector listener
+ */
public void addFileSelectorListener(FileSelectorListener aFileSelectorListener) {
this.fileSelectorListener = aFileSelectorListener;
}
+ /* (non-Javadoc)
+ * @see java.awt.Component#addFocusListener(java.awt.event.FocusListener)
+ */
// added this to make focus change available to mediator
+ @Override
public void addFocusListener(FocusListener fl) {
// field.addFocusListener(fl);
externalFl = fl; // copy for later insertion
}
+ /**
+ * Adds the choosable file filter.
+ *
+ * @param ff the ff
+ */
public void addChoosableFileFilter(FileFilter ff) {
fileChooser.addChoosableFileFilter(ff);
}
+ /**
+ * Gets the selected.
+ *
+ * @return the selected
+ */
public String getSelected() {
return field.getText().trim();
}
+ /**
+ * Sets the selected.
+ *
+ * @param s the new selected
+ */
public void setSelected(String s) {
s = s.trim();
field.setText(s);
@@ -215,22 +267,43 @@ public class FileSelector extends JPanel
}
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#setEnabled(boolean)
+ */
+ @Override
public void setEnabled(boolean onOff) {
field.setEnabled(onOff);
browseButton.setEnabled(onOff);
}
+ /**
+ * Clear.
+ */
public void clear() {
field.setText("");
}
+ /**
+ * The Class BrowseButton.
+ */
static class BrowseButton extends JButton {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 7366026783079468609L;
+ /**
+ * Instantiates a new browse button.
+ *
+ * @param s the s
+ */
public BrowseButton(String s) {
super(s);
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#getInsets()
+ */
+ @Override
public Insets getInsets() {
return new Insets(3, 6, 3, 6);
}
@@ -241,6 +314,7 @@ public class FileSelector extends JPanel
*
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/
+ @Override
public void focusGained(FocusEvent aEvent) {
}
@@ -249,6 +323,7 @@ public class FileSelector extends JPanel
*
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
*/
+ @Override
public void focusLost(FocusEvent aEvent) {
if (aEvent.getComponent() == this.field) {
String path = this.getSelected();
@@ -269,6 +344,11 @@ public class FileSelector extends JPanel
}
+ /**
+ * Adds the document listener.
+ *
+ * @param l the l
+ */
/*
* (non-Javadoc)
*
@@ -278,6 +358,11 @@ public class FileSelector extends JPanel
field.getDocument().addDocumentListener(l);
}
+ /**
+ * Removes the document listener.
+ *
+ * @param l the l
+ */
/*
* (non-Javadoc)
*
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelectorListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelectorListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelectorListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/FileSelectorListener.java Sun Nov 13 16:08:24 2016
@@ -21,6 +21,26 @@ package org.apache.uima.tools.docanalyze
import javax.swing.JComponent;
+// TODO: Auto-generated Javadoc
+/**
+ * The listener interface for receiving fileSelector events.
+ * The class that is interested in processing a fileSelector
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addFileSelectorListener</code> method. When
+ * the fileSelector event occurs, that object's appropriate
+ * method is invoked.
+ *
+// * @see FileSelectorEvent
+ */
public interface FileSelectorListener {
+
+ /**
+ * File selected.
+ *
+ * @param source the source
+ * @param fileString the file string
+ * @return true, if successful
+ */
public boolean fileSelected(JComponent source, String fileString);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/PrefsMediator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/PrefsMediator.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/PrefsMediator.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/PrefsMediator.java Sun Nov 13 16:08:24 2016
@@ -29,59 +29,91 @@ import java.util.prefs.Preferences;
import javax.swing.JButton;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PrefsMediator.
+ */
public class PrefsMediator {
+ /** The input file selector. */
private FileSelector inputFileSelector;
+ /** The output file selector. */
private FileSelector outputFileSelector;
+ /** The xml file selector. */
private FileSelector xmlFileSelector;
+ /** The view button. */
private JButton runButton, interButton, viewButton;
+ /** The prefs. */
private Preferences prefs;
+ /** The tae dir. */
private String taeDir; // directory where TAE is located
+ /** The output dir. */
private String outputDir; // where files are written
+ /** The input dir. */
private String inputDir; // where original files are located
+ /** The default input dir. */
private String defaultInputDir; // so we start with something
+ /** The default output dir. */
private String defaultOutputDir;
+ /** The input file format. */
private String inputFileFormat;
+ /** The language. */
private String language;
+ /** The encoding. */
private String encoding;
+ /** The view type. */
private String viewType;
+ /** The xml tag. */
private String xmlTag;
+ /** The lenient. */
private boolean lenient;
+ /** The Constant VIEWTYPE. */
// constants describing preference entries
private static final String VIEWTYPE = "viewType";
+ /** The Constant ENCODING. */
private static final String ENCODING = "encoding";
+ /** The Constant INPUTFILEFORMAT. */
private static final String INPUTFILEFORMAT = "inputFileFormat";
+ /** The Constant LANGUAGE. */
private static final String LANGUAGE = "language";
+ /** The Constant TAEDESCRIPTOR. */
private static final String TAEDESCRIPTOR = "taeDescriptor";
+ /** The Constant OUTDIR. */
private static final String OUTDIR = "outDir";
+ /** The Constant INDIR. */
private static final String INDIR = "inDir";
+ /** The Constant XMLTAG. */
private static final String XMLTAG = "xmlTag";
+ /** The Constant LENIENT. */
private static final String LENIENT = "lenient";
+ /**
+ * Instantiates a new prefs mediator.
+ */
public PrefsMediator() {
// get the installed UIMA home directory
defaultInputDir = "examples/data";
@@ -90,6 +122,9 @@ public class PrefsMediator {
restorePreferences();
}
+ /**
+ * Restore preferences.
+ */
public void restorePreferences() {
inputDir = prefs.get(INDIR, defaultInputDir);
inputFileFormat = prefs.get(INPUTFILEFORMAT, "textDocument");
@@ -103,6 +138,9 @@ public class PrefsMediator {
}
+ /**
+ * Save preferences.
+ */
// saves current preferences
public void savePreferences() {
String t1 = inputFileSelector.getSelected();
@@ -114,6 +152,8 @@ public class PrefsMediator {
}
/**
+ * Gets the input dir.
+ *
* @return Returns the inputDir.
*/
public String getInputDir() {
@@ -121,8 +161,9 @@ public class PrefsMediator {
}
/**
- * @param inputDir
- * The inputDir to set.
+ * Sets the input dir.
+ *
+ * @param inputDir The inputDir to set.
*/
public void setInputDir(String inputDir) {
this.inputDir = inputDir;
@@ -131,6 +172,8 @@ public class PrefsMediator {
}
/**
+ * Gets the output dir.
+ *
* @return Returns the outputDir.
*/
public String getOutputDir() {
@@ -138,8 +181,9 @@ public class PrefsMediator {
}
/**
- * @param outputDir
- * The outputDir to set.
+ * Sets the output dir.
+ *
+ * @param outputDir The outputDir to set.
*/
public void setOutputDir(String outputDir) {
this.outputDir = outputDir;
@@ -163,6 +207,8 @@ public class PrefsMediator {
}
/**
+ * Gets the TA efile.
+ *
* @return Returns the tAEdir.
*/
public String getTAEfile() {
@@ -170,8 +216,9 @@ public class PrefsMediator {
}
/**
- * get the path to the TAE that is where the StyleMap file should be written
- *
+ * get the path to the TAE that is where the StyleMap file should be written.
+ *
+ * @return the TAE path
*/
public String getTAEPath() {
int index = indexOfLastFileSeparator(taeDir);
@@ -183,6 +230,11 @@ public class PrefsMediator {
}
}
+ /**
+ * Gets the TAE file name root.
+ *
+ * @return the TAE file name root
+ */
public String getTAEFileNameRoot() {
String file;
int index = indexOfLastFileSeparator(taeDir);
@@ -201,7 +253,8 @@ public class PrefsMediator {
/**
* Gets index of last file separator character in a file path.
* Supports File.separator but also / on Windows.
- * @param path
+ *
+ * @param path the path
* @return index of the last file separator char. Returns -1 if none.
*/
private int indexOfLastFileSeparator(String path) {
@@ -213,8 +266,9 @@ public class PrefsMediator {
}
/**
- * @param edir
- * set the TAE directory
+ * Sets the TA efile.
+ *
+ * @param edir set the TAE directory
*/
public void setTAEfile(String edir) {
taeDir = edir;
@@ -222,6 +276,8 @@ public class PrefsMediator {
}
/**
+ * Gets the encoding.
+ *
* @return Returns the encoding.
*/
public String getEncoding() {
@@ -229,8 +285,9 @@ public class PrefsMediator {
}
/**
- * @param encoding
- * The encoding to set.
+ * Sets the encoding.
+ *
+ * @param encoding The encoding to set.
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
@@ -238,6 +295,8 @@ public class PrefsMediator {
}
/**
+ * Gets the input file format.
+ *
* @return Returns the input file format.
*/
public String getInputFileFormat() {
@@ -245,8 +304,9 @@ public class PrefsMediator {
}
/**
- * @param inputFileFormat
- * The input file format to set.
+ * Sets the input file format.
+ *
+ * @param inputFileFormat The input file format to set.
*/
public void setInputFileFormat(String inputFileFormat) {
this.inputFileFormat = inputFileFormat;
@@ -254,6 +314,8 @@ public class PrefsMediator {
}
/**
+ * Gets the language.
+ *
* @return Returns the language.
*/
public String getLanguage() {
@@ -261,8 +323,9 @@ public class PrefsMediator {
}
/**
- * @param language
- * The language to set.
+ * Sets the language.
+ *
+ * @param language The language to set.
*/
public void setLanguage(String language) {
this.language = language;
@@ -270,6 +333,8 @@ public class PrefsMediator {
}
/**
+ * Gets the view type.
+ *
* @return Returns the view type.
*/
public String getViewType() {
@@ -277,8 +342,9 @@ public class PrefsMediator {
}
/**
- * @param viewType
- * The view type to set.
+ * Sets the view type.
+ *
+ * @param viewType The view type to set.
*/
public void setViewType(String viewType) {
this.viewType = viewType;
@@ -286,6 +352,8 @@ public class PrefsMediator {
}
/**
+ * Gets the xml tag.
+ *
* @return Returns the xmlTag.
*/
public String getXmlTag() {
@@ -293,8 +361,9 @@ public class PrefsMediator {
}
/**
- * @param xmlTag
- * The xmlTag to set.
+ * Sets the xml tag.
+ *
+ * @param xmlTag The xmlTag to set.
*/
public void setXmlTag(String xmlTag) {
this.xmlTag = xmlTag;
@@ -302,6 +371,8 @@ public class PrefsMediator {
}
/**
+ * Gets the lenient.
+ *
* @return Returns lenient.
*/
public Boolean getLenient() {
@@ -309,20 +380,32 @@ public class PrefsMediator {
}
/**
- * @param lenient
- * The lenient to set.
+ * Sets the lenient.
+ *
+ * @param lenient The lenient to set.
*/
public void setLenient(Boolean lenient) {
this.lenient = lenient;
prefs.putBoolean(LENIENT, lenient);
}
- /** returns the new edited stylemap file */
+ /**
+ * returns the new edited stylemap file.
+ *
+ * @return the stylemap file
+ */
public File getStylemapFile() {
String s = getTAEPath() + getTAEFileNameRoot() + "StyleMap.xml";
return new File(s);
}
+ /**
+ * Sets the doc buttons.
+ *
+ * @param run the run
+ * @param inter the inter
+ * @param view the view
+ */
// gets copies of buttonreference se it can mediate their on-ness
public void setDocButtons(JButton run, JButton inter, JButton view) {
runButton = run;
@@ -332,6 +415,13 @@ public class PrefsMediator {
fieldFocusLost(); // sets any enabled that should be
}
+ /**
+ * Sets the file selectors.
+ *
+ * @param input the input
+ * @param output the output
+ * @param xml the xml
+ */
// sets the File Seelctors
public void setFileSelectors(FileSelector input, FileSelector output, FileSelector xml) {
inputFileSelector = input;
@@ -339,6 +429,9 @@ public class PrefsMediator {
xmlFileSelector = xml;
}
+ /**
+ * Field focus lost.
+ */
// check all 3 text fields and adjust the enabling of the 3 buttons
public void fieldFocusLost() {
boolean enableRun = false;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfDocumentListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfDocumentListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfDocumentListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfDocumentListener.java Sun Nov 13 16:08:24 2016
@@ -22,14 +22,23 @@ package org.apache.uima.tools.docanalyze
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+// TODO: Auto-generated Javadoc
/**
* * This class tells the Mediator to check the length of the 3 text fields and adjust whether the 3
* buttons are enabeld or not.
*
+// * @see TfDocumentEvent
*/
public class TfDocumentListener implements DocumentListener {
+
+ /** The med. */
private PrefsMediator med;
+ /**
+ * Instantiates a new tf document listener.
+ *
+ * @param med the med
+ */
public TfDocumentListener(PrefsMediator med) {
this.med = med;
}
@@ -39,6 +48,7 @@ public class TfDocumentListener implemen
*
* @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
*/
+ @Override
public void changedUpdate(DocumentEvent e) {
}
@@ -47,6 +57,7 @@ public class TfDocumentListener implemen
*
* @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
*/
+ @Override
public void insertUpdate(DocumentEvent e) {
med.fieldFocusLost();
}
@@ -56,6 +67,7 @@ public class TfDocumentListener implemen
*
* @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
*/
+ @Override
public void removeUpdate(DocumentEvent e) {
med.fieldFocusLost();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFileSelectorListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFileSelectorListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFileSelectorListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFileSelectorListener.java Sun Nov 13 16:08:24 2016
@@ -21,14 +21,23 @@ package org.apache.uima.tools.docanalyze
import javax.swing.JComponent;
+// TODO: Auto-generated Javadoc
/**
* * This class tells the Mediator to check the length of the 3 text fields and adjust whether the 3
* buttons are enabeld or not.
*
+// * @see TfFileSelectorEvent
*/
public class TfFileSelectorListener implements FileSelectorListener {
+
+ /** The med. */
private PrefsMediator med;
+ /**
+ * Instantiates a new tf file selector listener.
+ *
+ * @param med the med
+ */
public TfFileSelectorListener(PrefsMediator med) {
this.med = med;
}
@@ -38,6 +47,7 @@ public class TfFileSelectorListener impl
*
* @see FileSelectorListener#fileSelected(javax.swing.JComponent, java.lang.String)
*/
+ @Override
public boolean fileSelected(JComponent source, String fileString) {
med.fieldFocusLost();
return true;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFocusListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFocusListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFocusListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/TfFocusListener.java Sun Nov 13 16:08:24 2016
@@ -22,14 +22,23 @@ package org.apache.uima.tools.docanalyze
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+// TODO: Auto-generated Javadoc
/**
* This class tells the Mediator to check the lenght of the 3 text fields and adjust whether the 3
* buttons are enabeld or not.
*
+// * @see TfFocusEvent
*/
public class TfFocusListener implements FocusListener {
+
+ /** The med. */
private PrefsMediator med;
+ /**
+ * Instantiates a new tf focus listener.
+ *
+ * @param med the med
+ */
public TfFocusListener(PrefsMediator med) {
this.med = med;
}
@@ -39,6 +48,7 @@ public class TfFocusListener implements
*
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/
+ @Override
public void focusGained(FocusEvent arg0) {
}
@@ -48,6 +58,7 @@ public class TfFocusListener implements
*
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
*/
+ @Override
public void focusLost(FocusEvent arg0) {
// Tell the mediator the text may have changed.
med.fieldFocusLost();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GUI.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GUI.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GUI.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GUI.java Sun Nov 13 16:08:24 2016
@@ -39,70 +39,113 @@ import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.apache.uima.tools.images.Images;
import org.apache.uima.tools.util.gui.AboutDialog;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GUI.
+ */
public class GUI extends JFrame {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
+ /** The about dialog. */
private AboutDialog aboutDialog;
+ /** The Constant NL. */
final static String NL = System.getProperties().getProperty("line.separator");
+ /** The GUI. */
static GUI theGUI;
+ /** The jg. */
final Jg jg;
+ /**
+ * The Class G.
+ */
class G extends JPanel implements ActionListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
+ /** The gui. */
final GUI gui;
+ /** The lb label 6. */
JLabel lbLabel6;
+ /** The lb label 1. */
JLabel lbLabel1;
+ /** The bt input file browse. */
JButton btInputFileBrowse;
+ /** The bt out dir browse. */
JButton btOutDirBrowse;
+ /** The bt gen xml browse. */
JButton btGenXmlBrowse;
+ /** The lb label 0. */
JLabel lbLabel0;
+ /** The lb label 9. */
JLabel lbLabel9;
+ /** The tf input file name. */
JTextArea tfInputFileName;
+ /** The tf out dir name. */
JTextArea tfOutDirName;
+ /** The tf gen XM lname. */
JTextArea tfGenXMLname;
+ /** The lb label 11. */
JLabel lbLabel11;
+ /** The lb label 12. */
JLabel lbLabel12;
+ /** The lb label 13. */
JLabel lbLabel13;
+ /** The bt go. */
JButton btGo;
+ /** The ta status. */
JTextArea taStatus;
+ /** The area scroll pane. */
JScrollPane areaScrollPane;
+ /** The lb label 15. */
JLabel lbLabel15;
+ /** The lb label 16. */
JLabel lbLabel16;
+ /** The lb label 17. */
JLabel lbLabel17;
+ /** The lb label 10. */
JLabel lbLabel10;
+ /** The lb result. */
JLabel lbResult;
+ /**
+ * Instantiates a new g.
+ *
+ * @param gui the gui
+ */
public G(GUI gui) {
super();
this.gui = gui;
@@ -195,7 +238,7 @@ public class GUI extends JFrame {
gbcG.fill = GridBagConstraints.BOTH;
gbcG.anchor = GridBagConstraints.NORTHWEST;
areaScrollPane = new JScrollPane(taStatus);
- areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
gbG.setConstraints(areaScrollPane, gbcG);
add(areaScrollPane);
@@ -219,6 +262,10 @@ public class GUI extends JFrame {
add(lbResult);
}
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btInputFileBrowse) {
browseFile(tfInputFileName); // Action for btInputFileBrowse
@@ -235,6 +282,11 @@ public class GUI extends JFrame {
}
}
+ /**
+ * Browse file.
+ *
+ * @param f the f
+ */
void browseFile(JTextArea f) {
String startingDir = f.getText();
if (startingDir.length() == 0) {
@@ -252,6 +304,11 @@ public class GUI extends JFrame {
}
}
+ /**
+ * Browse dir.
+ *
+ * @param f the f
+ */
void browseDir(JTextArea f) {
String startingDir = f.getText();
if (startingDir.length() == 0) {
@@ -270,10 +327,14 @@ public class GUI extends JFrame {
}
}
+ /**
+ * Go.
+ */
void go() {
final String outDirName = tfOutDirName.getText();
final String inFileName = tfInputFileName.getText();
Runnable r = new Runnable() {
+ @Override
public void run() {
jg.main0(new String[] { "-jcasgeninput", inFileName, "-jcasgenoutput", outDirName },
jg.merger, new GuiProgressMonitor(), new GuiErrorImpl());
@@ -282,6 +343,12 @@ public class GUI extends JFrame {
new Thread(r).start();
}
+ /**
+ * Show in status.
+ *
+ * @param message the message
+ * @return the string
+ */
String showInStatus(String message) {
taStatus.setText(taStatus.getText() + message + NL);
areaScrollPane.getVerticalScrollBar().setValue(
@@ -291,8 +358,14 @@ public class GUI extends JFrame {
}
}
+ /** The pn G. */
G pnG;
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
// for testing only
public static void main(String args[]) {
try {
@@ -305,6 +378,11 @@ public class GUI extends JFrame {
theGUI = new GUI(null);
}
+ /**
+ * Instantiates a new gui.
+ *
+ * @param jg the jg
+ */
public GUI(Jg jg) {
super("JCasGen");
theGUI = this;
@@ -345,6 +423,11 @@ public class GUI extends JFrame {
// show();
}
+ /**
+ * Creates the menu bar.
+ *
+ * @return the j menu bar
+ */
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
@@ -352,6 +435,7 @@ public class GUI extends JFrame {
JMenuItem exitMenuItem = new JMenuItem("Exit");
exitMenuItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
GUI.this.processWindowEvent(new WindowEvent(GUI.this, WindowEvent.WINDOW_CLOSING));
}
@@ -362,6 +446,7 @@ public class GUI extends JFrame {
JMenu helpMenu = new JMenu("Help");
JMenuItem aboutMenuItem = new JMenuItem("About");
aboutMenuItem.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
aboutDialog.setVisible(true);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiErrorImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiErrorImpl.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiErrorImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiErrorImpl.java Sun Nov 13 16:08:24 2016
@@ -27,9 +27,16 @@ import org.apache.uima.tools.jcasgen.Jg.
import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GuiErrorImpl.
+ */
public class GuiErrorImpl implements IError {
+
+ /** The sev msg. */
private static String[] sevMsg = new String[] { "Info", "Warning", "Error" };
+ /** The log levels. */
private static Level logLevels[] = { Level.INFO, Level.WARNING, Level.SEVERE };
/*
@@ -37,6 +44,7 @@ public class GuiErrorImpl implements IEr
*
* @see org.apache.uima.jcas.jcasgen_gen.IError#newError(int, java.lang.String)
*/
+ @Override
public void newError(int severity, String message, Exception exception) {
Logger log = UIMAFramework.getLogger();
log.log(logLevels[severity], GUI.theGUI.pnG.showInStatus("JCasGen " + sevMsg[severity] + ": "
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiProgressMonitor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiProgressMonitor.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiProgressMonitor.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/GuiProgressMonitor.java Sun Nov 13 16:08:24 2016
@@ -22,24 +22,49 @@ package org.apache.uima.tools.jcasgen;
import org.apache.uima.UIMAFramework;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class GuiProgressMonitor.
+ */
public class GuiProgressMonitor implements IProgressMonitor {
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.jcasgen.IProgressMonitor#beginTask(java.lang.String, int)
+ */
+ @Override
public void beginTask(String name, int totalWork) { // do nothing
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.jcasgen.IProgressMonitor#done()
+ */
+ @Override
public void done() {
UIMAFramework.getLogger().log(Level.INFO, GUI.theGUI.pnG.showInStatus(" ** JCasGen Done."));
GUI.theGUI.pnG.lbResult.setText("Finished");
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.jcasgen.IProgressMonitor#subTask(java.lang.String)
+ */
+ @Override
public void subTask(String message) {
GUI.theGUI.pnG.showInStatus(message);
UIMAFramework.getLogger().log(Level.INFO, " >>JCasGen " + message);
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.jcasgen.IProgressMonitor#worked(int)
+ */
+ @Override
public void worked(int work) { // do nothing
}
+ /**
+ * Internal worked.
+ *
+ * @param work the work
+ */
/*
* (non-Javadoc)
*
@@ -48,6 +73,11 @@ public class GuiProgressMonitor implemen
public void internalWorked(double work) { // do nothing
}
+ /**
+ * Checks if is canceled.
+ *
+ * @return true, if is canceled
+ */
/*
* (non-Javadoc)
*
@@ -57,6 +87,11 @@ public class GuiProgressMonitor implemen
return false;
}
+ /**
+ * Sets the canceled.
+ *
+ * @param value the new canceled
+ */
/*
* (non-Javadoc)
*
@@ -65,6 +100,11 @@ public class GuiProgressMonitor implemen
public void setCanceled(boolean value) { // do nothing
}
+ /**
+ * Sets the task name.
+ *
+ * @param name the new task name
+ */
/*
* (non-Javadoc)
*
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IError.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IError.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IError.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IError.java Sun Nov 13 16:08:24 2016
@@ -19,12 +19,27 @@
package org.apache.uima.tools.jcasgen;
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IError.
+ */
public interface IError {
+
+ /** The Constant ERROR. */
public static final int ERROR = 2;
+ /** The Constant WARN. */
public static final int WARN = 1;
+ /** The Constant INFO. */
public static final int INFO = 0;
+ /**
+ * New error.
+ *
+ * @param Severity the severity
+ * @param message the message
+ * @param e the e
+ */
public void newError(int Severity, String message, Exception e);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IMerge.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IMerge.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IMerge.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IMerge.java Sun Nov 13 16:08:24 2016
@@ -22,7 +22,24 @@ package org.apache.uima.tools.jcasgen;
import java.io.File;
import java.io.IOException;
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IMerge.
+ */
public interface IMerge {
+
+ /**
+ * Do merge.
+ *
+ * @param jg the jg
+ * @param progressMonitor the progress monitor
+ * @param sourceContents the source contents
+ * @param targetContainer the target container
+ * @param targetPath the target path
+ * @param targetClassName the target class name
+ * @param targetFile the target file
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
public void doMerge(Jg jg, IProgressMonitor progressMonitor, String sourceContents,
String targetContainer, String targetPath, String targetClassName, File targetFile)
throws IOException;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IProgressMonitor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IProgressMonitor.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IProgressMonitor.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/IProgressMonitor.java Sun Nov 13 16:08:24 2016
@@ -19,12 +19,36 @@
package org.apache.uima.tools.jcasgen;
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IProgressMonitor.
+ */
public interface IProgressMonitor {
+
+ /**
+ * Done.
+ */
public void done();
+ /**
+ * Begin task.
+ *
+ * @param name the name
+ * @param totalWorked the total worked
+ */
public void beginTask(String name, int totalWorked);
+ /**
+ * Sub task.
+ *
+ * @param name the name
+ */
public void subTask(String name);
+ /**
+ * Worked.
+ *
+ * @param work the work
+ */
public void worked(int work);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/JCasTypeTemplate.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/JCasTypeTemplate.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/JCasTypeTemplate.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/jcasgen/JCasTypeTemplate.java Sun Nov 13 16:08:24 2016
@@ -23,8 +23,16 @@ import java.util.Iterator;
import org.apache.uima.resource.metadata.TypeDescription;
import org.apache.uima.resource.metadata.FeatureDescription;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class JCasTypeTemplate.
+ */
public class JCasTypeTemplate implements Jg.IJCasTypeTemplate {
+ /* (non-Javadoc)
+ * @see org.apache.uima.tools.jcasgen.Jg.IJCasTypeTemplate#generate(java.lang.Object)
+ */
+ @Override
public String generate(Object argument) {
StringBuilder stringBuilder = new StringBuilder();