r1165 - jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing
Author: tchemit Date: 2009-01-12 16:29:46 +0000 (Mon, 12 Jan 2009) New Revision: 1165 Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java Log: ajout de la m?\195?\169thode fillList pour ajouter facilement des donn?\195?\169es dans une JAXXList et n'en s?\195?\169lectionn?\195?\169 qu'un Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java =================================================================== --- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-01-12 16:27:34 UTC (rev 1164) +++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-01-12 16:29:46 UTC (rev 1165) @@ -71,10 +71,9 @@ } /** - * * @param path icones from path /icons * @return the icone - * @deprecated prefer use {@link jaxx.runtime.Util#createImageIcon(String)} + * @deprecated prefer use {@link jaxx.runtime.Util#createImageIcon(String)} */ @Deprecated public static ImageIcon createImageIcon(String path) { @@ -87,10 +86,9 @@ } /** - * * @param name icones from path /icons/action-xx.png * @return the icone - * @deprecated prefer use {@link jaxx.runtime.Util#createActionIcon(String)} + * @deprecated prefer use {@link jaxx.runtime.Util#createActionIcon(String)} */ @Deprecated public static ImageIcon createActionIcon(String name) { @@ -98,7 +96,6 @@ } /** - * * @param name icones from path /icons/i18n/xx-.png icones * @return the icone * @deprecated prefer use {@link jaxx.runtime.Util#createI18nIcon(String)} @@ -131,25 +128,41 @@ model.setSelectedItem(select); } - /** + /** * Fill a list model with some datas, and select after all the given object * - * @param list the list to fill - * @param data data ot inject in combo + * @param list the list to fill + * @param data data ot inject in combo * @param selects the objects to select in list after reflling his model */ public static void fillList(jaxx.runtime.swing.JAXXList list, Collection<?> data, Collection<?> selects) { List<Item> items = new ArrayList<Item>(); for (Object o : data) { boolean selected = false; - for (Object select : selects){ + for (Object select : selects) { selected = (o.equals(select) || selected); } items.add(new Item(o.toString(), o.toString(), o, selected)); } list.setItems(items); } - + + /** + * Fill a list model with some datas, and select after all the given object + * + * @param list the list to fill + * @param data data ot inject in combo + * @param select object to select in list after reflling his model + */ + public static void fillList(jaxx.runtime.swing.JAXXList list, Collection<?> data, Object select) { + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = o.equals(select); + items.add(new Item(o.toString(), o.toString(), o, selected)); + } + list.setItems(items); + } + public static void fixTableColumnWidth(JTable table, int columnIndex, int width) { TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setMaxWidth(width);
participants (1)
-
tchemit@users.labs.libre-entreprise.org