Revision: 5851
          http://sourceforge.net/p/jump-pilot/code/5851
Author:   ma15569
Date:     2018-06-06 12:09:44 +0000 (Wed, 06 Jun 2018)
Log Message:
-----------
added a generic method to load a collection of layerable into a JComboBox, with 
layer renderer

Modified Paths:
--------------
    
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
   2018-06-06 11:43:34 UTC (rev 5850)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
   2018-06-06 12:09:44 UTC (rev 5851)
@@ -1143,4 +1143,33 @@
         }
         return null;
     }
+
+    /**
+     * generic method to load collection of layerable into JComboBox with
+     * renderer of layerable (layer icon)
+     * 
+     * @param fieldName
+     *            field name of the control
+     * @param initialValue
+     *            default layer visible in the combo box
+     * @param toolTipText
+     *            tool tip text associated with this combo box
+     * @param layerable
+     *            layers to be proposed in the combo box
+     * @return the JComboBox
+     */
+
+    public <T> JComboBox<T> addLayerableComboBox(String fieldName,
+            Object initialValue, String toolTipText, Collection<T> layerable) {
+
+        final JComboBox<T> comboBox = addComboBox(fieldName, initialValue,
+                layerable, toolTipText);
+        final LayerNameRenderer layerListCellRenderer = new 
LayerNameRenderer();
+        layerListCellRenderer.setCheckBoxVisible(false);
+        layerListCellRenderer.setProgressIconLabelVisible(false);
+        comboBox.setRenderer(layerListCellRenderer);
+        comboBox.invalidate();
+
+        return comboBox;
+    }
 }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to