Revision: 17865
http://sourceforge.net/p/gate/code/17865
Author: markagreenwood
Date: 2014-04-18 08:45:27 +0000 (Fri, 18 Apr 2014)
Log Message:
-----------
a bunch more java 7 generics warnings dealt with
Modified Paths:
--------------
gate/trunk/src/main/gate/gui/LuceneDataStoreSearchGUI.java
gate/trunk/src/main/gate/gui/ResourceRenderer.java
gate/trunk/src/main/gate/gui/SerialControllerEditor.java
gate/trunk/src/main/gate/gui/ontology/RestrictionAction.java
gate/trunk/src/main/gate/gui/ontology/SearchAction.java
gate/trunk/src/main/gate/gui/teamware/AnnotationSetNameCellRenderer.java
gate/trunk/src/main/gate/gui/teamware/InputOutputAnnotationSetsDialog.java
gate/trunk/src/main/gate/swing/JFontChooser.java
Added Paths:
-----------
gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
Modified: gate/trunk/src/main/gate/gui/LuceneDataStoreSearchGUI.java
===================================================================
--- gate/trunk/src/main/gate/gui/LuceneDataStoreSearchGUI.java 2014-04-18
07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/LuceneDataStoreSearchGUI.java 2014-04-18
08:45:27 UTC (rev 17865)
@@ -207,9 +207,9 @@
/** Text Area that contains the query */
private QueryTextArea queryTextArea;
- private JComboBox corpusToSearchIn;
+ private JComboBox<String> corpusToSearchIn;
- private JComboBox annotationSetsToSearchIn;
+ private JComboBox<String> annotationSetsToSearchIn;
/** list of IDs available in datastore */
private List<Object> corpusIds;
@@ -443,7 +443,7 @@
// second column, first row
gbc.gridx = GridBagConstraints.RELATIVE;
topPanel.add(new JLabel("Corpus: "), gbc);
- corpusToSearchIn = new JComboBox();
+ corpusToSearchIn = new JComboBox<String>();
corpusToSearchIn.addItem(Constants.ENTIRE_DATASTORE);
corpusToSearchIn.setPrototypeDisplayValue(Constants.ENTIRE_DATASTORE);
corpusToSearchIn.setToolTipText("Select the corpus to search in.");
@@ -464,7 +464,7 @@
topPanel.add(corpusToSearchIn, gbc);
topPanel.add(Box.createHorizontalStrut(4), gbc);
topPanel.add(new JLabel("Annotation set: "), gbc);
- annotationSetsToSearchIn = new JComboBox();
+ annotationSetsToSearchIn = new JComboBox<String>();
annotationSetsToSearchIn.setPrototypeDisplayValue(Constants.COMBINED_SET);
annotationSetsToSearchIn
.setToolTipText("Select the annotation set to search in.");
@@ -1393,7 +1393,7 @@
.get(corpusToSearchIn.getSelectedIndex() - 1);
TreeSet<String> ts = new TreeSet<String>(stringCollator);
ts.addAll(getAnnotationSetNames(corpusName));
- DefaultComboBoxModel dcbm = new DefaultComboBoxModel(ts.toArray());
+ DefaultComboBoxModel<String> dcbm = new
DefaultComboBoxModel<String>(ts.toArray(new String[ts.size()]));
dcbm.insertElementAt(Constants.ALL_SETS, 0);
annotationSetsToSearchIn.setModel(dcbm);
annotationSetsToSearchIn.setSelectedItem(Constants.ALL_SETS);
@@ -1404,9 +1404,9 @@
types.addAll(getTypesAndFeatures(null, null).keySet());
// put all annotation types from the datastore
// combobox used as cell editor
- JComboBox annotTypesBox = new JComboBox();
+ JComboBox<String> annotTypesBox = new JComboBox<String>();
annotTypesBox.setMaximumRowCount(10);
- annotTypesBox.setModel(new DefaultComboBoxModel(types.toArray()));
+ annotTypesBox.setModel(new DefaultComboBoxModel<String>(types.toArray(new
String[types.size()])));
DefaultCellEditor cellEditor = new DefaultCellEditor(annotTypesBox);
cellEditor.setClickCountToStart(0);
configureStackViewFrame.getTable().getColumnModel()
@@ -2580,7 +2580,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);
@@ -2588,7 +2588,7 @@
@Override
public void mouseClicked(MouseEvent e) {
if(e.getClickCount() == 1) {
- String newFeature = (String)list.getSelectedValue();
+ String newFeature = list.getSelectedValue();
if(newFeature.equals(" ")) {
newFeature = "";
}
@@ -3348,7 +3348,7 @@
// combobox used as cell editor
String[] s = {"Crop middle", "Crop start", "Crop end"};
- JComboBox cropBox = new JComboBox(s);
+ JComboBox<String> cropBox = new JComboBox<String>(s);
// set the cell renderer and/or editor for each column
@@ -3434,17 +3434,17 @@
Object color, boolean isSelected, boolean hasFocus,
int row, int col) {
String[] s = {stackRows[row][ANNOTATION_TYPE]};
- return new JComboBox(s);
+ return new JComboBox<String>(s);
}
});
final class FeatureCellEditor extends AbstractCellEditor implements
TableCellEditor,
ActionListener {
- private JComboBox featuresBox;
+ private JComboBox<String> featuresBox;
public FeatureCellEditor() {
- featuresBox = new JComboBox();
+ featuresBox = new JComboBox<String>();
featuresBox.setMaximumRowCount(10);
featuresBox.addActionListener(this);
}
@@ -3472,7 +3472,7 @@
.get(configureStackViewTable.getValueAt(row,
ANNOTATION_TYPE)));
}
- DefaultComboBoxModel dcbm = new DefaultComboBoxModel(ts.toArray());
+ DefaultComboBoxModel<String> dcbm = new
DefaultComboBoxModel<String>(ts.toArray(new String[ts.size()]));
dcbm.insertElementAt("", 0);
featuresBox.setModel(dcbm);
featuresBox.setSelectedItem(ts
@@ -3492,7 +3492,7 @@
Object color, boolean isSelected, boolean hasFocus,
int row, int col) {
String[] s = {stackRows[row][FEATURE]};
- return new JComboBox(s);
+ return new JComboBox<String>(s);
}
});
@@ -3507,7 +3507,7 @@
Object color, boolean isSelected, boolean hasFocus,
int row, int col) {
String[] s = {stackRows[row][CROP]};
- return new JComboBox(s);
+ return new JComboBox<String>(s);
}
});
@@ -3822,9 +3822,9 @@
private static final String PREVIOUS_RESULT = "previous result";
- protected DefaultListModel queryListModel;
+ protected DefaultListModel<String> queryListModel;
- protected JList queryList;
+ protected JList<String> queryList;
protected JWindow queryPopupWindow;
@@ -3899,8 +3899,8 @@
am.put(PREVIOUS_RESULT, new PreviousResultAction());
// list for autocompletion
- queryListModel = new DefaultListModel();
- queryList = new JList(queryListModel);
+ queryListModel = new DefaultListModel<String>();
+ queryList = new JList<String>(queryListModel);
queryList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
queryList.setBackground(Color.WHITE);
queryList.addMouseListener(new MouseAdapter() {
@@ -4004,7 +4004,7 @@
}
for(int i = 0; i < queryList.getModel().getSize(); i++) {
if(startsWithIgnoreCase(
- ((String)queryList.getModel().getElementAt(i)), type)) {
+ queryList.getModel().getElementAt(i), type)) {
queryPopupWindow.setVisible(true);
queryList.setSelectedIndex((i));
queryList.ensureIndexIsVisible(i);
@@ -4019,7 +4019,7 @@
}
for(int i = 0; i < queryList.getModel().getSize(); i++) {
if(startsWithIgnoreCase(
- ((String)queryList.getModel().getElementAt(i)), feature)) {
+ queryList.getModel().getElementAt(i), feature)) {
queryPopupWindow.setVisible(true);
queryList.setSelectedIndex((i));
queryList.ensureIndexIsVisible(i);
@@ -4071,7 +4071,7 @@
if(type.matches("[a-zA-Z0-9]+")) {
for(int i = 0; i < queryList.getModel().getSize(); i++) {
if(startsWithIgnoreCase(
- ((String)queryList.getModel().getElementAt(i)), type)) {
+ queryList.getModel().getElementAt(i), type)) {
queryPopupWindow.setVisible(true);
queryList.setSelectedIndex(i);
queryList.ensureIndexIsVisible(i);
@@ -4091,7 +4091,7 @@
if(feature.matches("[a-zA-Z0-9]+")) {
for(int i = 0; i < queryList.getModel().getSize(); i++) {
if(startsWithIgnoreCase(
- ((String)queryList.getModel().getElementAt(i)), feature)) {
+ queryList.getModel().getElementAt(i), feature)) {
queryPopupWindow.setVisible(true);
queryList.setSelectedIndex(i);
queryList.ensureIndexIsVisible(i);
@@ -4205,7 +4205,7 @@
private class EnterAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent ev) {
- String selection = (String)queryList.getSelectedValue();
+ String selection = queryList.getSelectedValue();
if(mode == POPUP_TYPES) {
if(selection == null) {
return;
@@ -4486,7 +4486,7 @@
String name = ((LuceneDataStoreImpl)target).getLrName(corpusPId);
this.corpusIds.add(corpusPId);
// add the corpus name to combobox
- ((DefaultComboBoxModel)corpusToSearchIn.getModel())
+ ((DefaultComboBoxModel<String>)corpusToSearchIn.getModel())
.addElement(name);
}
}
@@ -4552,7 +4552,7 @@
index++;
// now lets remove it from the comboBox as well
- ((DefaultComboBoxModel)corpusToSearchIn.getModel())
+ ((DefaultComboBoxModel<String>)corpusToSearchIn.getModel())
.removeElementAt(index);
}
// Added a refresh button which user should click to refresh types
@@ -4571,7 +4571,7 @@
if(!corpusIds.contains(id)) {
// we need to add its name to the combobox
corpusIds.add(id);
- ((DefaultComboBoxModel)corpusToSearchIn.getModel()).addElement(resource
+
((DefaultComboBoxModel<String>)corpusToSearchIn.getModel()).addElement(resource
.getName());
}
}
Modified: gate/trunk/src/main/gate/gui/ResourceRenderer.java
===================================================================
--- gate/trunk/src/main/gate/gui/ResourceRenderer.java 2014-04-18 07:12:27 UTC
(rev 17864)
+++ gate/trunk/src/main/gate/gui/ResourceRenderer.java 2014-04-18 08:45:27 UTC
(rev 17865)
@@ -33,7 +33,7 @@
* the rendered string and the type of the resource as the tooltip.
*/
@SuppressWarnings("serial")
-public class ResourceRenderer extends JLabel implements ListCellRenderer,
+public class ResourceRenderer extends JLabel implements
ListCellRenderer<Resource>,
TableCellRenderer,
TreeCellRenderer {
public ResourceRenderer() {
@@ -41,7 +41,7 @@
}
@Override
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<? extends Resource>
list, Resource value,
int index, boolean isSelected, boolean cellHasFocus) {
prepareRendererList(list, value, isSelected, hasFocus());
return this;
@@ -100,7 +100,7 @@
prepareRendererCommon(table, value, isSelected, hasFocus);
}
- private void prepareRendererList(JList list, Object value,
+ private void prepareRendererList(JList<? extends Resource> list, Resource
value,
boolean isSelected, boolean hasFocus) {
if(isSelected) {
setForeground(list.getSelectionForeground());
Modified: gate/trunk/src/main/gate/gui/SerialControllerEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/SerialControllerEditor.java 2014-04-18
07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/SerialControllerEditor.java 2014-04-18
08:45:27 UTC (rev 17865)
@@ -405,7 +405,7 @@
if(corpusControllerMode){
//we need to add the corpus combo
- corpusCombo = new JComboBox(corpusComboModel = new CorporaComboModel());
+ corpusCombo = new JComboBox<Resource>(corpusComboModel = new
CorporaComboModel());
corpusCombo.setRenderer(new ResourceRenderer());
corpusCombo.setMaximumSize(new Dimension(Integer.MAX_VALUE,
corpusCombo.getPreferredSize().
Added: gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
(rev 0)
+++ gate/trunk/src/main/gate/gui/ontology/RDFPropertyPrototype.java
2014-04-18 08:45:27 UTC (rev 17865)
@@ -0,0 +1,285 @@
+package gate.gui.ontology;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import gate.creole.ontology.AnnotationProperty;
+import gate.creole.ontology.Literal;
+import gate.creole.ontology.OConstants.Closure;
+import gate.creole.ontology.ONodeID;
+import gate.creole.ontology.OResource;
+import gate.creole.ontology.OURI;
+import gate.creole.ontology.Ontology;
+import gate.creole.ontology.RDFProperty;
+
+@SuppressWarnings("deprecation")
+class RDFPropertyPrototype implements RDFProperty {
+
+ String prototype;
+
+ public RDFPropertyPrototype(String prototype) {
+ this.prototype = prototype;
+ }
+
+ @Override
+ public gate.creole.ontology.URI getURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ONodeID getONodeID() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setURI(gate.creole.ontology.URI uri) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Set<Literal> getLabels() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<Literal> getComments() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getComment(Locale language) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setComment(String aComment, Locale Locale) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getLabel(Locale language) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setLabel(String aLabel, Locale language) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getName() {
+ return prototype;
+ }
+
+ @Override
+ public Ontology getOntology() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addAnnotationPropertyValue(
+ AnnotationProperty theAnnotationProperty, Literal literal) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<Literal> getAnnotationPropertyValues(
+ AnnotationProperty theAnnotationProperty) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<AnnotationProperty> getSetAnnotationProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<RDFProperty> getAllSetProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<RDFProperty> getPropertiesWithResourceAsDomain() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<RDFProperty> getPropertiesWithResourceAsRange() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasAnnotationPropertyWithValue(AnnotationProperty aProperty,
+ Literal aValue) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void removeAnnotationPropertyValue(
+ AnnotationProperty theAnnotationProperty, Literal literal) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAnnotationPropertyValues(AnnotationProperty theProperty) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setEquivalentPropertyAs(RDFProperty theProperty) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Set<RDFProperty> getEquivalentPropertyAs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isEquivalentPropertyAs(RDFProperty theProperty) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Set<RDFProperty> getSuperProperties(byte closure) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<RDFProperty> getSuperProperties(Closure closure) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isSuperPropertyOf(RDFProperty theProperty, byte closure) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSuperPropertyOf(RDFProperty theProperty, Closure closure) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void addSubProperty(RDFProperty property) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeSubProperty(RDFProperty property) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Set<RDFProperty> getSubProperties(byte closure) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<RDFProperty> getSubProperties(Closure closure) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isSubPropertyOf(RDFProperty theProperty, byte closure) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSubPropertyOf(RDFProperty theProperty, Closure closure) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isFunctional() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setFunctional(boolean functional) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isInverseFunctional() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setInverseFunctional(boolean inverseFunctional) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isValidRange(OResource aResource) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isValidDomain(OResource aResource) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Set<OResource> getDomain() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<OResource> getRange() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public OURI getOURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return prototype;
+ }
+
+}
Modified: gate/trunk/src/main/gate/gui/ontology/RestrictionAction.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/RestrictionAction.java
2014-04-18 07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/ontology/RestrictionAction.java
2014-04-18 08:45:27 UTC (rev 17865)
@@ -69,9 +69,8 @@
middlePanel = new JPanel(new FlowLayout());
middlePanel.setBorder(new TitledBorder("On Property"));
- onPropertyChoice = new JComboBox(new DefaultComboBoxModel());
- onPropertyChoice.setPrototypeDisplayValue(new String(
- "http://www.dcs.shef.ac.uk/owlim#SomeObjectProperty"));
+ onPropertyChoice = new JComboBox<RDFProperty>(new
DefaultComboBoxModel<RDFProperty>());
+ onPropertyChoice.setPrototypeDisplayValue(new
RDFPropertyPrototype("http://www.dcs.shef.ac.uk/owlim#SomeObjectProperty"));
middlePanel.add(onPropertyChoice);
bottomPanel = new JPanel(new GridLayout(2, 1));
@@ -82,9 +81,8 @@
hasValuePanel = new JPanel(new FlowLayout());
hasValuePanel.setBorder(new TitledBorder("Has Value"));
- hasValChoice = new JComboBox(new DefaultComboBoxModel());
- hasValChoice.setPrototypeDisplayValue(new String(
- "http://www.dcs.shef.ac.uk/owlim#SomeObjectProperty"));
+ hasValChoice = new JComboBox<OResource>(new
DefaultComboBoxModel<OResource>());
+ hasValChoice.setPrototypeDisplayValue(new
RDFPropertyPrototype("http://www.dcs.shef.ac.uk/owlim#SomeObjectProperty"));
hasValuePanel.add(hasValChoice);
bottomPanel.add(valuePanel);
bottomPanel.add(hasValuePanel);
@@ -104,13 +102,13 @@
props.addAll(ontology.getObjectProperties());
props.addAll(ontology.getDatatypeProperties());
Collections.sort(props, new OntologyItemComparator());
- DefaultComboBoxModel dcbm = new DefaultComboBoxModel(props.toArray());
+ DefaultComboBoxModel<RDFProperty> dcbm = new
DefaultComboBoxModel<RDFProperty>(props.toArray(new RDFProperty[props.size()]));
onPropertyChoice.setModel(dcbm);
ArrayList<OResource> classes = new ArrayList<OResource>();
classes.addAll(ontology.getOClasses(false));
Collections.sort(classes, new OntologyItemComparator());
- DefaultComboBoxModel dcbm1 = new DefaultComboBoxModel(classes.toArray());
+ DefaultComboBoxModel<OResource> dcbm1 = new
DefaultComboBoxModel<OResource>(classes.toArray(new OResource[classes.size()]));
hasValChoice.setModel(dcbm1);
int i = JOptionPane.showOptionDialog(MainFrame.getInstance(), mainPanel,
@@ -175,7 +173,7 @@
protected JPanel middlePanel;
- protected JComboBox onPropertyChoice;
+ protected JComboBox<RDFProperty> onPropertyChoice;
protected JPanel bottomPanel;
@@ -183,7 +181,7 @@
protected JTextField value;
- protected JComboBox hasValChoice;
+ protected JComboBox<OResource> hasValChoice;
protected Ontology ontology;
Modified: gate/trunk/src/main/gate/gui/ontology/SearchAction.java
===================================================================
--- gate/trunk/src/main/gate/gui/ontology/SearchAction.java 2014-04-18
07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/ontology/SearchAction.java 2014-04-18
08:45:27 UTC (rev 17865)
@@ -14,11 +14,9 @@
import gate.gui.MainFrame;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
-
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@@ -28,7 +26,17 @@
import java.util.List;
import java.util.Set;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+import javax.swing.BoxLayout;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.Icon;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
import javax.swing.text.JTextComponent;
import javax.swing.tree.TreePath;
@@ -60,10 +68,9 @@
JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
panel1.add(new JLabel("Find what: "));
- resourcesBox = new JComboBox();
+ resourcesBox = new JComboBox<OResource>();
resourcesBox.setRenderer(new ComboRenderer());
- resourcesBox
- .setPrototypeDisplayValue("this is just an example, not a value.
OK?");
+ resourcesBox.setPrototypeDisplayValue(new RDFPropertyPrototype("this is
just an example, not a value. OK?"));
resourcesBox.setEditable(true);
resourcesBox.setEditable(true);
@@ -105,8 +112,8 @@
List<OResource> setList = new ArrayList<OResource>(set);
Collections.sort(setList, new OntologyItemComparator());
- DefaultComboBoxModel defaultcomboboxmodel = new
DefaultComboBoxModel(
- setList.toArray());
+ DefaultComboBoxModel<OResource> defaultcomboboxmodel = new
DefaultComboBoxModel<OResource>(
+ setList.toArray(new OResource[setList.size()]));
resourcesBox.setModel(defaultcomboboxmodel);
@@ -122,11 +129,10 @@
}
});
panel1.add(resourcesBox);
- properties = new JComboBox();
+ properties = new JComboBox<RDFProperty>();
properties.setRenderer(new ComboRenderer());
properties.setEditable(true);
- properties
- .setPrototypeDisplayValue("this is just an example, not a value.
OK?");
+ properties.setPrototypeDisplayValue(new RDFPropertyPrototype("this is just
an example, not a value. OK?"));
properties.getEditor().getEditorComponent().addKeyListener(
new KeyAdapter() {
@Override
@@ -135,7 +141,7 @@
.getEditorComponent()).getText();
if(s != null) {
if(keyevent.getKeyCode() != KeyEvent.VK_ENTER) {
- ArrayList<OResource> arraylist = new
ArrayList<OResource>();
+ ArrayList<RDFProperty> arraylist = new
ArrayList<RDFProperty>();
for(int i = 0; i < propertiesArray.length; i++) {
String s1 = propertiesArray[i].getName();
if(s1.toLowerCase().startsWith(s.toLowerCase())) {
@@ -143,8 +149,8 @@
}
}
Collections.sort(arraylist, new OntologyItemComparator());
- DefaultComboBoxModel defaultcomboboxmodel = new
DefaultComboBoxModel(
- arraylist.toArray());
+ DefaultComboBoxModel<RDFProperty> defaultcomboboxmodel =
new DefaultComboBoxModel<RDFProperty>(
+ arraylist.toArray(new
RDFProperty[arraylist.size()]));
properties.setModel(defaultcomboboxmodel);
try {
@@ -182,8 +188,8 @@
resourcesArray = new OResource[resources.size()];
resourcesArray = resources.toArray(resourcesArray);
- DefaultComboBoxModel defaultcomboboxmodel = new DefaultComboBoxModel(
- resources.toArray());
+ DefaultComboBoxModel<OResource> defaultcomboboxmodel = new
DefaultComboBoxModel<OResource>(
+ resources.toArray(new OResource[resources.size()]));
resourcesBox.setModel(defaultcomboboxmodel);
Set<RDFProperty> props = ontologyEditor.ontology.getRDFProperties();
@@ -194,8 +200,8 @@
propertiesArray = new RDFProperty[props.size()];
propertiesArray = props.toArray(propertiesArray);
- DefaultComboBoxModel defaultcomboboxmodel1 = new DefaultComboBoxModel(
- propsList.toArray());
+ DefaultComboBoxModel<RDFProperty> defaultcomboboxmodel1 = new
DefaultComboBoxModel<RDFProperty>(
+ propsList.toArray(new RDFProperty[propsList.size()]));
properties.setModel(defaultcomboboxmodel1);
resources = null;
@@ -237,7 +243,7 @@
* Box to show the filtered resources based on the user's input in the
* find what box.
*/
- protected JComboBox resourcesBox;
+ protected JComboBox<OResource> resourcesBox;
/**
* main guiPanel that holds the search gui components.
@@ -266,7 +272,7 @@
/**
* combobox that holds the filtered properties based on user's input.
*/
- protected JComboBox properties;
+ protected JComboBox<RDFProperty> properties;
/**
* Indicates if the search function should search for the find what
@@ -280,7 +286,7 @@
* @author Niraj Aswani
* @version 1.0
*/
- public class ComboRenderer extends JPanel implements ListCellRenderer {
+ public class ComboRenderer extends JPanel implements
ListCellRenderer<OResource> {
/**
* Class label is shown using this label
@@ -315,17 +321,17 @@
* Renderer method
*/
@Override
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<? extends OResource>
list, OResource value,
int row, boolean isSelected, boolean hasFocus) {
- if (!(value instanceof OResource)) {
+ /*if (!(value instanceof OResource)) {
label.setBackground(Color.white);
return this;
- }
+ }*/
javax.swing.Icon icon = null;
- String conceptName = ((OResource) value).getName();
+ String conceptName = value.getName();
iconLabel.setVisible(true);
if(value instanceof Restriction) {
icon = MainFrame.getIcon("ontology-restriction");
Modified:
gate/trunk/src/main/gate/gui/teamware/AnnotationSetNameCellRenderer.java
===================================================================
--- gate/trunk/src/main/gate/gui/teamware/AnnotationSetNameCellRenderer.java
2014-04-18 07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/teamware/AnnotationSetNameCellRenderer.java
2014-04-18 08:45:27 UTC (rev 17865)
@@ -21,7 +21,7 @@
}
@Override
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Font font = defaultFont;
if(value == null) {
Modified:
gate/trunk/src/main/gate/gui/teamware/InputOutputAnnotationSetsDialog.java
===================================================================
--- gate/trunk/src/main/gate/gui/teamware/InputOutputAnnotationSetsDialog.java
2014-04-18 07:12:27 UTC (rev 17864)
+++ gate/trunk/src/main/gate/gui/teamware/InputOutputAnnotationSetsDialog.java
2014-04-18 08:45:27 UTC (rev 17865)
@@ -115,12 +115,12 @@
if(selectedOption == JOptionPane.OK_OPTION) {
inputSetNames.clear();
for(int i = 0; i < inputList.listModel.size(); i++) {
- inputSetNames.add((String)inputList.listModel.get(i));
+ inputSetNames.add(inputList.listModel.get(i));
}
outputSetNames.clear();
for(int i = 0; i < outputList.listModel.size(); i++) {
- outputSetNames.add((String)outputList.listModel.get(i));
+ outputSetNames.add(outputList.listModel.get(i));
}
return true;
@@ -136,11 +136,11 @@
*/
@SuppressWarnings("serial")
class AnnotationSetsList extends JPanel {
- private JList annotationSetsList;
+ private JList<String> annotationSetsList;
- private DefaultListModel listModel;
+ private DefaultListModel<String> listModel;
- private JComboBox combo;
+ private JComboBox<String> combo;
private JButton addButton;
@@ -162,7 +162,7 @@
// find where to insert
int index = 0;
while(index < listModel.size()
- && NATURAL_COMPARATOR.compare((String)listModel.get(index),
+ && NATURAL_COMPARATOR.compare(listModel.get(index),
selected) < 0) {
index++;
}
@@ -172,7 +172,7 @@
}
else {
// add if the value is not already present
- if(NATURAL_COMPARATOR.compare((String)listModel.get(index),
selected) != 0) {
+ if(NATURAL_COMPARATOR.compare(listModel.get(index), selected) != 0) {
listModel.add(index, selected);
}
}
@@ -211,7 +211,7 @@
String[] hintSetNamesArray = hintSetNames.toArray(new String[hintSetNames
.size()]);
Arrays.sort(hintSetNamesArray, NATURAL_COMPARATOR);
- combo = new JComboBox(hintSetNamesArray);
+ combo = new JComboBox<String>(hintSetNamesArray);
combo.setEditable(true);
// custom editor to handle the default annotation set.
combo.setEditor(new AnnotationSetNameComboEditor(combo.getEditor()));
@@ -237,7 +237,7 @@
add(buttonsBox, c);
- listModel = new DefaultListModel();
+ listModel = new DefaultListModel<String>();
String[] initialSetNamesArray = initialSetNames
.toArray(new String[initialSetNames.size()]);
Arrays.sort(initialSetNamesArray, NATURAL_COMPARATOR);
@@ -245,7 +245,7 @@
listModel.addElement(name);
}
- annotationSetsList = new JList(listModel);
+ annotationSetsList = new JList<String>(listModel);
// set up list cell renderer
annotationSetsList.setCellRenderer(new AnnotationSetNameCellRenderer());
Modified: gate/trunk/src/main/gate/swing/JFontChooser.java
===================================================================
--- gate/trunk/src/main/gate/swing/JFontChooser.java 2014-04-18 07:12:27 UTC
(rev 17864)
+++ gate/trunk/src/main/gate/swing/JFontChooser.java 2014-04-18 08:45:27 UTC
(rev 17865)
@@ -120,13 +120,13 @@
protected void initGuiComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
- familyCombo = new JComboBox(
+ familyCombo = new JComboBox<String>(
GraphicsEnvironment.getLocalGraphicsEnvironment().
getAvailableFontFamilyNames()
);
familyCombo.setSelectedItem(UIManager.getFont("Label.font").getFamily());
- sizeCombo = new JComboBox(new String[]{"6", "8", "10", "12", "14", "16",
+ sizeCombo = new JComboBox<String>(new String[]{"6", "8", "10", "12", "14",
"16",
"18", "20", "22", "24", "26"});
sizeCombo.setSelectedItem(new Integer(
UIManager.getFont("Label.font").getSize()).toString());
@@ -252,10 +252,10 @@
return fontValue;
}
- JComboBox familyCombo;
+ JComboBox<String> familyCombo;
JCheckBox italicChk;
JCheckBox boldChk;
- JComboBox sizeCombo;
+ JComboBox<String> sizeCombo;
JTextArea sampleTextArea;
private java.awt.Font fontValue;
}// class JFontChooser extends JPanel
\ No newline at end of file
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