View Javadoc
1   /**
2    * LGPL-style license, for more see http://siouxsie.sourceforge.net/license.txt
3    */
4   package siouxsie.desktop.impl;
5   
6   import java.awt.Component;
7   import java.awt.Dimension;
8   
9   import javax.swing.JComponent;
10  import javax.swing.JLabel;
11  import javax.swing.JProgressBar;
12  
13  import org.jdesktop.swingx.JXStatusBar;
14  
15  import siouxsie.desktop.IStatusBar;
16  
17  /**
18   * 
19   * @author Arnaud Cogoluegnes
20   * @version $Id$
21   * @deprecated
22   */
23  public class StatusBar implements IStatusBar {
24  	
25  	private JXStatusBar statusBar = new JXStatusBar();
26  	private JLabel leadingMessage = new JLabel();
27  	private JLabel trailingMessage = new JLabel();
28  	private JProgressBar progressBar = new JProgressBar();
29  	
30  	public StatusBar() {
31  		//statusBar.add(leadingMessage,new JXStatusBar.Constraint(1.0));
32  		//statusBar.addSeparator();
33  		statusBar.add(progressBar);
34  		progressBar.setVisible(false);
35  		statusBar.add(trailingMessage);		
36  		statusBar.setAlignmentX(Component.RIGHT_ALIGNMENT);		
37  		statusBar.setPreferredSize(new Dimension(25,25));
38  	}
39  	
40  	/*
41  	 * (non-Javadoc)
42  	 * @see siouxsie.desktop.IStatusBar#getComponent()
43  	 */
44  	public JComponent getComponent() {
45  		return this.statusBar;
46  	}
47  	
48  	/*
49  	 * (non-Javadoc)
50  	 * @see siouxsie.desktop.IStatusBar#setTrailingMessage(java.lang.String)
51  	 */
52  	public void setTrailingMessage(String msg) {
53  		trailingMessage.setText(msg);
54  	}
55  	
56  	/*
57  	 * (non-Javadoc)
58  	 * @see siouxsie.desktop.IStatusBar#setLeadingMessage(java.lang.String)
59  	 */
60  	public void setLeadingMessage(String msg) {
61  		leadingMessage.setText(msg);
62  	}	
63  	
64  	/*
65  	 * (non-Javadoc)
66  	 * @see siouxsie.desktop.IStatusBar#processEnded()
67  	 */
68  	public void processEnded() {
69  		progressBar.setIndeterminate(false);
70  		progressBar.setVisible(false);		
71  	}
72  	
73  	/*
74  	 * (non-Javadoc)
75  	 * @see siouxsie.desktop.IStatusBar#processStarted(boolean)
76  	 */
77  	public void processStarted(boolean indeterminate) {
78  		progressBar.setVisible(true);
79  		progressBar.setIndeterminate(indeterminate);	
80  		if(!indeterminate) {
81  			progressBar.setValue(0);
82  		}
83  	}
84  	
85  	/*
86  	 * (non-Javadoc)
87  	 * @see siouxsie.desktop.IStatusBar#setProgress(int)
88  	 */
89  	public void setProgress(int progress) {
90  		progressBar.setValue(progress);		
91  	}
92  	
93  	
94  }