From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25793 invoked by alias); 25 Jun 2003 02:43:13 -0000 Mailing-List: contact rhdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rhdb-owner@sources.redhat.com Received: (qmail 23273 invoked from network); 25 Jun 2003 01:24:02 -0000 Received: from unknown (HELO pd2mo1so.prod.shaw.ca) (24.71.223.10) by sources.redhat.com with SMTP; 25 Jun 2003 01:24:02 -0000 Received: from pd5mr3so.prod.shaw.ca (pd5mr3so-qfe3.prod.shaw.ca [10.0.141.144]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HH000B2IJTPF1@l-daemon> for rhdb@sources.redhat.com; Tue, 24 Jun 2003 19:22:37 -0600 (MDT) Received: from pn2ml4so.prod.shaw.ca (pn2ml4so-qfe0.prod.shaw.ca [10.0.121.148]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HH000ICGJTPEP@l-daemon> for rhdb@sources.redhat.com; Tue, 24 Jun 2003 19:22:37 -0600 (MDT) Received: from fanshawe.localdomain (h24-86-72-237.ed.shawcable.net [24.86.72.237]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HH000MO3JTN08@l-daemon> for rhdb@sources.redhat.com; Tue, 24 Jun 2003 19:22:37 -0600 (MDT) Received: by fanshawe.localdomain (Postfix, from userid 500) id DF31917DD; Tue, 24 Jun 2003 19:22:35 -0600 (MDT) Date: Wed, 25 Jun 2003 02:43:00 -0000 From: Liam Stewart Subject: [patch] multiple selection in rhdb-explain db configuration To: rhdb@sources.redhat.com Message-id: <20030625012235.GB23872@ualberta.ca> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_QPD9qi/feu4f1+kNtgZHow)" User-Agent: Mutt/1.4.1i X-SW-Source: 2003-q2/txt/msg00053.txt.bz2 --Boundary_(ID_QPD9qi/feu4f1+kNtgZHow) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline Content-length: 285 This patch adds multiple selection in the database configuration box (it comes from not using the program after a long time :) The items selected can be copied or deleted. The first one selected will be the one edited if 'edit' is pressed. Liam -- Liam Stewart :: liam@ualberta.ca --Boundary_(ID_QPD9qi/feu4f1+kNtgZHow) Content-type: text/plain; charset=us-ascii; NAME=multi-sel.diff Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=multi-sel.diff Content-length: 3387 Index: rhdb-explain/src/com/redhat/rhdb/vise/DatabasesDialog.java =================================================================== RCS file: /cvs/rhdb/src/rhdb-explain/src/com/redhat/rhdb/vise/DatabasesDialog.java,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 DatabasesDialog.java *** rhdb-explain/src/com/redhat/rhdb/vise/DatabasesDialog.java 27 Feb 2003 16:29:23 -0000 1.1.1.1 --- rhdb-explain/src/com/redhat/rhdb/vise/DatabasesDialog.java 25 Jun 2003 00:20:05 -0000 *************** *** 304,310 **** private void removeEntry() { ! cm.removeDatabaseModel(dblist.getSelectedIndex()); } private void editEntry() --- 304,315 ---- private void removeEntry() { ! if (dblist.getSelectedIndex() == -1) ! return; ! ! int[] indices = dblist.getSelectedIndices(); ! for (int i = indices.length - 1; i >= 0; i--) ! cm.removeDatabaseModel(indices[i]); } private void editEntry() *************** *** 335,362 **** if (dblist.getSelectedIndex() == -1) return; ! DatabaseModel sel = cm.getDatabaseModel(dblist.getSelectedIndex()); ! DatabaseModel copy = (DatabaseModel) sel.clone(); ! boolean ok = false; ! String orig = copy.getName(); ! int i = 1; ! ! while (!ok) ! { ! copy.setName(ExplainResources.getString(ExplainResources.PREFS_COPYDB_NAME, ! new Integer(i), ! orig)); ! i++; ! try { ! cm.addDatabaseModel(copy); ! select(dblm.getSize() - 1); ! ok = true; ! } catch (ConfigurationException ex) { ! // ignore } } } private void initComponents() --- 340,372 ---- if (dblist.getSelectedIndex() == -1) return; ! int[] indices = dblist.getSelectedIndices(); ! for (int i = 0; i < indices.length; i++) ! { ! DatabaseModel sel = cm.getDatabaseModel(indices[i]); ! DatabaseModel copy = (DatabaseModel) sel.clone(); ! boolean ok = false; ! String orig = copy.getName(); ! int j = 1; ! while (!ok) ! { ! copy.setName(ExplainResources.getString(ExplainResources.PREFS_COPYDB_NAME, ! new Integer(j), ! orig)); ! j++; ! ! try { ! cm.addDatabaseModel(copy); ! ok = true; ! } catch (ConfigurationException ex) { ! // ignore ! } } } + + select(dblm.getSize() - 1); } private void initComponents() *************** *** 405,411 **** // the list dblist = new JList(); - dblist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dblist.addListSelectionListener(dblsl); dblist.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) --- 415,420 ---- *************** *** 508,518 **** removeAction.setEnabled(false); copyAction.setEnabled(false); } ! else { configAction.setEnabled(true); removeAction.setEnabled(true); copyAction.setEnabled(true); } } } --- 517,533 ---- removeAction.setEnabled(false); copyAction.setEnabled(false); } ! else if (dblist.getMinSelectionIndex() == dblist.getMaxSelectionIndex()) { configAction.setEnabled(true); removeAction.setEnabled(true); copyAction.setEnabled(true); + } + else + { + configAction.setEnabled(false); + removeAction.setEnabled(true); + copyAction.setEnabled(true); } } } --Boundary_(ID_QPD9qi/feu4f1+kNtgZHow)--