public inbox for rhdb@sourceware.org
 help / color / mirror / Atom feed
* [patch] multiple selection in rhdb-explain db configuration
@ 2003-06-25  2:43 Liam Stewart
  2003-06-25 13:50 ` Fernando Nasser
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Stewart @ 2003-06-25  2:43 UTC (permalink / raw)
  To: rhdb

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]


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

[-- Attachment #2: multi-sel.diff --]
[-- Type: text/plain, Size: 3387 bytes --]

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);
  			}
  		}
  	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] multiple selection in rhdb-explain db configuration
  2003-06-25  2:43 [patch] multiple selection in rhdb-explain db configuration Liam Stewart
@ 2003-06-25 13:50 ` Fernando Nasser
  0 siblings, 0 replies; 2+ messages in thread
From: Fernando Nasser @ 2003-06-25 13:50 UTC (permalink / raw)
  To: Liam Stewart; +Cc: rhdb

Liam Stewart wrote:
> 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
> 

Humm, I am not sure we want to do that.  It does make it easier for 
someone to delete connections and copy them but it makes it a little bit 
confusing for the Edit option.  And how many times one will be deleting 
connections (except when testing the tool itself)?  Copying several at a 
time seems even less useful.  IMO the disadvantages outweigh the gains 
on this one.

But I will ask/wait for other people's opinions and consult the GUI 
guidelines before we rule this out.

Weather we use it or not, thanks for taking the time to create the 
patch.  Please keep them coming ;-)

Best regards,
Fernando



> 
> 
> ------------------------------------------------------------------------
> 
> 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);
>   			}
>   		}
>   	}


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-25 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-25  2:43 [patch] multiple selection in rhdb-explain db configuration Liam Stewart
2003-06-25 13:50 ` Fernando Nasser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).