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 [7/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/stylemap/StyleMapXmlParser.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java Sun Nov 13 16:08:24 2016
@@ -34,6 +34,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+// TODO: Auto-generated Javadoc
/**
* A simple SAX parser for Style Map XML documents. A GUI for editing style maps for the annotation
* viewer.
@@ -42,18 +43,30 @@ import org.xml.sax.helpers.DefaultHandle
*
*/
public class StyleMapXmlParser extends DefaultHandler {
+
+ /** The Constant FEATURE_VALUE_PREFIX. */
private static final String FEATURE_VALUE_PREFIX = "[@";
+ /** The annot type. */
public Vector annotType = new Vector();
+ /** The style label. */
public Vector styleLabel = new Vector();
+ /** The style color. */
public Vector styleColor = new Vector();
+ /** The feature value. */
public Vector featureValue = new Vector();
+ /** The data. */
private StringBuffer data = new StringBuffer();
+ /**
+ * Instantiates a new style map xml parser.
+ *
+ * @param xmlFile the xml file
+ */
// constructor
public StyleMapXmlParser(String xmlFile) {
try {
@@ -79,10 +92,18 @@ public class StyleMapXmlParser extends D
}
+ /* (non-Javadoc)
+ * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ @Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
throws SAXException {
}
+ /* (non-Javadoc)
+ * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
// System.out.println("End Element: " + localName);
// System.out.println("Characters: " + data.toString().trim());
@@ -114,6 +135,10 @@ public class StyleMapXmlParser extends D
data.delete(0, data.length());
}
+ /* (non-Javadoc)
+ * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
+ */
+ @Override
public void characters(char[] ch, int start, int length) throws SAXException {
data.append(ch, start, length);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableDropAdapter.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableDropAdapter.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableDropAdapter.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableDropAdapter.java Sun Nov 13 16:08:24 2016
@@ -24,16 +24,33 @@ import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetContext;
import java.awt.dnd.DropTargetDropEvent;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TableDropAdapter.
+ */
class TableDropAdapter extends DropTargetAdapter {
+
+ /** The annotation features viewer. */
private AnnotationFeaturesViewer annotationFeaturesViewer;
+ /** The edit. */
private StyleMapEditor edit;
+ /**
+ * Instantiates a new table drop adapter.
+ *
+ * @param av the av
+ * @param edit the edit
+ */
public TableDropAdapter(AnnotationFeaturesViewer av, StyleMapEditor edit) {
annotationFeaturesViewer = av;
this.edit = edit;
}
+ /* (non-Javadoc)
+ * @see java.awt.dnd.DropTargetListener#drop(java.awt.dnd.DropTargetDropEvent)
+ */
+ @Override
public void drop(DropTargetDropEvent e) {
DropTargetContext targetContext = e.getDropTargetContext();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableGUIMediator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableGUIMediator.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableGUIMediator.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableGUIMediator.java Sun Nov 13 16:08:24 2016
@@ -23,28 +23,47 @@ import javax.swing.event.ListSelectionEv
import org.apache.uima.tools.util.gui.ImageButton;
+// TODO: Auto-generated Javadoc
/**
* Mediates GI elements in StyleMapEditor keeping buttons enabled or disabled depending on whether a
* row is selected.
*
*/
public class TableGUIMediator {
+
+ /** The table. */
private StyleMapTable table;
+ /** The delete. */
private ImageButton up, down, delete; // moves rows in style map
+ /** The add entry button. */
private ImageButton addEntryButton; // moves classes into style map
+ /** The row count. */
private int rowCount;
+ /**
+ * Instantiates a new table GUI mediator.
+ */
public TableGUIMediator() {
}
+ /**
+ * Sets the table.
+ *
+ * @param t the new table
+ */
public void setTable(StyleMapTable t) {
table = t;
}
+ /**
+ * Table clicked.
+ *
+ * @param ev the ev
+ */
public void tableClicked(ListSelectionEvent ev) {
// enable down arrow if there are more rows below the selection
// enable up arrow if there is one row or more above selection
@@ -64,6 +83,13 @@ public class TableGUIMediator {
}
+ /**
+ * Sets the buttons.
+ *
+ * @param up the up
+ * @param down the down
+ * @param delete the delete
+ */
public void setButtons(ImageButton up, ImageButton down, ImageButton delete) {
this.up = up;
this.down = down;
@@ -73,20 +99,38 @@ public class TableGUIMediator {
delete.setEnabled(false);
}
+ /**
+ * Gets the row selected.
+ *
+ * @return the row selected
+ */
public int getRowSelected() {
return table.getEditingRow();
}
+ /**
+ * Gets the column selected.
+ *
+ * @return the column selected
+ */
public int getColumnSelected() {
return table.getEditingColumn();
}
+ /**
+ * Sets the entry button.
+ *
+ * @param but the new entry button
+ */
// adds the Add table entry button to the mediator
public void setEntryButton(ImageButton but) {
addEntryButton = but;
addEntryButton.setEnabled(false); // initially disabled
}
+ /**
+ * Tree clicked.
+ */
// when the tree is clicked the button can be enabled.
public void treeClicked() {
addEntryButton.setEnabled(true);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableSelectionListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableSelectionListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableSelectionListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/TableSelectionListener.java Sun Nov 13 16:08:24 2016
@@ -22,8 +22,21 @@ package org.apache.uima.tools.stylemap;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+// TODO: Auto-generated Javadoc
+/**
+ * The listener interface for receiving tableSelection events.
+ * The class that is interested in processing a tableSelection
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addTableSelectionListener</code> method. When
+ * the tableSelection event occurs, that object's appropriate
+ * method is invoked.
+ *
+// * @see TableSelectionEvent
+ */
public class TableSelectionListener implements ListSelectionListener {
+ /** The med. */
/*
* (non-Javadoc)
*
@@ -31,10 +44,19 @@ public class TableSelectionListener impl
*/
private TableGUIMediator med;
+ /**
+ * Instantiates a new table selection listener.
+ *
+ * @param med the med
+ */
public TableSelectionListener(TableGUIMediator med) {
this.med = med;
}
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
+ */
+ @Override
public void valueChanged(ListSelectionEvent ev) {
med.tableClicked(ev); // table row was selected
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/AboutDialog.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/AboutDialog.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/AboutDialog.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/AboutDialog.java Sun Nov 13 16:08:24 2016
@@ -38,16 +38,26 @@ import org.apache.uima.UIMAFramework;
import org.apache.uima.tools.images.Images;
import org.apache.uima.util.Level;
+// TODO: Auto-generated Javadoc
/**
* Dialog showing standard UIMA splash screen and OK button. To be used for "About" menu item in
* GUIs.
*
*/
public class AboutDialog extends JDialog {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -3901327861122722078L;
+ /** The Constant ABOUT_TEXT. */
private static final String ABOUT_TEXT;
+ /**
+ * Instantiates a new about dialog.
+ *
+ * @param aParentFrame the a parent frame
+ * @param aDialogTitle the a dialog title
+ */
public AboutDialog(JFrame aParentFrame, String aDialogTitle) {
super(aParentFrame, aDialogTitle);
@@ -74,6 +84,7 @@ public class AboutDialog extends JDialog
this.setModal(true);
// event for the closeButton button
closeButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent ae) {
AboutDialog.this.setVisible(false);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/Caption.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/Caption.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/Caption.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/Caption.java Sun Nov 13 16:08:24 2016
@@ -22,6 +22,7 @@ package org.apache.uima.tools.util.gui;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
+// TODO: Auto-generated Javadoc
/**
*
*
@@ -29,8 +30,15 @@ import javax.swing.SwingConstants;
*/
public class Caption extends JLabel {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -2255251900300316894L;
+ /**
+ * Instantiates a new caption.
+ *
+ * @param s the s
+ */
public Caption(String s) {
super(s);
setHorizontalAlignment(SwingConstants.RIGHT);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileChooserBugWorkarounds.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileChooserBugWorkarounds.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileChooserBugWorkarounds.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileChooserBugWorkarounds.java Sun Nov 13 16:08:24 2016
@@ -25,6 +25,7 @@ import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
+// TODO: Auto-generated Javadoc
/**
* Workarounds for JFileChooser bugs on Windows Look and Feel.
*
@@ -90,6 +91,7 @@ public class FileChooserBugWorkarounds {
*/
public static void setCurrentDirectory(final JFileChooser aFileChooser, final File aDir) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
aFileChooser.setCurrentDirectory(aDir);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileSelector.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/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/util/gui/FileSelector.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileSelector.java Sun Nov 13 16:08:24 2016
@@ -38,16 +38,21 @@ import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
+// TODO: Auto-generated Javadoc
/**
* Composite component to allow file or directory input or selection. Comprises a JTextField, and a
* browse button associated with a JFileChooser.
*/
public class FileSelector extends JPanel implements FocusListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -1438950608628876422L;
+ /** The field. */
private JTextField field;
+ /** The browse button. */
private BrowseButton browseButton;
/**
@@ -57,18 +62,25 @@ public class FileSelector extends JPanel
*/
private JFileChooser fileChooser;
+ /** The source. */
private JComponent source;
+ /** The file selector listener. */
private FileSelectorListener fileSelectorListener = null;
+ /** The previous value. */
private String previousValue;
+ /** The initial dir. */
private File initialDir;
+ /** The file chooser title. */
private String fileChooserTitle;
+ /** The selection mode. */
private int selectionMode;
+ /** The filter. */
private FileFilter filter;
/**
@@ -128,6 +140,7 @@ public class FileSelector extends JPanel
add(browseButton);
browseButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = getFileChooser();
int returnVal = chooser.showOpenDialog(browseButton);
@@ -155,6 +168,7 @@ public class FileSelector extends JPanel
});
field.addFocusListener(new FocusAdapter() {
+ @Override
public void focusLost(FocusEvent e) {
// did text change?
String fileString = field.getText();
@@ -178,6 +192,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();
@@ -203,15 +218,31 @@ public class FileSelector extends JPanel
});
}
+ /**
+ * Adds the file selector listener.
+ *
+ * @param fileSelectorListener the file selector listener
+ * @param source the source
+ */
public void addFileSelectorListener(FileSelectorListener fileSelectorListener, JComponent source) {
this.fileSelectorListener = fileSelectorListener;
this.source = source;
}
+ /**
+ * Gets the selected.
+ *
+ * @return the selected
+ */
public String getSelected() {
return field.getText();
}
+ /**
+ * Sets the selected.
+ *
+ * @param s the new selected
+ */
public void setSelected(String s) {
field.setText(s);
previousValue = s;
@@ -230,22 +261,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 = 1086776109494251334L;
+ /**
+ * 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);
}
@@ -256,6 +308,7 @@ public class FileSelector extends JPanel
*
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/
+ @Override
public void focusGained(FocusEvent aEvent) {
}
@@ -264,6 +317,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) {
//only modify file chooser if it has already been created
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileSelectorListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/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/util/gui/FileSelectorListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FileSelectorListener.java Sun Nov 13 16:08:24 2016
@@ -21,6 +21,26 @@ package org.apache.uima.tools.util.gui;
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/util/gui/FormPanel.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FormPanel.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FormPanel.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/FormPanel.java Sun Nov 13 16:08:24 2016
@@ -36,33 +36,56 @@ import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FormPanel.
+ */
public class FormPanel extends JPanel {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 6935744171267722900L;
+ /** The Constant weights. */
private static final double weights[] = { 0.0, 0.0, 0.0, 0.0 };
+ /** The Constant anchors. */
private static final int anchors[] = { GridBagConstraints.NORTHEAST,
GridBagConstraints.NORTHWEST, GridBagConstraints.NORTHEAST, GridBagConstraints.NORTHWEST };
+ /** The gbl. */
private GridBagLayout gbl;
+ /** The gbc. */
private GridBagConstraints gbc;
+ /** The regular insets. */
private Insets regularInsets = new Insets(1, 4, 1, 4);
+ /** The check box insets. */
private Insets checkBoxInsets = new Insets(1, 0, 1, 0);
+ /** The nr columns. */
private int nrColumns = 2; // Default
+ /** The grid bag panel. */
protected JPanel gridBagPanel; // Inner panel
+ /** The component index. */
protected int componentIndex = 0;
+ /**
+ * Instantiates a new form panel.
+ *
+ * @param nrColumns the nr columns
+ */
public FormPanel(int nrColumns) {
this();
this.nrColumns = nrColumns;
}
+ /**
+ * Instantiates a new form panel.
+ */
public FormPanel() {
setLayout(new BorderLayout());
gridBagPanel = new JPanel();
@@ -74,6 +97,11 @@ public class FormPanel extends JPanel {
add(gridBagPanel, BorderLayout.NORTH);
}
+ /**
+ * Adds the.
+ *
+ * @param c the c
+ */
public void add(JComponent c) {
if (c instanceof JCheckBox)
gbc.insets = checkBoxInsets;
@@ -89,11 +117,15 @@ public class FormPanel extends JPanel {
componentIndex++;
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#setEnabled(boolean)
+ */
/*
* Enables or disables the panel and all its components.
*
* @see java.awt.Component#setEnabled(boolean)
*/
+ @Override
public void setEnabled(boolean onOff) {
super.setEnabled(onOff);
Component components[] = gridBagPanel.getComponents();
@@ -101,6 +133,11 @@ public class FormPanel extends JPanel {
components[i].setEnabled(onOff);
}
+ /**
+ * Gets the nr components.
+ *
+ * @return the nr components
+ */
public int getNrComponents() {
return componentIndex;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ImageButton.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ImageButton.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ImageButton.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ImageButton.java Sun Nov 13 16:08:24 2016
@@ -25,13 +25,28 @@ import javax.swing.JButton;
import org.apache.uima.tools.images.Images;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ImageButton.
+ */
public class ImageButton extends JButton {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -8908984308731809496L;
+ /**
+ * Instantiates a new image button.
+ *
+ * @param imageFile the image file
+ */
public ImageButton(String imageFile) {
super(Images.getImageIcon(imageFile));
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#getInsets()
+ */
+ @Override
public Insets getInsets() {
return new Insets(2, 2, 2, 2);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/IntegerField.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/IntegerField.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/IntegerField.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/IntegerField.java Sun Nov 13 16:08:24 2016
@@ -24,11 +24,25 @@ import java.text.NumberFormat;
import javax.swing.JFormattedTextField;
import javax.swing.text.NumberFormatter;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class IntegerField.
+ */
public class IntegerField extends JFormattedTextField {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -9172169254226111684L;
+ /** The number format. */
private NumberFormat numberFormat = NumberFormat.getIntegerInstance();
+ /**
+ * Instantiates a new integer field.
+ *
+ * @param min the min
+ * @param max the max
+ * @param initialValue the initial value
+ */
public IntegerField(int min, int max, int initialValue) {
super();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ListSelector.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ListSelector.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ListSelector.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/ListSelector.java Sun Nov 13 16:08:24 2016
@@ -38,32 +38,48 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
+import javax.swing.ScrollPaneConstants;
import javax.swing.border.Border;
import org.apache.uima.tools.images.Images;
+// TODO: Auto-generated Javadoc
/**
*
* A composite component comprising a JList and associated controls used to add and remove list
* elements and to control their ordering.
*/
public class ListSelector extends JPanel implements ActionListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 6426556774940666223L;
+ /** The list model. */
private DefaultListModel listModel = new DefaultListModel();
+ /** The list. */
private JList list;
+ /** The add field. */
private JTextField addField;
+ /** The add button. */
private SmallButton addButton;
+ /** The remove button. */
private SmallButton removeButton;
+ /** The move up button. */
private ImageButton moveUpButton;
+ /** The move down button. */
private ImageButton moveDownButton;
+ /**
+ * Instantiates a new list selector.
+ *
+ * @param listData the list data
+ */
public ListSelector(Object[] listData) {
for (int i = 0; i < listData.length; i++)
listModel.addElement(listData[i]);
@@ -76,8 +92,8 @@ public class ListSelector extends JPanel
Border etchedBorder = BorderFactory.createEtchedBorder();
list.setBorder(etchedBorder);
- JScrollPane scrollPane = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ JScrollPane scrollPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
+ ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
add(scrollPane, BorderLayout.CENTER);
JPanel controlPanel = new JPanel();
@@ -129,6 +145,11 @@ public class ListSelector extends JPanel
add(controlPanel, BorderLayout.EAST);
}
+ /**
+ * Populate.
+ *
+ * @param listData the list data
+ */
public void populate(Object[] listData) {
listModel.clear();
@@ -138,6 +159,11 @@ public class ListSelector extends JPanel
validate();
}
+ /**
+ * Gets the values.
+ *
+ * @return the values
+ */
public String[] getValues() {
Object[] valuesArray = listModel.toArray();
if (valuesArray.length == 0) {
@@ -150,6 +176,10 @@ public class ListSelector extends JPanel
}
}
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == addField || source == addButton) {
@@ -204,13 +234,27 @@ public class ListSelector extends JPanel
}
}
+ /**
+ * The Class SmallButton.
+ */
static class SmallButton extends JButton {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -4311761385714783114L;
+ /**
+ * Instantiates a new small button.
+ *
+ * @param s the s
+ */
public SmallButton(String s) {
super(s);
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#getInsets()
+ */
+ @Override
public Insets getInsets() {
return new Insets(3, 6, 3, 6);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SliderField.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SliderField.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SliderField.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SliderField.java Sun Nov 13 16:08:24 2016
@@ -28,13 +28,28 @@ import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SliderField.
+ */
public class SliderField extends JPanel implements ChangeListener, PropertyChangeListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 8200124988260091779L;
+ /** The slider. */
private JSlider slider;
+ /** The text field. */
private IntegerField textField;
+ /**
+ * Instantiates a new slider field.
+ *
+ * @param min the min
+ * @param max the max
+ * @param initialValue the initial value
+ */
public SliderField(int min, int max, int initialValue) {
setLayout(new FlowLayout(FlowLayout.LEFT, 4, 4));
@@ -56,6 +71,10 @@ public class SliderField extends JPanel
add(textField);
}
+ /* (non-Javadoc)
+ * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
+ */
+ @Override
public void stateChanged(ChangeEvent e) {
int sliderValue = slider.getValue();
textField.setValue(new Integer(sliderValue));
@@ -67,6 +86,10 @@ public class SliderField extends JPanel
textField.setText(String.valueOf(sliderValue));
}
+ /* (non-Javadoc)
+ * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals("value")) {
Number value = (Number) e.getNewValue();
@@ -75,16 +98,31 @@ public class SliderField extends JPanel
}
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#setEnabled(boolean)
+ */
+ @Override
public void setEnabled(boolean onOff) {
slider.setEnabled(onOff);
textField.setEnabled(onOff);
}
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
public int getValue() {
Integer value = (Integer) textField.getValue();
return value.intValue();
}
+ /**
+ * Determine major tick spacing.
+ *
+ * @param range the range
+ * @return the int
+ */
private int determineMajorTickSpacing(int range) {
if (range > 1000000)
return 1000000;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SpringUtilities.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SpringUtilities.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SpringUtilities.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SpringUtilities.java Sun Nov 13 16:08:24 2016
@@ -25,14 +25,18 @@ import java.awt.Container;
import javax.swing.Spring;
import javax.swing.SpringLayout;
+// TODO: Auto-generated Javadoc
/**
* Utility methods for creating form- or grid-style layouts with SpringLayout.
*/
public class SpringUtilities {
+
/**
* A debugging utility that prints to stdout the component's minimum, preferred, and maximum
* sizes.
+ *
+ * @param c the c
*/
public static void printSizes(Component c) {
System.out.println("minimumSize = " + c.getMinimumSize());
@@ -44,19 +48,14 @@ public class SpringUtilities {
* Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code>
* in a grid. Each component is as big as the maximum preferred width and height of the
* components. The parent is made just big enough to fit them all.
- *
- * @param rows
- * number of rows
- * @param cols
- * number of columns
- * @param initialX
- * x location to start the grid at
- * @param initialY
- * y location to start the grid at
- * @param xPad
- * x padding between cells
- * @param yPad
- * y padding between cells
+ *
+ * @param parent the parent
+ * @param rows number of rows
+ * @param cols number of columns
+ * @param initialX x location to start the grid at
+ * @param initialY y location to start the grid at
+ * @param xPad x padding between cells
+ * @param yPad y padding between cells
*/
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY,
int xPad, int yPad) {
@@ -123,6 +122,15 @@ public class SpringUtilities {
.getConstraint(SpringLayout.EAST)));
}
+ /**
+ * Gets the constraints for cell.
+ *
+ * @param row the row
+ * @param col the col
+ * @param parent the parent
+ * @param cols the cols
+ * @return the constraints for cell
+ */
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent,
int cols) {
@@ -136,19 +144,14 @@ public class SpringUtilities {
* in a grid. Each component in a column is as wide as the maximum preferred width of the
* components in that column; height is similarly determined for each row. The parent is made just
* big enough to fit them all.
- *
- * @param rows
- * number of rows
- * @param cols
- * number of columns
- * @param initialX
- * x location to start the grid at
- * @param initialY
- * y location to start the grid at
- * @param xPad
- * x padding between cells
- * @param yPad
- * y padding between cells
+ *
+ * @param parent the parent
+ * @param rows number of rows
+ * @param cols number of columns
+ * @param initialX x location to start the grid at
+ * @param initialY y location to start the grid at
+ * @param xPad x padding between cells
+ * @param yPad y padding between cells
*/
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX,
int initialY, int xPad, int yPad) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlListener.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlListener.java Sun Nov 13 16:08:24 2016
@@ -19,12 +19,36 @@
package org.apache.uima.tools.util.gui;
+// TODO: Auto-generated Javadoc
+/**
+ * The listener interface for receiving transportControl events.
+ * The class that is interested in processing a transportControl
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addTransportControlListener</code> method. When
+ * the transportControl event occurs, that object's appropriate
+ * method is invoked.
+ *
+ */
public interface TransportControlListener {
+
+ /**
+ * Control started.
+ */
public void controlStarted();
+ /**
+ * Control paused.
+ */
public void controlPaused();
+ /**
+ * Control resumed.
+ */
public void controlResumed(); // Following pause.
+ /**
+ * Control stopped.
+ */
public void controlStopped();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlPanel.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlPanel.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlPanel.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/TransportControlPanel.java Sun Nov 13 16:08:24 2016
@@ -34,31 +34,52 @@ import javax.swing.border.BevelBorder;
import org.apache.uima.tools.images.Images;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TransportControlPanel.
+ */
public class TransportControlPanel extends JPanel implements ActionListener {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -2176626241850938032L;
+ /** The Constant PLAY_BUTTON. */
static public final int PLAY_BUTTON = 0;
+ /** The Constant PAUSE_BUTTON. */
static public final int PAUSE_BUTTON = 1;
+ /** The Constant STOP_BUTTON. */
static public final int STOP_BUTTON = 2;
+ /** The play button. */
private ToggleButton playButton;
+ /** The pause button. */
private ToggleButton pauseButton;
+ /** The stop button. */
private ToggleButton stopButton;
+ /** The invisible button. */
private JToggleButton invisibleButton; // Used as part of ButtonGroup to give
// visual effect of no button selected
+ /** The last button selected. */
// if Stop is pressed.
private ToggleButton lastButtonSelected;
+ /** The allow stop. */
private boolean allowStop = true;
+ /** The control listener. */
final TransportControlListener controlListener;
+ /**
+ * Instantiates a new transport control panel.
+ *
+ * @param controlListener the control listener
+ */
public TransportControlPanel(TransportControlListener controlListener) {
this.controlListener = controlListener;
ButtonGroup buttonGroup = new ButtonGroup();
@@ -92,6 +113,10 @@ public class TransportControlPanel exten
stopButton.setEnabled(false);
}
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
@@ -125,6 +150,9 @@ public class TransportControlPanel exten
}
}
+ /**
+ * Pause.
+ */
private void pause() {
playButton.setEnabled(false);
stopButton.setEnabled(true);
@@ -133,14 +161,25 @@ public class TransportControlPanel exten
lastButtonSelected = pauseButton;
}
+ /**
+ * Perform pause.
+ */
public void performPause() {
pause();
}
+ /**
+ * Stop.
+ */
public void stop() {
stop(true);
}
+ /**
+ * Stop.
+ *
+ * @param invokeListener the invoke listener
+ */
private void stop(boolean invokeListener) {
if (invokeListener)
controlListener.controlStopped();
@@ -154,10 +193,19 @@ public class TransportControlPanel exten
lastButtonSelected = null;
}
+ /**
+ * Reset.
+ */
public void reset() {
stop(false);
}
+ /**
+ * Sets the button tooltip text.
+ *
+ * @param buttonIndex the button index
+ * @param tooltip the tooltip
+ */
public void setButtonTooltipText(int buttonIndex, String tooltip) {
if (buttonIndex == PLAY_BUTTON)
playButton.setToolTipText(tooltip);
@@ -167,6 +215,12 @@ public class TransportControlPanel exten
stopButton.setToolTipText(tooltip);
}
+ /**
+ * Gets the button.
+ *
+ * @param buttonIndex the button index
+ * @return the button
+ */
public AbstractButton getButton(int buttonIndex) {
if (buttonIndex == PLAY_BUTTON)
return playButton;
@@ -178,18 +232,36 @@ public class TransportControlPanel exten
return null;
}
+ /**
+ * Sets the allow stop.
+ *
+ * @param allowStop the new allow stop
+ */
public void setAllowStop(boolean allowStop) {
this.allowStop = allowStop;
}
+ /**
+ * The Class ToggleButton.
+ */
static class ToggleButton extends JToggleButton {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 334131406404068987L;
+ /**
+ * Instantiates a new toggle button.
+ *
+ * @param imageIcon the image icon
+ */
public ToggleButton(ImageIcon imageIcon) {
super(imageIcon);
}
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#getInsets()
+ */
+ @Override
public Insets getInsets() {
return new Insets(2, 2, 2, 2);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/XMLFileFilter.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/XMLFileFilter.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/XMLFileFilter.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/XMLFileFilter.java Sun Nov 13 16:08:24 2016
@@ -23,12 +23,19 @@ import java.io.File;
import javax.swing.filechooser.FileFilter;
+// TODO: Auto-generated Javadoc
/**
* File filter to accept only xml files (.xml extension)
*/
public class XMLFileFilter extends FileFilter {
+
+ /** The Constant XML. */
private static final String XML = "xml";
+ /* (non-Javadoc)
+ * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
+ */
+ @Override
public boolean accept(File file) {
if (file.isDirectory())
return true;
@@ -41,10 +48,20 @@ public class XMLFileFilter extends FileF
}
}
+ /* (non-Javadoc)
+ * @see javax.swing.filechooser.FileFilter#getDescription()
+ */
+ @Override
public String getDescription() {
return ".xml";
}
+ /**
+ * Gets the extension.
+ *
+ * @param f the f
+ * @return the extension
+ */
private String getExtension(File f) {
String ext = null;
String s = f.getName();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java Sun Nov 13 16:08:24 2016
@@ -45,6 +45,7 @@ import org.apache.uima.resource.metadata
import org.apache.uima.resource.metadata.TypeDescription;
import org.apache.uima.resource.metadata.TypeSystemDescription;
+// TODO: Auto-generated Javadoc
/**
* Utility that uses XSL stylesheets to produce an HTML view (w/ Javascript) of an annotated
* document.
@@ -121,10 +122,10 @@ public class AnnotationViewGenerator {
/**
* Writes a resource file to disk. The resource file is looked up in the classpath
- *
- * @param filename
- * name of the file, to be looked up in the classpath, under the same package as this
+ *
+ * @param filename name of the file, to be looked up in the classpath, under the same package as this
* class.
+ * @param outputDir the output dir
* @return outputDir directory of output file. Output file will be named the same as the
* <code>filename</code> parameter.
*/
@@ -167,9 +168,9 @@ public class AnnotationViewGenerator {
* <LI>docFrame.xsl - An XSL stylesheet to be applied to annotated documents during calls to
* {@link #processDocument(File)}.</LI>
* </UL>
- *
- * @param aStyleMap
- * path to style map to be processed
+ *
+ * @param aStyleMap path to style map to be processed
+ * @throws TransformerException the transformer exception
*/
public void processStyleMap(File aStyleMap) throws TransformerException {
// Copy static files annotations.xsl, annotationViewer.js, and index.html to
@@ -201,9 +202,9 @@ public class AnnotationViewGenerator {
* Processes an annotated document using the docFrame.xsl stylsheet generated by a previous call
* to {@link #processStyleMap(File)}. Generates a file named docView.html, which represents the
* HTML view of the annotated document.
- *
- * @param aInlineXmlDoc
- * path to annotated document to be processed
+ *
+ * @param aInlineXmlDoc path to annotated document to be processed
+ * @throws TransformerException the transformer exception
*/
public void processDocument(File aInlineXmlDoc) throws TransformerException {
// Generate document view HTML from Inline XML
@@ -345,11 +346,10 @@ public class AnnotationViewGenerator {
/**
* Automatically generates a style map file for the given analysis engine. The style map will be
* written to the file <code>aStyleMapFile</code>.
- *
- * @param aAE
- * the Analysis Engine whose outputs will be viewed using the generated style map.
- * @param aStyleMapFile
- * file to which autogenerated style map will be written
+ *
+ * @param aAE the Analysis Engine whose outputs will be viewed using the generated style map.
+ * @param aStyleMapFile file to which autogenerated style map will be written
+ * @throws IOException Signals that an I/O exception has occurred.
*/
public void autoGenerateStyleMapFile(AnalysisEngine aAE, File aStyleMapFile) throws IOException {
this.autoGenerateStyleMapFile(aAE.getAnalysisEngineMetaData(), aStyleMapFile);
@@ -358,13 +358,11 @@ public class AnnotationViewGenerator {
/**
* Automatically generates a style map file for the given analysis engine metadata. The style map
* will be written to the file <code>aStyleMapFile</code>.
- *
- *
- * @param aMetaData
- * Metadata of the Analysis Engine whose outputs will be viewed using the generated style
+ *
+ * @param aMetaData Metadata of the Analysis Engine whose outputs will be viewed using the generated style
* map.
- * @param aStyleMapFile
- * file to which autogenerated style map will be written
+ * @param aStyleMapFile file to which autogenerated style map will be written
+ * @throws IOException Signals that an I/O exception has occurred.
*/
public void autoGenerateStyleMapFile(AnalysisEngineMetaData aMetaData, File aStyleMapFile)
throws IOException {
@@ -382,11 +380,10 @@ public class AnnotationViewGenerator {
/**
* Automatically generates a style map file for the given type system. The style map will be
* written to the file <code>aStyleMapFile</code>.
- *
- * @param aTypeSystem
- * the type system for which a style map will be generated
- * @param aStyleMapFile
- * file to which autogenerated style map will be written
+ *
+ * @param aTypeSystem the type system for which a style map will be generated
+ * @param aStyleMapFile file to which autogenerated style map will be written
+ * @throws IOException Signals that an I/O exception has occurred.
*/
public void autoGenerateStyleMapFile(TypeSystemDescription aTypeSystem, File aStyleMapFile)
throws IOException {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewer.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewer.java Sun Nov 13 16:08:24 2016
@@ -31,6 +31,7 @@ import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
@@ -63,6 +64,7 @@ import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextPane;
import javax.swing.JTree;
+import javax.swing.ScrollPaneConstants;
import javax.swing.Scrollable;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
@@ -97,6 +99,7 @@ import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
import org.apache.uima.tools.viewer.EntityResolver.Entity;
+// TODO: Auto-generated Javadoc
/**
* A Swing component that displays annotations in a text pane with highlighting. There is also a
* tree view for display details of annotations on which the user clicks. This class extends
@@ -126,17 +129,28 @@ import org.apache.uima.tools.viewer.Enti
* </ul>
*/
public class CasAnnotationViewer extends JPanel {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 3559118488371946999L;
+ /** The Constant MODE_ANNOTATIONS. */
// Mode constants
private static final short MODE_ANNOTATIONS = 0;
+
+ /** The Constant MODE_ENTITIES. */
private static final short MODE_ENTITIES = 1;
+
+ /** The Constant MODE_FEATURES. */
private static final short MODE_FEATURES = 2;
+ /** The default hidden features. */
private static String[] DEFAULT_HIDDEN_FEATURES = { "sofa" };
// colors to use for highlighting annotations
+ /** The Constant BRIGHT. */
// (use high brightness for best contrast against black text)
private static final float BRIGHT = 0.95f;
+
+ /** The Constant COLORS. */
private static final Color[] COLORS = new Color[] {
// low saturation colors are best, so put them first
Color.getHSBColor(55f / 360, 0.25f, BRIGHT), // butter yellow?
@@ -172,58 +186,153 @@ public class CasAnnotationViewer extends
Color.getHSBColor(160f / 360, 0.75f, BRIGHT),
Color.getHSBColor(250f / 360, 0.75f, BRIGHT) };
+ /** The cas. */
private CAS cas;
+
+ /** The type system. */
private TypeSystem typeSystem;
+
+ /** The string type. */
private Type stringType;
+
+ /** The fs array type. */
private Type fsArrayType;
+
+ /** The use consistent colors. */
private boolean useConsistentColors = true;
+
+ /** The high frequency types. */
private List<String> highFrequencyTypes = new ArrayList<String>();
+
+ /** The bold face key words. */
private String[] boldFaceKeyWords = new String[0];
+
+ /** The bold face spans. */
private int[] boldFaceSpans = new int[0];
+
+ /** The hidden feature names. */
private Set<String> hiddenFeatureNames = new HashSet<String>();
+
+ /** The hidden type names. */
private Set<String> hiddenTypeNames = new HashSet<String>();
+
+ /** The displayed type names. */
private Set<String> displayedTypeNames;
+
+ /** The initially selected type names. */
private Set<String> initiallySelectedTypeNames;
+
+ /** The hide unselected check boxes. */
private boolean hideUnselectedCheckBoxes;
+
+ /** The user types. */
private List<String> userTypes = new ArrayList<String>();
+
+ /** The types not checked. */
private Set<String> typesNotChecked = new HashSet<String>();
+
+ /** The type color map. */
private Map<String, Color> typeColorMap = new HashMap<String, Color>();
+
+ /** The feature color map. */
private Map<String, Color> featureColorMap = new HashMap<String, Color>();
+
+ /** The entity resolver. */
private EntityResolver entityResolver = new DefaultEntityResolver();
+ /** The view mode. */
private short viewMode = MODE_ANNOTATIONS;
+
+ /** The type to check box map. */
// GUI components
private Map<Type, JCheckBox> typeToCheckBoxMap = new HashMap<Type, JCheckBox>();
+
+ /** The entity to check box map. */
private Map<Entity, JCheckBox> entityToCheckBoxMap = new HashMap<Entity, JCheckBox>();
+
+ /** The horizontal split pane. */
private JSplitPane horizontalSplitPane;
+
+ /** The vertical split pane. */
private JSplitPane verticalSplitPane;
+
+ /** The text pane. */
private JTextPane textPane;
+
+ /** The text scroll pane. */
private JScrollPane textScrollPane;
+
+ /** The type radio button map. */
private Map<Type, JRadioButton> typeRadioButtonMap = new HashMap<Type, JRadioButton>();
+
+ /** The feature radio button map. */
private Map<String, JRadioButton> featureRadioButtonMap = new HashMap<String, JRadioButton>();
+
+ /** The feature value check box map. */
private Map<String, JCheckBox> featureValueCheckBoxMap = new HashMap<String, JCheckBox>();
+
+ /** The feature value color map. */
private Map<String, Color> featureValueColorMap = new HashMap<String, Color>();
+
+ /** The show hide unselected button. */
private JButton showHideUnselectedButton;
+
+ /** The selected annotation tree. */
private JTree selectedAnnotationTree;
+
+ /** The selected annotation tree model. */
private DefaultTreeModel selectedAnnotationTreeModel;
+
+ /** The annotation mode button. */
private JRadioButton annotationModeButton;
+
+ /** The entity mode button. */
private JRadioButton entityModeButton;
+
+ /** The feature mode button. */
private JRadioButton featureModeButton;
+
+ /** The sofa selection panel. */
private JPanel sofaSelectionPanel;
+
+ /** The sofa selection combo box. */
@SuppressWarnings("rawtypes")
private JComboBox sofaSelectionComboBox;
+
+ /** The disable sofa selection combo box state change action. */
private boolean disableSofaSelectionComboBoxStateChangeAction = false;
+ /** The tabbed choice pane. */
private JTabbedPane tabbedChoicePane;
+
+ /** The type check box scroll pane. */
private JScrollPane typeCheckBoxScrollPane;
+
+ /** The type check box vertical scroll panel. */
private VerticallyScrollablePanel typeCheckBoxVerticalScrollPanel;
+
+ /** The entity check box scroll pane. */
private JScrollPane entityCheckBoxScrollPane;
+
+ /** The entity check box vertical scroll panel. */
private VerticallyScrollablePanel entityCheckBoxVerticalScrollPanel;
+
+ /** The type radio button scroll pane. */
private JScrollPane typeRadioButtonScrollPane;
+
+ /** The type radio button vertical scroll panel. */
private VerticallyScrollablePanel typeRadioButtonVerticalScrollPanel;
+
+ /** The feature radio button scroll pane. */
private JScrollPane featureRadioButtonScrollPane;
+
+ /** The feature radio button vertical scroll panel. */
private VerticallyScrollablePanel featureRadioButtonVerticalScrollPanel;
+
+ /** The feature value check box scroll pane. */
private JScrollPane featureValueCheckBoxScrollPane;
+
+ /** The feature value check box vertical scroll panel. */
private VerticallyScrollablePanel featureValueCheckBoxVerticalScrollPanel;
/**
@@ -245,6 +354,11 @@ public class CasAnnotationViewer extends
this.hiddenFeatureNames.addAll(Arrays.asList(DEFAULT_HIDDEN_FEATURES));
}
+ /**
+ * Creates the control panel.
+ *
+ * @return the j panel
+ */
private JPanel createControlPanel() {
JPanel controlPanel = new JPanel();
controlPanel.setLayout(new BorderLayout());
@@ -253,6 +367,11 @@ public class CasAnnotationViewer extends
return controlPanel;
}
+ /**
+ * Creates the select button panel.
+ *
+ * @return the j panel
+ */
private JPanel createSelectButtonPanel() {
JPanel selectButtonPanel = new JPanel();
selectButtonPanel.add(this.createSelectAllButton());
@@ -262,6 +381,11 @@ public class CasAnnotationViewer extends
return selectButtonPanel;
}
+ /**
+ * Creates the view panel.
+ *
+ * @return the j panel
+ */
private JPanel createViewPanel() {
JPanel viewPanel = new JPanel();
viewPanel.setLayout(new BorderLayout());
@@ -271,6 +395,11 @@ public class CasAnnotationViewer extends
return viewPanel;
}
+ /**
+ * Creates the view mode panel.
+ *
+ * @return the j panel
+ */
private JPanel createViewModePanel() {
JPanel viewModePanel = new JPanel();
viewModePanel.add(new JLabel("Mode: "));
@@ -287,6 +416,9 @@ public class CasAnnotationViewer extends
return viewModePanel;
}
+ /**
+ * Creates the feature mode button.
+ */
private void createFeatureModeButton() {
this.featureModeButton = new JRadioButton("Features", (this.viewMode == MODE_FEATURES));
this.featureModeButton.addActionListener(new ActionListener() {
@@ -305,6 +437,9 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the entity mode button.
+ */
private void createEntityModeButton() {
this.entityModeButton = new JRadioButton("Entities", this.viewMode == MODE_ENTITIES);
this.entityModeButton.addActionListener(new ActionListener() {
@@ -323,6 +458,9 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the annotation mode button.
+ */
private void createAnnotationModeButton() {
this.annotationModeButton = new JRadioButton("Annotations", this.viewMode == MODE_ANNOTATIONS);
this.annotationModeButton.addActionListener(new ActionListener() {
@@ -341,6 +479,9 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the sofa selection panel.
+ */
private void createSofaSelectionPanel() {
this.sofaSelectionPanel = new JPanel();
this.sofaSelectionPanel.add(new JLabel("Sofa:"));
@@ -348,6 +489,9 @@ public class CasAnnotationViewer extends
this.sofaSelectionPanel.add(this.sofaSelectionComboBox);
}
+ /**
+ * Creates the sofa selection combo box.
+ */
@SuppressWarnings("rawtypes")
private void createSofaSelectionComboBox() {
this.sofaSelectionComboBox = new JComboBox();
@@ -370,6 +514,9 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the show hide unselected button.
+ */
private void createShowHideUnselectedButton() {
this.showHideUnselectedButton = new JButton("Hide Unselected");
this.showHideUnselectedButton.addActionListener(new ActionListener() {
@@ -440,6 +587,11 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the deselect all button.
+ *
+ * @return the j button
+ */
private JButton createDeselectAllButton() {
JButton deselectAllButton = new JButton("Deselect All");
deselectAllButton.addActionListener(new ActionListener() {
@@ -504,6 +656,11 @@ public class CasAnnotationViewer extends
return deselectAllButton;
}
+ /**
+ * Creates the select all button.
+ *
+ * @return the j button
+ */
private JButton createSelectAllButton() {
JButton selectAllButton = new JButton("Select All");
selectAllButton.addActionListener(new ActionListener() {
@@ -607,6 +764,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Creates the horizontal split pane.
+ */
private void createHorizontalSplitPane() {
this.horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
this.horizontalSplitPane.setResizeWeight(0.6);
@@ -617,6 +777,11 @@ public class CasAnnotationViewer extends
this.horizontalSplitPane.setRightComponent(this.createTreePanel());
}
+ /**
+ * Creates the tree panel.
+ *
+ * @return the j panel
+ */
private JPanel createTreePanel() {
JPanel treePanel = new JPanel();
treePanel.setLayout(new BorderLayout());
@@ -626,11 +791,15 @@ public class CasAnnotationViewer extends
return treePanel;
}
+ /**
+ * Creates the selected annotation tree.
+ */
private void createSelectedAnnotationTree() {
this.selectedAnnotationTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode("Annotations"));
this.selectedAnnotationTree = new JTree(this.selectedAnnotationTreeModel) {
private static final long serialVersionUID = -7882967150283952907L;
+ @Override
public Dimension getPreferredScrollableViewportSize() {
return new Dimension(230, 500);
}
@@ -688,6 +857,9 @@ public class CasAnnotationViewer extends
});
}
+ /**
+ * Creates the vertical split pane.
+ */
private void createVerticalSplitPane() {
this.verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
this.verticalSplitPane.setResizeWeight(0.8);
@@ -701,6 +873,11 @@ public class CasAnnotationViewer extends
this.verticalSplitPane.setBottomComponent(this.createTabbedChoicePane());
}
+ /**
+ * Creates the tabbed choice pane.
+ *
+ * @return the j tabbed pane
+ */
private JTabbedPane createTabbedChoicePane() {
this.tabbedChoicePane = new JTabbedPane();
// Create the pane to hold check boxes for the annotation types in annotation view.
@@ -744,51 +921,69 @@ public class CasAnnotationViewer extends
return this.tabbedChoicePane;
}
+ /**
+ * Creates the feature value check box pane.
+ */
private void createFeatureValueCheckBoxPane() {
this.featureValueCheckBoxVerticalScrollPanel = new VerticallyScrollablePanel();
this.featureValueCheckBoxVerticalScrollPanel.setLayout(new GridLayout(0, 5));
this.featureValueCheckBoxScrollPane = new JScrollPane();
- this.featureValueCheckBoxScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.featureValueCheckBoxScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.featureValueCheckBoxScrollPane.setViewportView(this.featureValueCheckBoxVerticalScrollPanel);
}
+ /**
+ * Creates the feature radio button pane.
+ */
private void createFeatureRadioButtonPane() {
this.featureRadioButtonVerticalScrollPanel = new VerticallyScrollablePanel();
this.featureRadioButtonVerticalScrollPanel.setLayout(new GridLayout(0, 5));
this.featureRadioButtonScrollPane = new JScrollPane();
- this.featureRadioButtonScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.featureRadioButtonScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.featureRadioButtonScrollPane.setViewportView(this.featureRadioButtonVerticalScrollPanel);
}
+ /**
+ * Creates the type radio button pane.
+ */
private void createTypeRadioButtonPane() {
this.typeRadioButtonVerticalScrollPanel = new VerticallyScrollablePanel();
this.typeRadioButtonVerticalScrollPanel.setLayout(new GridLayout(0, 5));
this.typeRadioButtonScrollPane = new JScrollPane();
- this.typeRadioButtonScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.typeRadioButtonScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.typeRadioButtonScrollPane.setViewportView(this.typeRadioButtonVerticalScrollPanel);
}
+ /**
+ * Creates the entity check box pane.
+ */
private void createEntityCheckBoxPane() {
this.entityCheckBoxVerticalScrollPanel = new VerticallyScrollablePanel();
this.entityCheckBoxVerticalScrollPanel.setLayout(new GridLayout(0, 5));
this.entityCheckBoxScrollPane = new JScrollPane();
- this.entityCheckBoxScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.entityCheckBoxScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.entityCheckBoxScrollPane.setViewportView(this.entityCheckBoxVerticalScrollPanel);
}
+ /**
+ * Creates the type check box pane.
+ */
private void createTypeCheckBoxPane() {
this.typeCheckBoxVerticalScrollPanel = new VerticallyScrollablePanel();
this.typeCheckBoxVerticalScrollPanel.setLayout(new GridLayout(0, 5));
this.typeCheckBoxScrollPane = new JScrollPane();
- this.typeCheckBoxScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.typeCheckBoxScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.typeCheckBoxScrollPane.setViewportView(this.typeCheckBoxVerticalScrollPanel);
}
+ /**
+ * Creates the text scroll pane.
+ */
private void createTextScrollPane() {
this.textPane = new JTextPane();
this.textPane.setEditable(false);
@@ -827,7 +1022,7 @@ public class CasAnnotationViewer extends
@Override
public void keyPressed(KeyEvent ke) {
if (ke != null && ke.getKeyCode() == KeyEvent.VK_C &&
- (ke.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
+ (ke.getModifiers() & InputEvent.CTRL_MASK) != 0) {
String selection = textPane.getSelectedText();
if (selection != null && selection.length() > 0) {
Clipboard clipboard = getToolkit().getSystemClipboard();
@@ -847,6 +1042,9 @@ public class CasAnnotationViewer extends
}
/**
+ * Instantiates a new cas annotation viewer.
+ *
+ * @param aEntityViewEnabled the a entity view enabled
* @deprecated use the zero-argument constructor
*/
@Deprecated
@@ -855,6 +1053,8 @@ public class CasAnnotationViewer extends
}
/**
+ * Gets the user types.
+ *
* @return Returns the userTypes.
*/
public List<String> getUserTypes() {
@@ -862,8 +1062,9 @@ public class CasAnnotationViewer extends
}
/**
- * @param userTypes
- * The userTypes to set.
+ * Sets the user types.
+ *
+ * @param userTypes The userTypes to set.
*/
public void setUserTypes(List<String> userTypes) {
this.userTypes = userTypes;
@@ -942,8 +1143,8 @@ public class CasAnnotationViewer extends
Iterator<Map.Entry<Type, JCheckBox>> iterator = this.typeToCheckBoxMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Type, JCheckBox> entry = iterator.next();
- String type = ((Type) entry.getKey()).getName();
- JCheckBox checkbox = (JCheckBox) entry.getValue();
+ String type = entry.getKey().getName();
+ JCheckBox checkbox = entry.getValue();
checkbox.setSelected(typeNamesContains(this.initiallySelectedTypeNames, type));
}
@@ -1012,8 +1213,8 @@ public class CasAnnotationViewer extends
* Sets whether unselected (unchecked) checkboxes will be hidden entirely from the legend. This
* mode makes for a cleaner legend at the expense of making it more difficult to toggle which
* types are selected. There's also a button in the GUI that lets the user change this setting.
- *
- * @param aHideUnselected
+ *
+ * @param aHideUnselected the new hide unselected checkboxes
*/
public void setHideUnselectedCheckboxes(boolean aHideUnselected) {
this.hideUnselectedCheckBoxes = aHideUnselected;
@@ -1041,6 +1242,9 @@ public class CasAnnotationViewer extends
this.display();
}
+ /**
+ * Initialize sofa selection panel.
+ */
@SuppressWarnings("unchecked")
private void initializeSofaSelectionPanel() {
// Populate sofa combo box with the names of all text Sofas in the CAS
@@ -1085,6 +1289,9 @@ public class CasAnnotationViewer extends
// display();
}
+ /**
+ * Reset.
+ */
private void reset() {
// clear type to color map if color consistency is off
this.resetTypeColorMap();
@@ -1107,6 +1314,9 @@ public class CasAnnotationViewer extends
this.boldFaceSpans = new int[0];
}
+ /**
+ * Reset selected annotation tree.
+ */
private void resetSelectedAnnotationTree() {
if (this.selectedAnnotationTreeModel != null) {
DefaultMutableTreeNode root = (DefaultMutableTreeNode) this.selectedAnnotationTreeModel.getRoot();
@@ -1116,6 +1326,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset entity check box panel.
+ */
private void resetEntityCheckBoxPanel() {
if (this.entityToCheckBoxMap.size() > 0) {
this.entityToCheckBoxMap.clear();
@@ -1125,6 +1338,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset type check box panel.
+ */
private void resetTypeCheckBoxPanel() {
// clear checkbox panel so it will be repopulated
if (this.typeToCheckBoxMap.size() > 0) {
@@ -1135,6 +1351,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset feature value panel.
+ */
private void resetFeatureValuePanel() {
if (this.featureValueColorMap.size() > 0) {
this.featureValueColorMap.clear();
@@ -1147,6 +1366,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset feature panel.
+ */
private void resetFeaturePanel() {
if (this.featureColorMap.size() > 0) {
this.featureColorMap.clear();
@@ -1159,6 +1381,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset type radio button panel.
+ */
private void resetTypeRadioButtonPanel() {
if (this.typeRadioButtonMap.size() > 0) {
this.typeRadioButtonMap.clear();
@@ -1168,6 +1393,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Reset type color map.
+ */
private void resetTypeColorMap() {
if (!this.useConsistentColors) {
if (this.typeColorMap.size() > 0) {
@@ -1252,9 +1480,9 @@ public class CasAnnotationViewer extends
// System.out.println(typeList);
// System.out.println(keywordList);
- setInitiallySelectedTypes((String[]) typeList.toArray(new String[0]));
+ setInitiallySelectedTypes(typeList.toArray(new String[0]));
display();
- applyBoldfaceToKeywords((String[]) keywordList.toArray(new String[0]));
+ applyBoldfaceToKeywords(keywordList.toArray(new String[0]));
}
/**
@@ -1272,10 +1500,9 @@ public class CasAnnotationViewer extends
}
/**
- * Assign initially checked to the specified types, pairing up down the lists
- *
- * @param aNotChecked
- * list of types not to be initially checked JMP
+ * Assign initially checked to the specified types, pairing up down the lists.
+ *
+ * @param aNotChecked list of types not to be initially checked JMP
*/
public void assignCheckedFromList(List<String> aNotChecked) {
if (aNotChecked == null || aNotChecked.size() == 0) {
@@ -1285,12 +1512,10 @@ public class CasAnnotationViewer extends
}
/**
- * Assign colors to the specified types, pairing up down the lists
- *
- * @param aColors
- * list of colors
- * @param aTypeNames
- * list of type names JMP
+ * Assign colors to the specified types, pairing up down the lists.
+ *
+ * @param aColors list of colors
+ * @param aTypeNames list of type names JMP
*/
public void assignColorsFromList(List<Color> aColors, List<String> aTypeNames) {
// populate mTypeNameToColorMap
@@ -1329,10 +1554,9 @@ public class CasAnnotationViewer extends
}
/**
- * Assign colors to the specified types
- *
- * @param aTypeNames
- * list of type names
+ * Assign colors to the specified types.
+ *
+ * @param aTypeNames list of type names
*/
private void assignTypeColors(List<String> aTypeNames) {
// populate mTypeNameToColorMap
@@ -1451,6 +1675,9 @@ public class CasAnnotationViewer extends
this.textPane.setDocument(doc);
}
+ /**
+ * Adds the feature value check boxes.
+ */
private void addFeatureValueCheckBoxes() {
if (this.featureValueCheckBoxMap.size() == 0) {
return;
@@ -1472,6 +1699,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Adds the feature radio buttons.
+ */
private void addFeatureRadioButtons() {
if (this.featureRadioButtonMap.size() == 0) {
return;
@@ -1494,6 +1724,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Adds the type radio buttons.
+ */
private void addTypeRadioButtons() {
if (this.typeRadioButtonMap.size() == 0) {
return;
@@ -1539,11 +1772,10 @@ public class CasAnnotationViewer extends
/**
* Examine an annotation and add type/feature/value-related controls if
* necessary.
- *
- * @param doc
- * @param annotation
- * @param firstType
- * If true, the annotation being examined has the first
+ *
+ * @param doc the doc
+ * @param annotation the annotation
+ * @param firstType If true, the annotation being examined has the first
* type-related radio button that needs to be created and also
* set as selected.
* @return If true, the annotation being examined has its type being
@@ -1615,12 +1847,12 @@ public class CasAnnotationViewer extends
/**
* Examine one feature of the given annotation and create the
* feature-related controls.
- *
- * @param doc
- * @param annotation
- * @param feature
- * @param firstFeature
- * @return
+ *
+ * @param doc the doc
+ * @param annotation the annotation
+ * @param feature the feature
+ * @param firstFeature the first feature
+ * @return true, if successful
*/
private boolean processOneFeature(StyledDocument doc, Annotation annotation,
Feature feature, boolean firstFeature) {
@@ -1679,11 +1911,11 @@ public class CasAnnotationViewer extends
/**
* Examine one feature of the given annotation and create the
* feature-value-related controls.
- *
- * @param doc
- * @param annotation
- * @param feature
- * @return
+ *
+ * @param doc the doc
+ * @param annotation the annotation
+ * @param feature the feature
+ * @return true, if successful
*/
private boolean processOneFeatureValue(StyledDocument doc,
Annotation annotation, Feature feature) {
@@ -1770,6 +2002,9 @@ public class CasAnnotationViewer extends
this.textPane.setDocument(doc);
}
+ /**
+ * Adds the type check boxes.
+ */
private void addTypeCheckBoxes() {
if (this.typeToCheckBoxMap.size() == 0) {
return;
@@ -1814,6 +2049,12 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Process one annotation in annotation view.
+ *
+ * @param doc the doc
+ * @param annotation the annotation
+ */
private void processOneAnnotationInAnnotationView(StyledDocument doc, AnnotationFS annotation) {
Type type = annotation.getType();
String typeName = type.getName();
@@ -1925,6 +2166,12 @@ public class CasAnnotationViewer extends
this.textPane.setDocument(doc);
}
+ /**
+ * Process one annotation in entity view.
+ *
+ * @param doc the doc
+ * @param annotation the annotation
+ */
private void processOneAnnotationInEntityView(StyledDocument doc, Annotation annotation) {
// find out what entity this annotation represents
Entity entity = this.entityResolver.getEntity(annotation);
@@ -2025,9 +2272,9 @@ public class CasAnnotationViewer extends
/**
* Check if an annotation matches the filters set by the user. If true, the
* annotation will be added to the annotation tree display panel.
- *
- * @param annotation
- * @return
+ *
+ * @param annotation the annotation
+ * @return true, if is match
*/
private boolean isMatch(Annotation annotation) {
Type type = annotation.getType();
@@ -2110,6 +2357,12 @@ public class CasAnnotationViewer extends
this.addFeatureTreeNodes(annotationNode, aAnnotation);
}
+ /**
+ * Adds the feature tree nodes.
+ *
+ * @param aParentNode the a parent node
+ * @param aFS the a FS
+ */
private void addFeatureTreeNodes(DefaultMutableTreeNode aParentNode, FeatureStructure aFS) {
List<Feature> features = aFS.getType().getFeatures();
if (features == null || features.size() == 0) {
@@ -2173,10 +2426,10 @@ public class CasAnnotationViewer extends
/**
* Get feature value in string, if value is not another annotation and not
* an array of annotations.
- *
- * @param aFS
- * @param feature
- * @return
+ *
+ * @param aFS the a FS
+ * @param feature the feature
+ * @return the feature value in string
*/
private String getFeatureValueInString(FeatureStructure aFS, Feature feature) {
if (this.cas == null || this.typeSystem == null || this.stringType == null || this.fsArrayType == null) {
@@ -2221,11 +2474,11 @@ public class CasAnnotationViewer extends
* Check if a string is null or longer than specified limit. If null, use
* default value. If longer than specified limit, take only the leading
* substring that would fit in the limit.
- *
- * @param stringValue
- * @param defaultIfNull
- * @param maxLength
- * @return
+ *
+ * @param stringValue the string value
+ * @param defaultIfNull the default if null
+ * @param maxLength the max length
+ * @return the string
*/
private static String checkString(String stringValue, String defaultIfNull, int maxLength) {
if (stringValue == null) {
@@ -2300,8 +2553,12 @@ public class CasAnnotationViewer extends
}
/**
+ * Sets the size.
+ *
+ * @param d the new size
* @see java.awt.Component#setSize(Dimension)
*/
+ @Override
public void setSize(Dimension d) {
super.setSize(d);
Insets insets = getInsets();
@@ -2322,6 +2579,9 @@ public class CasAnnotationViewer extends
this.doBoldFaceBySpans();
}
+ /**
+ * Do bold face by spans.
+ */
private void doBoldFaceBySpans() {
if (this.boldFaceSpans == null || this.boldFaceSpans.length == 0) {
return;
@@ -2342,6 +2602,9 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Do bold face by key words.
+ */
private void doBoldFaceByKeyWords() {
if (this.boldFaceKeyWords == null || this.boldFaceKeyWords.length == 0) {
return;
@@ -2405,9 +2668,11 @@ public class CasAnnotationViewer extends
/* (non-Javadoc)
* @see org.apache.uima.tools.viewer.EntityResolver#getCanonicalForm(org.apache.uima.jcas.tcas.Annotation)
*/
+ @Override
public Entity getEntity(final Annotation inAnnotation) {
return new Entity() {
+ @Override
public String getCanonicalForm() {
return inAnnotation.getCoveredText();
}
@@ -2430,19 +2695,34 @@ public class CasAnnotationViewer extends
}
/**
- * Inner class containing data for a tree node representing a Type
+ * Inner class containing data for a tree node representing a Type.
*/
private static class TypeTreeNodeObject {
+
+ /** The type. */
private Type type;
+ /**
+ * Instantiates a new type tree node object.
+ *
+ * @param inType the in type
+ */
public TypeTreeNodeObject(Type inType) {
this.type = inType;
}
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
public Type getType() {
return this.type;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return this.type.getShortName();
@@ -2450,13 +2730,25 @@ public class CasAnnotationViewer extends
}
/**
- * Inner class containing data for a tree node representing a FeatureStructure
+ * Inner class containing data for a tree node representing a FeatureStructure.
*/
private static class FsTreeNodeObject {
+
+ /** The feature structure. */
private FeatureStructure featureStructure;
+
+ /** The feature name. */
private String featureName;
+
+ /** The caption. */
private String caption;
+ /**
+ * Instantiates a new fs tree node object.
+ *
+ * @param inFeatureStructure the in feature structure
+ * @param inFeatureName the in feature name
+ */
public FsTreeNodeObject(FeatureStructure inFeatureStructure, String inFeatureName) {
this.featureStructure = inFeatureStructure;
this.featureName = inFeatureName;
@@ -2472,17 +2764,30 @@ public class CasAnnotationViewer extends
}
}
+ /**
+ * Gets the feature structure.
+ *
+ * @return the feature structure
+ */
public FeatureStructure getFeatureStructure() {
return this.featureStructure;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return this.caption;
}
}
+ /**
+ * The Class AnnotationTreeCellRenderer.
+ */
private class AnnotationTreeCellRenderer extends DefaultTreeCellRenderer {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -8661556785397184756L;
/*
@@ -2522,7 +2827,7 @@ public class CasAnnotationViewer extends
@Override
public void keyPressed(KeyEvent ke) {
if (ke == null || ke.getKeyCode() != KeyEvent.VK_C ||
- (ke.getModifiers() & KeyEvent.CTRL_MASK) == 0) {
+ (ke.getModifiers() & InputEvent.CTRL_MASK) == 0) {
return;
}
String selection = ((DefaultMutableTreeNode) value).getUserObject().toString();
@@ -2551,6 +2856,8 @@ public class CasAnnotationViewer extends
*
*/
private static class VerticallyScrollablePanel extends JPanel implements Scrollable {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1009744410018634511L;
/*
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewerApplet.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewerApplet.java?rev=1769510&r1=1769509&r2=1769510&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewerApplet.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-tools/src/main/java/org/apache/uima/tools/viewer/CasAnnotationViewerApplet.java Sun Nov 13 16:08:24 2016
@@ -37,19 +37,23 @@ import org.apache.uima.cas.impl.CASCompl
import org.apache.uima.cas.impl.Serialization;
import org.apache.uima.internal.util.SerializationUtils;
+// TODO: Auto-generated Javadoc
/**
* The CasAnnotationViewer as an Applet.
*
*/
public class CasAnnotationViewerApplet extends JApplet {
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1273090141115008715L;
- /** The CAS Annotation Viewer panel */
+ /** The CAS Annotation Viewer panel. */
private CasAnnotationViewer mViewer;
/**
* Called when the applet is initialized.
*/
+ @Override
public void init() {
try {
// get applet parameter - URL from which to get the CAS
@@ -132,8 +136,15 @@ public class CasAnnotationViewerApplet e
/**
* A listener for detecting resize events. Sets the size of the TreeViewer panel whenever the
* applet's size changes.
+ *
+ * @see MyComponentEvent
*/
class MyComponentListener extends ComponentAdapter {
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
+ */
+ @Override
public void componentResized(ComponentEvent e) {
resizeTreeViewer();
}