Revision: 17866
http://sourceforge.net/p/gate/code/17866
Author: markagreenwood
Date: 2014-04-18 09:16:19 +0000 (Fri, 18 Apr 2014)
Log Message:
-----------
a few more warnings cleaned up
Modified Paths:
--------------
gate/trunk/src/main/gate/Factory.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneDocument.java
gate/trunk/src/main/gate/gui/GazetteerEditor.java
gate/trunk/src/main/gate/gui/ontology/DatatypePropertyAction.java
gate/trunk/src/main/gate/gui/ontology/DeleteOntologyResourceAction.java
gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
gate/trunk/src/main/gate/gui/ontology/ValuesSelectionAction.java
Modified: gate/trunk/src/main/gate/Factory.java
===================================================================
--- gate/trunk/src/main/gate/Factory.java 2014-04-18 08:45:27 UTC (rev
17865)
+++ gate/trunk/src/main/gate/Factory.java 2014-04-18 09:16:19 UTC (rev
17866)
@@ -825,7 +825,7 @@
public static ParseCpsl newJapeParser(java.io.Reader stream,
Map<String,Object> existingMacros) {
try {
Constructor<? extends ParseCpsl> c = japeParserClass.getConstructor
- (new Class[] {Reader.class, Map.class});
+ (new Class<?>[] {Reader.class, Map.class});
return c.newInstance(new Object[] {stream, existingMacros});
} catch (NoSuchMethodException e) { // Shouldn't happen
throw new RuntimeException(e);
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneDocument.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneDocument.java
2014-04-18 08:45:27 UTC (rev 17865)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneDocument.java
2014-04-18 09:16:19 UTC (rev 17866)
@@ -652,8 +652,9 @@
}
}
- @SuppressWarnings("unchecked")
- List<Token> toReturn[] = new ArrayList[unitOffsetsSet.size()];
+
+ @SuppressWarnings({"cast","unchecked"})
+ List<Token> toReturn[] = (List<Token>[])new List[unitOffsetsSet.size()];
Iterator<OffsetGroup> iter = unitOffsetsSet.iterator();
int counter = 0;
while(iter.hasNext()) {
Modified: gate/trunk/src/main/gate/gui/GazetteerEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/GazetteerEditor.java 2014-04-18 08:45:27 UTC
(rev 17865)
+++ gate/trunk/src/main/gate/gui/GazetteerEditor.java 2014-04-18 09:16:19 UTC
(rev 17866)
@@ -159,7 +159,7 @@
JPanel definitionPanel = new JPanel(new BorderLayout());
JPanel definitionTopPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- newListComboBox = new JComboBox();
+ newListComboBox = new JComboBox<String>();
newListComboBox.setEditable(true);
newListComboBox.setPrototypeDisplayValue("123456789012345");
newListComboBox.setToolTipText(
@@ -840,7 +840,7 @@
filenames[i++] = file.getName();
}
Arrays.sort(filenames, collator);
- newListComboBox.setModel(new DefaultComboBoxModel(filenames));
+ newListComboBox.setModel(new DefaultComboBoxModel<String>(filenames));
if (filenames.length == 0) {
newListButton.setEnabled(false);
}
@@ -1348,7 +1348,7 @@
protected DefaultTableModel definitionTableModel;
protected XJTable listTable;
protected ListTableModel listTableModel;
- protected JComboBox newListComboBox;
+ protected JComboBox<String> newListComboBox;
protected JButton newListButton;
protected JButton addColumnsButton;
protected JTextField listEntryTextField;
Modified: gate/trunk/src/main/gate/gui/ontology/DatatypePropertyAction.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/DatatypePropertyAction.java
2014-04-18 08:45:27 UTC (rev 17865)
+++ gate/trunk/src/main/gate/gui/ontology/DatatypePropertyAction.java
2014-04-18 09:16:19 UTC (rev 17866)
@@ -59,7 +59,7 @@
gbc.gridy = 1;
mainPanel.add(new JLabel("Data Type:"), gbc);
- mainPanel.add(datatypesComboBox = new JComboBox(), gbc);
+ mainPanel.add(datatypesComboBox = new JComboBox<String>(), gbc);
mainPanel.add(datatypesComboBox, gbc);
gbc.gridy = 2;
@@ -67,7 +67,7 @@
mainPanel.add(propertyName = new JTextField(30), gbc);
mainPanel.add(domainButton = new JButton("Domain"), gbc);
- datatypesComboBox.setModel(new DefaultComboBoxModel(new String[] {
+ datatypesComboBox.setModel(new DefaultComboBoxModel<String>(new String[] {
"http://www.w3.org/2001/XMLSchema#boolean",
"http://www.w3.org/2001/XMLSchema#byte",
"http://www.w3.org/2001/XMLSchema#date",
@@ -186,7 +186,7 @@
protected JPanel mainPanel;
protected JTextField nameSpace;
- protected JComboBox datatypesComboBox;
+ protected JComboBox<String> datatypesComboBox;
protected JButton domainButton;
protected JTextField propertyName;
protected ValuesSelectionAction domainAction;
Modified:
gate/trunk/src/main/gate/gui/ontology/DeleteOntologyResourceAction.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/DeleteOntologyResourceAction.java
2014-04-18 08:45:27 UTC (rev 17865)
+++ gate/trunk/src/main/gate/gui/ontology/DeleteOntologyResourceAction.java
2014-04-18 09:16:19 UTC (rev 17866)
@@ -47,10 +47,10 @@
String[] resourcesToDelete = new String[selectedNodes.size()];
int i = 0;
for (DefaultMutableTreeNode node : selectedNodes) {
- Object object = ((OResourceNode) node.getUserObject()).getResource();
- resourcesToDelete[i++] = ((OResource) object).getONodeID().toString();
+ OResource object = ((OResourceNode) node.getUserObject()).getResource();
+ resourcesToDelete[i++] = object.getONodeID().toString();
}
- JList list = new JList(resourcesToDelete);
+ JList<String> list = new JList<String>(resourcesToDelete);
int choice = JOptionPane.showOptionDialog(MainFrame.getInstance(),
new Object[]{"Are you sure you want to delete the following resources?",
"\n\n", new JScrollPane(list), '\n'}, "Delete resources",
Modified: gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
2014-04-18 08:45:27 UTC (rev 17865)
+++ gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
2014-04-18 09:16:19 UTC (rev 17866)
@@ -13,6 +13,10 @@
import gate.creole.ontology.Ontology;
import gate.creole.ontology.RDFProperty;
+/**
+ * An empty impl of RDFProperty that can be used as a prototype in a JComboBox
etc.
+ * @author Mark A. Greenwood
+ */
@SuppressWarnings("deprecation")
class RDFPropertyPrototype implements RDFProperty {
Modified: gate/trunk/src/main/gate/gui/ontology/ValuesSelectionAction.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/ValuesSelectionAction.java
2014-04-18 08:45:27 UTC (rev 17865)
+++ gate/trunk/src/main/gate/gui/ontology/ValuesSelectionAction.java
2014-04-18 09:16:19 UTC (rev 17866)
@@ -25,15 +25,25 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import javax.swing.*;
+import java.util.List;
+
+import javax.swing.BoxLayout;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
import javax.swing.text.JTextComponent;
public class ValuesSelectionAction {
public ValuesSelectionAction() {
list = null;
- domainBox = new JComboBox();
+ domainBox = new JComboBox<String>();
domainBox.setEditable(true);
- list = new JList(new DefaultComboBoxModel());
+ list = new JList<String>(new DefaultComboBoxModel<String>());
list.setVisibleRowCount(7);
add = new JButton("Add");
remove = new JButton("Remove");
@@ -49,7 +59,7 @@
.getText();
if(s != null) {
if(keyevent.getKeyCode() != KeyEvent.VK_ENTER) {
- ArrayList<String> arraylist = new ArrayList<String>();
+ List<String> arraylist = new ArrayList<String>();
for(int i = 0; i < ontologyClasses.length; i++) {
String s1 = ontologyClasses[i];
if(s1.toLowerCase().startsWith(s.toLowerCase())) {
@@ -57,8 +67,8 @@
}
}
Collections.sort(arraylist);
- DefaultComboBoxModel model =
- new DefaultComboBoxModel(arraylist.toArray());
+ DefaultComboBoxModel<String> model =
+ new DefaultComboBoxModel<String>(arraylist.toArray(new
String[arraylist.size()]));
domainBox.setModel(model);
if(!arraylist.isEmpty()) domainBox.showPopup();
}
@@ -83,22 +93,22 @@
return;
}
}
- if(((DefaultComboBoxModel)list.getModel()).getIndexOf(s) != -1) {
+ if(((DefaultComboBoxModel<String>)list.getModel()).getIndexOf(s) !=
-1) {
JOptionPane.showMessageDialog(MainFrame.getInstance(),
"Already added!");
}
else {
- ((DefaultComboBoxModel)list.getModel()).addElement(s);
+ ((DefaultComboBoxModel<String>)list.getModel()).addElement(s);
}
}
});
remove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionevent) {
- Object aobj[] = list.getSelectedValues();
- if(aobj != null && aobj.length > 0) {
- for(int i = 0; i < aobj.length; i++)
- ((DefaultComboBoxModel)list.getModel()).removeElement(aobj[i]);
+ List<String> aobj = list.getSelectedValuesList();
+ if(aobj != null && aobj.size() > 0) {
+ for(int i = 0; i < aobj.size(); i++)
+
((DefaultComboBoxModel<String>)list.getModel()).removeElement(aobj.get(i));
}
}
});
@@ -120,8 +130,8 @@
Icon icon) {
this.ontologyClasses = inDropDownList;
this.allowValueOutsideDropDownList = allowValueOutsideDropDownList;
- domainBox.setModel(new DefaultComboBoxModel(inDropDownList));
- list.setModel(new DefaultComboBoxModel(alreadySelected));
+ domainBox.setModel(new DefaultComboBoxModel<String>(inDropDownList));
+ list.setModel(new DefaultComboBoxModel<String>(alreadySelected));
@SuppressWarnings("serial")
JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION, icon) {
@@ -137,15 +147,15 @@
}
public String[] getSelectedValues() {
- DefaultComboBoxModel model = (DefaultComboBoxModel) list.getModel();
+ DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>)
list.getModel();
String as[] = new String[model.getSize()];
for(int i = 0; i < as.length; i++)
- as[i] = (String) model.getElementAt(i);
+ as[i] = model.getElementAt(i);
return as;
}
- protected JComboBox domainBox;
- protected JList list;
+ protected JComboBox<String> domainBox;
+ protected JList<String> list;
protected JButton add;
protected JButton remove;
protected JPanel panel;
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