Results 1 to 2 of 2

Thread: How to block multiple clicks?

Hybrid View

  1. #1
    Join Date
    Nov 2006
    Posts
    29

    Default How to block multiple clicks?

    Hello RCP experts,

    I added a Refresh Button to the Toolbar. When the user clicks the refresh button, it updates the Table Model. I use Swing Worker to perform the task. It works fine.

    But the problem is the agressive user sometimes clicks Refresh button multiple times without waiting until the previous request is completed.

    Code:
    private class RefreshExecutor extends AbstractActionCommandExecutor {
        	public boolean isAuthorized() {				
    	        return super.isAuthorized();      
    		}	
        	
            /**
             * Execute this command.
             */
            public void execute() {	                  	        	                   
                // Refresh Table...
                final ProgressMonitor bar = getActiveWindow().getStatusBar().getProgressMonitor();
                final SwingWorker worker = new SwingWorker() {
             	   public Object construct() {
             		   getControl().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
             		   return new TableRefreshTask(getApplicationContext(), bar);
             	   }
             	   public void finished() {
             		   bar.done();
             		   getControl().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             	   }
                };
                worker.start();      
            }
       }

    There must be a simple way to freeze the entire window when a task is running. Any ideas?

    Thanks.
    Kanugula.

  2. #2
    Join Date
    Nov 2006
    Posts
    29

    Default I found Solution

    Amazing RCP guys,

    I found the solution to my current problem at
    http://forum.springframework.org/sho...=BusyIndicator

    Basically I should use built-in org.springframework.richclient.progress.BusyIndicator

    It is a wonder that this framework provides lot of features!

    I have a feeling that people come back to stone age from Web based solutions.
    In my case, desktop style rich look and high performance are crucial.
    I will have to address database connection overhead(no pool in our case, even though there is a pool per user) in case of thick clients.

    Thanks.
    Kanugula.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •