From 4e54b62e5acc545ec19d014bf64a96797b82917d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Flores?= Date: Thu, 27 May 2004 17:25:27 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@106 bb69d46d-e84e-40c8-a05a-06db0d633741 --- trunk/siprp/importer/DataChooserWindow.java | 39 ++++++++++++--------- trunk/siprp/importer/Importer.java | 19 +++++++++- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/trunk/siprp/importer/DataChooserWindow.java b/trunk/siprp/importer/DataChooserWindow.java index 6839212a..61cd6e3a 100644 --- a/trunk/siprp/importer/DataChooserWindow.java +++ b/trunk/siprp/importer/DataChooserWindow.java @@ -141,7 +141,7 @@ public class DataChooserWindow extends CustomJDialog }); } - public Hashtable getData( boolean multiple ) + public Hashtable getData() { if( canceled ) { @@ -149,28 +149,33 @@ public class DataChooserWindow extends CustomJDialog } Hashtable hash = new Hashtable(); for( int i = 0; i < labels.length; ++i ) + { + hash.put( labels[ i ], combos[ i ].getSelectedItem() ); + } + return hash; + } + + public Hashtable[] getMultipleData() + { + if( canceled ) + { + return null; + } + Hashtable hash[] = new Hashtable[ allItems[ 0 ].length ]; + for( int j = 0; j < hash.length; ++j ) + { + hash[ j ] = new Hashtable(); + } + for( int i = 0; i < labels.length; ++i ) { String sel = combos[ i ].getSelectedItem().toString(); - if( multiple ) + if( sel.length() > 0 ) { - 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 + for( int j = 0; j < allItems.length; ++j ) { - hash.put( labels[ i ], empty ); + hash[ j ].put( labels[ i ], allItems[ j ][ combos[ i ].getSelectedIndex() ] ); } } - else - { - hash.put( labels[ i ], sel ); - } } return hash; } diff --git a/trunk/siprp/importer/Importer.java b/trunk/siprp/importer/Importer.java index 7150ba3a..d6eaff47 100644 --- a/trunk/siprp/importer/Importer.java +++ b/trunk/siprp/importer/Importer.java @@ -233,9 +233,26 @@ public class Importer extends CustomJDialog return null; } - return dcw.getData( multipleSelection ); + return dcw.getData(); } + public Hashtable[] getMultipleData() + { + if( NAMES == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION ); + + if( canceled || ( dcw == null ) ) + { + return null; + } + + return dcw.getMultipleData(); + } + + public static void main( String args[] ) { // FileDialog fd = new FileDialog( null, "Escolha um ficheiro Excel:", FileDialog.LOAD );