[Schmitzm-commits] r2207 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 31 13:51:30 CET 2013


Author: mojays
Date: 2013-01-31 13:51:30 +0100 (Thu, 31 Jan 2013)
New Revision: 2207

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ListMaintainancePanel.java
Log:
Downward compatibility to Java 1.6

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ListMaintainancePanel.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ListMaintainancePanel.java	2013-01-31 12:43:26 UTC (rev 2206)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ListMaintainancePanel.java	2013-01-31 12:51:30 UTC (rev 2207)
@@ -8,6 +8,7 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
@@ -69,7 +70,8 @@
   public ListMaintainancePanel(final boolean addAction, final boolean removeAction, final boolean editAction, final boolean orderable, List<T> data) {
     super( new BorderLayout() );
 
-    list = new JList<T>( new ListModel<T>() );
+//    list = new JList<T>( new ListModel<T>() ); // TODO: Java 1.7
+    list = new JList( new ListModel<T>() );
     list.addListSelectionListener(this);
     list.addMouseListener( new MouseAdapter() {
       @Override
@@ -127,7 +129,8 @@
   /**
    * Returns the {@link JList}.
    */
-  public JList<T> getList() {
+//  public JList<T> getList() { // TODO: Java 1.7
+  public JList getList() {
     return list;
   }
   
@@ -248,7 +251,8 @@
         removeElement((T)elem);
     }
     if ( "MOVE_UP".equals(actionID) ) {
-      List<T> selectedValues = list.getSelectedValuesList();
+//      List<T> selectedValues = list.getSelectedValuesList(); // TODO: Java 1.7
+      List<T> selectedValues = Arrays.asList((T[])list.getSelectedValues());
       int[] selectedIdx = list.getSelectedIndices();
       int firstIdx = selectedIdx[0];
       int lastIdx  = selectedIdx[selectedIdx.length-1];
@@ -259,7 +263,8 @@
       }
     }
     if ( "MOVE_DOWN".equals(actionID) ) {
-      List<T> selectedValues = list.getSelectedValuesList();
+//      List<T> selectedValues = list.getSelectedValuesList(); // TODO: Java 1.7
+      List<T> selectedValues = Arrays.asList((T[])list.getSelectedValues());
       int[] selectedIdx = list.getSelectedIndices();
       int firstIdx = selectedIdx[0];
       int lastIdx  = selectedIdx[selectedIdx.length-1];



More information about the Schmitzm-commits mailing list