View Javadoc

1   package de.orangecafe.amazonrcp.interceptors;
2   
3   import org.aopalliance.intercept.MethodInterceptor;
4   import org.aopalliance.intercept.MethodInvocation;
5   import org.springframework.richclient.progress.StatusBarCommandGroup;
6   import org.springframework.richclient.application.Application;
7   
8   import javax.swing.*;
9   
10  /**
11   * @autor Torsten Strasser
12   */
13  public class StatusBarUpdateInterceptor implements MethodInterceptor {
14      public Object invoke(final MethodInvocation methodInvocation) throws Throwable {
15          StatusBarCommandGroup statusBar = Application.instance().getActiveWindow().getStatusBar();
16  
17          try {
18              String methodName = methodInvocation.getMethod().getName();
19              //TODO: get icon with application services
20              ImageIcon icon = new ImageIcon("mail-send-receive.png");
21              statusBar.setMessage(icon, "Transferring data (" + methodName + ")");
22  
23              return methodInvocation.proceed();
24          } finally {
25              statusBar.setMessage(null);
26          }
27      }
28  }