View Javadoc

1   /*
2    *  Copyright 2006 the GLXDesktop Project Team, all rights reserved.
3    *  
4    *  This file is part of GLXDesktop Project.
5    *  GLXDesktop Project is free software; you can redistribute it and/or modify
6    *  it under the terms of the GNU General Public License as published by
7    *  the Free Software Foundation; either version 2 of the License.
8    *  3ddesktop-configurator is distributed in the hope that it will be useful,
9    *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   *  GNU General Public License for more details.
12   *  You should have received a copy of the GNU General Public License
13   *  along with GLXDesktop Project; if not, write to the Free Software
14   *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
15   */
16  
17  package net.sf.glxdesktop.gui.runcmd;
18  
19  import net.sf.glxdesktop.gui.Messages;
20  import net.sf.glxdesktop.gui.glade.I18GladeTemplate;
21  import net.sf.glxdesktop.gui.glade.LoadGlade;
22  import net.sf.glxdesktop.gui.glade.LoadGladeException;
23  
24  import org.gnu.glade.LibGlade;
25  import org.gnu.gtk.Button;
26  import org.gnu.gtk.Expander;
27  import org.gnu.gtk.Label;
28  import org.gnu.gtk.ProgressBar;
29  import org.gnu.gtk.TextView;
30  import org.gnu.gtk.Window;
31  
32  public abstract class RunCmdProgress {
33  
34  	private static final String GLADE_FILE = "glade/runcmd.glade";
35  
36  	protected LibGlade glade;
37  
38  	protected Window window;
39  
40  	protected ProgressBar progressBar;
41  
42  	protected Button buttonClose;
43  
44  	protected Label labelMessage;
45  
46  	protected TextView textViewCmdOutput;
47  
48  	protected TextView textViewCmdError;
49  
50  	protected Expander expanderCmdOutput;
51  
52  	protected Expander expanderCmdError;
53  
54  	private static final String[] GLX_LABELS = {
55  			"label_cmd_input", "label_cmd_error" }; //$NON-NLS-1$ //$NON-NLS-2$
56  
57  	public void initialize() throws LoadGladeException {
58  		// Try to load the Glade template.
59  		LoadGlade loadGlade = new LoadGlade(GLADE_FILE, this);
60  		glade = loadGlade.getGlade();
61  		// Localize glade template.
62  		I18GladeTemplate i18GladeTemplate = new I18GladeTemplate(glade,
63  				GLX_LABELS, Messages.RESOURCE_BUNDLE, "i18nGladeRunCmdProgress"); //$NON-NLS-1$
64  		i18GladeTemplate.localizeTemplate();
65  		// Set widgets members.
66  		window = (Window) glade.getWidget("window_runcmd"); //$NON-NLS-1$
67  		progressBar = (ProgressBar) glade.getWidget("progressbar"); //$NON-NLS-1$
68  		buttonClose = (Button) glade.getWidget("button_close"); //$NON-NLS-1$
69  		labelMessage = (Label) glade.getWidget("label_message"); //$NON-NLS-1$
70  		textViewCmdOutput = (TextView) glade.getWidget("textview_output"); //$NON-NLS-1$
71  		textViewCmdError = (TextView) glade.getWidget("textview_error"); //$NON-NLS-1$
72  		expanderCmdOutput = (Expander) glade.getWidget("expander_output"); //$NON-NLS-1$
73  		expanderCmdError = (Expander) glade.getWidget("expander_error"); //$NON-NLS-1$
74  	}
75  
76  }