KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > ajde > ui > swing > DefaultBuildProgressMonitor


1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3  *
4  * This file is part of the IDE support for the AspectJ(tm)
5  * programming language; see http://aspectj.org
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is AspectJ.
18  *
19  * The Initial Developer of the Original Code is Xerox Corporation. Portions
20  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21  * All Rights Reserved.
22  *
23  * Contributor(s):
24  */

25
26 package org.aspectj.ajde.ui.swing;
27
28 import javax.swing.*;
29 import java.awt.*;
30 import java.awt.event.*;
31
32 import org.aspectj.ajde.BuildProgressMonitor;
33 import org.aspectj.ajde.Ajde;
34
35 /**
36  * This dialog box is open while ajc is compiling the system and displays
37  * a corresponding progress bar.
38  *
39  * @author Mik Kersten
40  */

41 public class DefaultBuildProgressMonitor extends Thread JavaDoc implements BuildProgressMonitor {
42
43     private BuildProgressPanel progressDialog = null;
44     private JDialog dialog = null;
45
46     public DefaultBuildProgressMonitor(Frame parent) {
47         dialog = new JDialog(parent, PROGRESS_HEADING, false);
48         progressDialog = new BuildProgressPanel();
49         dialog.setContentPane(progressDialog);
50         dialog.setSize(550, 120);
51         dialog.setLocationRelativeTo(parent);
52     }
53
54     /**
55      * Start the progress monitor.
56      */

57     public void start(String JavaDoc configFilePath) {
58         progressDialog.setConfigFile(configFilePath);
59         dialog.setLocationRelativeTo(AjdeUIManager.getDefault().getRootFrame());
60         dialog.setVisible(true);
61     }
62
63     /**
64      * Sets the label describing the current progress phase.
65      */

66     public void setProgressText(String JavaDoc text) {
67         progressDialog.setProgressText(text);
68     }
69
70     /**
71      * Jumps the progress bar to <CODE>newVal</CODE>.
72      */

73     public void setProgressBarVal(int newVal) {
74         progressDialog.setProgressBarVal(newVal);
75     }
76
77     /**
78      * Makes the progress bar by one.
79      */

80     public void incrementProgressBarVal() {
81         progressDialog.incrementProgressBarVal();
82     }
83
84     /**
85      * @param maxVal sets the value at which the progress will finish.
86      */

87     public void setProgressBarMax(int maxVal) {
88         progressDialog.setProgressBarMax(maxVal);
89     }
90
91     /**
92      * @return the value at which the progress monitoring will finish.
93      */

94     public int getProgressBarMax() {
95         return progressDialog.getProgressBarMax();
96     }
97
98     /**
99      * Jump the progress bar to the end and finish progress monitoring.
100      */

101     public void finish() {
102         progressDialog.finish();
103         dialog.dispose();
104     }
105 }
Popular Tags