Revision: 17862
http://sourceforge.net/p/gate/code/17862
Author: markagreenwood
Date: 2014-04-17 18:26:57 +0000 (Thu, 17 Apr 2014)
Log Message:
-----------
bunch more java warnings cleared up
Modified Paths:
--------------
gate/trunk/src/main/gate/gui/docview/AnnotationSetsView.java
gate/trunk/src/main/gate/gui/docview/AnnotationStackView.java
gate/trunk/src/main/gate/gui/docview/CorefEditor.java
gate/trunk/src/main/gate/gui/docview/OntologyClassView.java
gate/trunk/src/main/gate/gui/docview/OntologyInstanceView.java
Modified: gate/trunk/src/main/gate/gui/docview/AnnotationSetsView.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/AnnotationSetsView.java
2014-04-17 17:04:10 UTC (rev 17861)
+++ gate/trunk/src/main/gate/gui/docview/AnnotationSetsView.java
2014-04-17 18:26:57 UTC (rev 17862)
@@ -2312,7 +2312,7 @@
&& (event.getModifiers() & InputEvent.BUTTON1_MASK)
!= InputEvent.BUTTON1_MASK) {
// shows a confirm dialog to delete types and sets
- JList list = new JList(resourcesToDelete);
+ JList<String> list = new JList<String>(resourcesToDelete);
list.setVisibleRowCount(Math.min(resourcesToDelete.size()+1, 10));
int choice = JOptionPane.showOptionDialog(MainFrame.getInstance(), new
Object[]{"Are you sure you want to delete the following
annotations?",
Modified: gate/trunk/src/main/gate/gui/docview/AnnotationStackView.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/AnnotationStackView.java
2014-04-17 17:04:10 UTC (rev 17861)
+++ gate/trunk/src/main/gate/gui/docview/AnnotationStackView.java
2014-04-17 18:26:57 UTC (rev 17862)
@@ -348,7 +348,7 @@
collator.setStrength(Collator.TERTIARY);
SortedSet<String> setNames = new TreeSet<String>(collator);
setNames.addAll(document.getAnnotationSetNames());
- JList list = new JList(setNames.toArray());
+ JList<String> list = new JList<String>(setNames.toArray(new
String[setNames.size()]));
list.setVisibleRowCount(Math.min(10, setNames.size()));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedValue(targetSetName, true);
@@ -358,9 +358,10 @@
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
- JList list = (JList) e.getSource();
+ @SuppressWarnings("unchecked")
+ JList<String> list = (JList<String>) e.getSource();
if (list.getSelectedValue() != null) {
- setsTextField.setText((String) list.getSelectedValue());
+ setsTextField.setText(list.getSelectedValue());
}
}
});
@@ -638,7 +639,7 @@
}
features.add(" ");
// create the list component
- final JList list = new JList(features.toArray());
+ final JList<String> list = new JList<String>(features.toArray(new
String[features.size()]));
list.setVisibleRowCount(Math.min(8, features.size()));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setBackground(Color.WHITE);
@@ -646,7 +647,7 @@
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
- String feature = (String) list.getSelectedValue();
+ String feature = list.getSelectedValue();
if (feature.equals(" ")) {
typesFeatures.remove(type);
} else {
Modified: gate/trunk/src/main/gate/gui/docview/CorefEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/CorefEditor.java 2014-04-17
17:04:10 UTC (rev 17861)
+++ gate/trunk/src/main/gate/gui/docview/CorefEditor.java 2014-04-17
18:26:57 UTC (rev 17862)
@@ -89,8 +89,8 @@
private JPanel mainPanel, topPanel, subPanel;
private JToggleButton showAnnotations;
- private JComboBox annotSets, annotTypes;
- private DefaultComboBoxModel annotSetsModel, annotTypesModel;
+ private JComboBox<String> annotSets, annotTypes;
+ private DefaultComboBoxModel<String> annotSetsModel, annotTypesModel;
// Co-reference Tree
private JTree corefTree;
@@ -193,26 +193,26 @@
showAnnotations.addActionListener(this);
// annotSets
- annotSets = new JComboBox();
+ annotSets = new JComboBox<String>();
annotSets.addActionListener(this);
// get all the annotationSets
Map<String,AnnotationSet> annotSetsMap = document.getNamedAnnotationSets();
- annotSetsModel = new DefaultComboBoxModel();
+ annotSetsModel = new DefaultComboBoxModel<String>();
if (annotSetsMap != null) {
- Object [] array = annotSetsMap.keySet().toArray();
+ String [] array = annotSetsMap.keySet().toArray(new
String[annotSetsMap.keySet().size()]);
for(int i=0;i<array.length;i++) {
annotSetsMap.get(array[i]).addAnnotationSetListener(this);
}
- annotSetsModel = new DefaultComboBoxModel(array);
+ annotSetsModel = new DefaultComboBoxModel<String>(array);
}
document.getAnnotations().addAnnotationSetListener(this);
annotSetsModel.insertElementAt(DEFAULT_ANNOTSET_NAME, 0);
annotSets.setModel(annotSetsModel);
// annotTypes
- annotTypesModel = new DefaultComboBoxModel();
- annotTypes = new JComboBox(annotTypesModel);
+ annotTypesModel = new DefaultComboBoxModel<String>();
+ annotTypes = new JComboBox<String>(annotTypesModel);
annotTypes.addActionListener(this);
subPanel.add(new JLabel("Sets : "));
subPanel.add(annotSets);
@@ -953,12 +953,12 @@
String currentAnnotSet = (String) annotSets.getSelectedItem();
// get all the types of the currently Selected AnnotationSet
if (currentAnnotSet == null)
- currentAnnotSet = (String) annotSets.getItemAt(0);
+ currentAnnotSet = annotSets.getItemAt(0);
AnnotationSet temp = getAnnotationSet(currentAnnotSet);
Set<String> types = temp.getAllTypes();
- annotTypesModel = new DefaultComboBoxModel();
+ annotTypesModel = new DefaultComboBoxModel<String>();
if (types != null) {
- annotTypesModel = new DefaultComboBoxModel(types.toArray());
+ annotTypesModel = new DefaultComboBoxModel<String>(types.toArray(new
String[types.size()]));
}
annotTypes.setModel(annotTypesModel);
annotTypes.updateUI();
@@ -1032,7 +1032,7 @@
// see if this setName available in the annotSets
boolean found = false;
for (int i = 0; i < annotSets.getModel().getSize(); i++) {
- if ( ( (String) annotSets.getModel().getElementAt(i)).equals(setName)) {
+ if ( annotSets.getModel().getElementAt(i).equals(setName)) {
found = true;
break;
}
@@ -1070,7 +1070,7 @@
// see if this setName available in the annotSets
boolean found = false;
for (int i = 0; i < annotSets.getModel().getSize(); i++) {
- if ( ( (String) annotSets.getModel().getElementAt(i)).equals(setName)) {
+ if ( annotSets.getModel().getElementAt(i).equals(setName)) {
found = true;
break;
}
@@ -1388,11 +1388,11 @@
String field = "";
JButton add = new JButton("OK");
JButton cancel = new JButton("Cancel");
- JComboBox list = new JComboBox();
+ JComboBox<String> list = new JComboBox<String>();
JPanel mainPanel = new JPanel();
JPopupMenu popup1 = new JPopupMenu();
ListEditor listEditor = null;
- ComboBoxModel model = new DefaultComboBoxModel();
+ ComboBoxModel<String> model = new DefaultComboBoxModel<String>();
boolean firstTime = true;
public NewCorefAction() {
@@ -1482,10 +1482,10 @@
}
else {
popupWindow.setVisible(false);
- ArrayList<String> set = new
ArrayList<String>(currentSelections.keySet());
+ List<String> set = new ArrayList<String>(currentSelections.keySet());
Collections.sort(set);
set.add(0, "[New Chain]");
- model = new DefaultComboBoxModel(set.toArray());
+ model = new DefaultComboBoxModel<String>(set.toArray(new
String[set.size()]));
list.setModel(model);
listEditor.setItem("");
label.setText("Add \"" + getString(annotToConsiderForChain) +
@@ -1630,7 +1630,7 @@
myList.add(currString);
}
}
- ComboBoxModel model = new DefaultComboBoxModel(myList);
+ ComboBoxModel<String> model = new DefaultComboBoxModel<String>(myList);
list.setModel(model);
myField.setText(startWith);
field = myField.getText();
Modified: gate/trunk/src/main/gate/gui/docview/OntologyClassView.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/OntologyClassView.java 2014-04-17
17:04:10 UTC (rev 17861)
+++ gate/trunk/src/main/gate/gui/docview/OntologyClassView.java 2014-04-17
18:26:57 UTC (rev 17862)
@@ -166,7 +166,7 @@
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.NORTHWEST;
mainPanel.add(new JScrollPane(treesPanel), gbc);
- setComboBox = new JComboBox();
+ setComboBox = new JComboBox<String>();
setComboBox.setEditable(true);
setComboBox.setToolTipText(
"Annotation set where to load/save the annotations");
@@ -182,14 +182,14 @@
annotationSets.add("");
annotationSets.addAll(document.getAnnotationSetNames());
Collections.sort(annotationSets);
- setComboBox.setModel(new DefaultComboBoxModel(
+ setComboBox.setModel(new DefaultComboBoxModel<String>(
new Vector<String>(annotationSets)));
if (isOntologyLoaded) {
// find the first set that contains annotations used before by this view
selectedSet = "";
for (int i = 0; i < setComboBox.getItemCount(); i++) {
- String setName = (String) setComboBox.getItemAt(i);
+ String setName = setComboBox.getItemAt(i);
if (setColorTreeNodesWhenInstancesFound(setName)) {
selectedSet = setName;
break;
@@ -312,7 +312,7 @@
// find the first set that contains annotations used before by this
view
selectedSet = "";
for (int i = 0; i < setComboBox.getItemCount(); i++) {
- String setName = (String) setComboBox.getItemAt(i);
+ String setName = setComboBox.getItemAt(i);
if (setColorTreeNodesWhenInstancesFound(setName)) {
selectedSet = setName;
break;
@@ -1081,7 +1081,7 @@
protected JPanel mainPanel;
protected JLabel messageLabel;
protected JPanel treesPanel;
- protected JComboBox setComboBox;
+ protected JComboBox<String> setComboBox;
// local objects
/** Class that has the lead selection in the focused ontology tree. */
Modified: gate/trunk/src/main/gate/gui/docview/OntologyInstanceView.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/OntologyInstanceView.java
2014-04-17 17:04:10 UTC (rev 17861)
+++ gate/trunk/src/main/gate/gui/docview/OntologyInstanceView.java
2014-04-17 18:26:57 UTC (rev 17862)
@@ -624,14 +624,14 @@
protected class PropertyValueCellEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener {
- private JComboBox valueComboBox;
+ private JComboBox<String> valueComboBox;
private Collator comparator;
private String oldValue;
private Map<String, OInstance> nameInstanceMap;
private Pattern instanceLabelsPattern;
private PropertyValueCellEditor() {
- valueComboBox = new JComboBox();
+ valueComboBox = new JComboBox<String>();
valueComboBox.setMaximumRowCount(10);
valueComboBox.addActionListener(this);
comparator = Collator.getInstance();
@@ -669,7 +669,7 @@
nameInstanceMap.put(instance.getName(), instance);
}
}
- DefaultComboBoxModel dcbm = new DefaultComboBoxModel(ts.toArray());
+ DefaultComboBoxModel<String> dcbm = new
DefaultComboBoxModel<String>(ts.toArray(new String[ts.size()]));
valueComboBox.setModel(dcbm);
valueComboBox.setSelectedItem(propertyTable.getValueAt(row, column));
return valueComboBox;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs