View Javadoc

1   /*
2    * $Id: StatusPanel.java,v 1.3 2007/07/04 19:42:51 edankert Exp $
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is XML Hammer code. (org.xmlhammer.*)
14   *
15   * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
16   * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. 
17   * All Rights Reserved.
18   *
19   * Contributor(s): Edwin Dankert <edankert@gmail.com>
20   */
21  
22  package org.xmlhammer.gui.status;
23  
24  import java.awt.BorderLayout;
25  
26  import javax.swing.JPanel;
27  import javax.swing.border.EmptyBorder;
28  
29  import org.bounce.CardPanel;
30  import org.xmlhammer.gui.ProjectView;
31  
32  /***
33   * Input Panel.
34   * 
35   * Allows to select either one URI, multiple URIs or 
36   * a range of files.
37   * 
38   * @version $Revision: 1.3 $, $Date: 2007/07/04 19:42:51 $
39   * @author Edwin Dankert <edankert@gmail.com>
40   */
41  
42  public class StatusPanel extends JPanel {
43  	private static final long serialVersionUID = -7486036209301795423L;
44      private CardPanel<StatusBar> statusPanel = null;
45      private StatusBar base = null;
46  
47  	/***
48  	 * Constructs a new Input Panel.
49  	 */
50  	public StatusPanel() {		
51  		super( new BorderLayout());
52  		
53  		statusPanel = new CardPanel<StatusBar>();
54          setBorder( new EmptyBorder( 2, 2, 2, 2));
55  		
56  		add( statusPanel, BorderLayout.CENTER);
57          base = new StatusBar();
58  
59          statusPanel.add(base);
60  	}
61  	
62  	public void showView( ProjectView view) {
63          if (view == null) {
64              statusPanel.show( base);
65          } else {
66              statusPanel.show( view.getStatusBar());
67          }
68  	}
69  	
70  	public void addView( ProjectView view){
71  		statusPanel.add( view.getStatusBar());
72  	}
73  
74  	public void removeView( ProjectView view){
75  		statusPanel.remove( view.getStatusBar());
76  	}
77  
78      public StatusBar getBase() {
79          return base;
80      }
81  }