From be6517efc4f156316adf587134090b4b3e2d99d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Flores?= Date: Thu, 27 May 2004 15:45:11 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@104 bb69d46d-e84e-40c8-a05a-06db0d633741 --- trunk/siprp/importer/DataChooserWindow.java | 23 +++++++++++++++++++-- trunk/siprp/importer/Importer.java | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/trunk/siprp/importer/DataChooserWindow.java b/trunk/siprp/importer/DataChooserWindow.java index d49b3936..6839212a 100644 --- a/trunk/siprp/importer/DataChooserWindow.java +++ b/trunk/siprp/importer/DataChooserWindow.java @@ -20,6 +20,7 @@ public class DataChooserWindow extends CustomJDialog { private final String labels[]; private final String items[]; + private final String empty[]; private final String allItems[][]; private final JComboBox combos[]; private final int preselected[]; @@ -37,6 +38,11 @@ public class DataChooserWindow extends CustomJDialog super( modalFrame, true ); labels = names; items = data[ 0 ]; + empty = new String[ items.length ]; + for( int i = 0; i < empty.length; ++i ) + { + empty[ i ] = ""; + } allItems = data; combos = new JComboBox[ labels.length ]; preselected = selected; @@ -144,13 +150,26 @@ public class DataChooserWindow extends CustomJDialog Hashtable hash = new Hashtable(); for( int i = 0; i < labels.length; ++i ) { + String sel = combos[ i ].getSelectedItem().toString(); if( multiple ) { - hash.put( labels[ i ], allItems[ combos[ i ].getSelectedIndex() ] ); + if( sel.length() > 0 ) + { + String col[] = new String[ allItems.length ]; + for( int j = 0; j < allItems.length; ++j ) + { + col[ j ] = allItems[ j ][ combos[ i ].getSelectedIndex() ]; + } + hash.put( labels[ i ], col ); + } + else + { + hash.put( labels[ i ], empty ); + } } else { - hash.put( labels[ i ], combos[ i ].getSelectedItem() ); + hash.put( labels[ i ], sel ); } } return hash; diff --git a/trunk/siprp/importer/Importer.java b/trunk/siprp/importer/Importer.java index 52de9a5d..7150ba3a 100644 --- a/trunk/siprp/importer/Importer.java +++ b/trunk/siprp/importer/Importer.java @@ -44,7 +44,7 @@ public class Importer extends CustomJDialog private String vals[][]; private final int[] DEFAULT_SELECTION = new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 }; - public final String NAMES[] = new String[]{ + public static final String NAMES[] = new String[]{ NOME, SEXO, NACIONALIDADE,