Revision: 17874
          http://sourceforge.net/p/gate/code/17874
Author:   markagreenwood
Date:     2014-04-18 11:19:47 +0000 (Fri, 18 Apr 2014)
Log Message:
-----------
generified JChoice

Modified Paths:
--------------
    gate/trunk/src/main/gate/gui/annedit/SchemaAnnotationEditor.java
    gate/trunk/src/main/gate/gui/annedit/SchemaFeaturesEditor.java
    gate/trunk/src/main/gate/swing/JChoice.java

Modified: gate/trunk/src/main/gate/gui/annedit/SchemaAnnotationEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/annedit/SchemaAnnotationEditor.java    
2014-04-18 11:14:43 UTC (rev 17873)
+++ gate/trunk/src/main/gate/gui/annedit/SchemaAnnotationEditor.java    
2014-04-18 11:19:47 UTC (rev 17874)
@@ -392,7 +392,7 @@
   /**
    * JChoice used for selecting the annotation type.
    */
-  protected JChoice typesChoice;
+  protected JChoice<String> typesChoice;
 
   /**
    * The default border for the types choice
@@ -647,7 +647,7 @@
     Collections.sort(typeList);
     String[] typesArray = new String[typeList.size()];
     typeList.toArray(typesArray);
-    typesChoice = new JChoice(typesArray);
+    typesChoice = new JChoice<String>(typesArray);
     typesChoice.setDefaultButtonMargin(new Insets(0, 2, 0, 2));
     typesChoice.setMaximumFastChoices(20);
     typesChoice.setMaximumWidth(300);

Modified: gate/trunk/src/main/gate/gui/annedit/SchemaFeaturesEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/annedit/SchemaFeaturesEditor.java      
2014-04-18 11:14:43 UTC (rev 17873)
+++ gate/trunk/src/main/gate/gui/annedit/SchemaFeaturesEditor.java      
2014-04-18 11:19:47 UTC (rev 17874)
@@ -168,7 +168,7 @@
       switch(type) {
         case nominal:
           //use JChoice
-          jchoice = new JChoice(values);
+          jchoice = new JChoice<String>(values);
           jchoice.setDefaultButtonMargin(new Insets(0, 2, 0, 2));
           jchoice.setMaximumFastChoices(20);
           jchoice.setMaximumWidth(300);
@@ -179,7 +179,7 @@
         case bool:
           //new implementation -> use JChoice instead of JCheckBox in order
           //to allow "unset" value (i.e. null)
-          jchoice = new JChoice(values);
+          jchoice = new JChoice<String>(values);
           jchoice.setDefaultButtonMargin(new Insets(0, 2, 0, 2));
           jchoice.setMaximumFastChoices(20);
           jchoice.setMaximumWidth(300);
@@ -242,7 +242,7 @@
     
     protected JNullableTextField textField;
     protected JCheckBox checkbox;
-    protected JChoice jchoice;
+    protected JChoice<String> jchoice;
     
     protected Border defaultBorder;
     

Modified: gate/trunk/src/main/gate/swing/JChoice.java
===================================================================
--- gate/trunk/src/main/gate/swing/JChoice.java 2014-04-18 11:14:43 UTC (rev 
17873)
+++ gate/trunk/src/main/gate/swing/JChoice.java 2014-04-18 11:19:47 UTC (rev 
17874)
@@ -47,7 +47,7 @@
  * simple {@link JComboBox} is used instead.
  */
 @SuppressWarnings("serial")
-public class JChoice extends JPanel implements ItemSelectable{
+public class JChoice<E> extends JPanel implements ItemSelectable {
 
   @Override
   public Object[] getSelectedObjects() {
@@ -95,7 +95,7 @@
   /**
    * The combobox used for a large number of choices. 
    */
-  private JComboBox combo;
+  private JComboBox<E> combo;
   
   /**
    * Internal item listener for both the combo and the buttons, used to keep
@@ -106,7 +106,7 @@
   /**
    * The data model used for choices and selection.
    */
-  private ComboBoxModel model;
+  private ComboBoxModel<E> model;
   
   /**
    * Keeps a mapping between the button and the corresponding option from the
@@ -119,7 +119,7 @@
    * Creates a FastChoice with a default empty data model.
    */
   public JChoice() {
-    this(new DefaultComboBoxModel());
+    this(new DefaultComboBoxModel<E>());
   }
   
   /**
@@ -130,7 +130,7 @@
   /**
    * Creates a FastChoice with the given data model.
    */
-  public JChoice(ComboBoxModel model) {
+  public JChoice(ComboBoxModel<E> model) {
     layout = new FlowLayout();
     layout.setHgap(0);
     layout.setVgap(0);
@@ -147,8 +147,8 @@
    * Creates a FastChoice with a default data model populated from the provided
    * array of objects.
    */
-  public JChoice(Object[] items) {
-    this(new DefaultComboBoxModel(items));
+  public JChoice(E[] items) {
+    this(new DefaultComboBoxModel<E>(items));
   }
   
   
@@ -159,7 +159,7 @@
     maximumFastChoices = DEFAULT_MAX_FAST_CHOICES;
     maximumWidth = DEFAULT_MAX_WIDTH;
     listenersMap = new HashMap<EventListener, ListenerWrapper>();
-    combo = new JComboBox(model);
+    combo = new JComboBox<E>(model);
     buttonToValueMap = new HashMap<AbstractButton, Object>();
     sharedItemListener = new ItemListener(){
       /**
@@ -222,7 +222,7 @@
   }
   
   public static void main(String[] args){
-    final JChoice fChoice = new JChoice(new String[]{
+    final JChoice<String> fChoice = new JChoice<String>(new String[]{
             "Jan",
             "Feb",
             "Mar",
@@ -433,14 +433,14 @@
   /**
    * @return the model
    */
-  public ComboBoxModel getModel() {
+  public ComboBoxModel<E> getModel() {
     return model;
   }
 
   /**
    * @param model the model to set
    */
-  public void setModel(ComboBoxModel model) {
+  public void setModel(ComboBoxModel<E> model) {
     this.model = model;
     combo.setModel(model);
     buildGui();

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

Reply via email to