1 2 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 38 class BuildProgressPanel extends JPanel { 39 40 private static final int MAX_VAL = 100; 41 43 BorderLayout borderLayout1 = new BorderLayout(); 44 JPanel cancel_panel = new JPanel(); 45 JButton cancel_button = new JButton(); 46 JPanel jPanel2 = new JPanel(); 47 JLabel progress_label = new JLabel(); 48 JLabel configFile_label = new JLabel(); 49 BorderLayout borderLayout3 = new BorderLayout(); 50 JPanel jPanel1 = new JPanel(); 51 JProgressBar compile_progressBar = new JProgressBar(); 52 53 57 public BuildProgressPanel() { 58 try { 59 jbInit(); 60 compile_progressBar.setMaximum(MAX_VAL); 61 } catch (Exception e) { 62 throw new RuntimeException (e.toString()); 63 } 64 } 65 66 76 public void setProgressText(String text) { 77 progress_label.setText(" " + text); 78 } 79 80 public void setConfigFile(String configFile) { 81 configFile_label.setText(" Build configuration: " + configFile); 82 } 83 84 87 public void setProgressBarVal(int newVal) { 88 compile_progressBar.setValue(newVal); 89 } 90 91 public void setProgressBarMax(int maxVal) { 92 compile_progressBar.setMaximum(maxVal); 93 } 94 95 public int getProgressBarMax() { 96 return compile_progressBar.getMaximum(); 97 } 98 99 102 public void incrementProgressBarVal() { 103 int newVal = compile_progressBar.getValue() + 1; 104 compile_progressBar.setValue(newVal); 105 } 106 107 110 public void finish() { 111 compile_progressBar.setValue(compile_progressBar.getMaximum()); 112 } 113 114 private void jbInit() throws Exception { 115 this.setLayout(borderLayout1); 116 cancel_button.setFont(new java.awt.Font ("Dialog", 0, 11)); 117 cancel_button.setText("Cancel"); 118 cancel_button.addActionListener(new java.awt.event.ActionListener () { 119 public void actionPerformed(ActionEvent e) { 120 cancel_button_actionPerformed(e); 121 } 122 }); 123 progress_label.setFont(new java.awt.Font ("Dialog", 0, 11)); 124 progress_label.setText(""); 125 jPanel2.setPreferredSize(new Dimension(360, 24)); 126 jPanel2.setLayout(borderLayout3); 127 configFile_label.setFont(new java.awt.Font ("Dialog", 0, 11)); 128 configFile_label.setText(""); 129 compile_progressBar.setPreferredSize(new Dimension(330, 14)); 130 this.add(cancel_panel, BorderLayout.SOUTH); 131 cancel_panel.add(cancel_button, null); 132 this.add(jPanel2, BorderLayout.CENTER); 133 jPanel2.add(configFile_label, BorderLayout.NORTH); 134 jPanel2.add(progress_label, BorderLayout.SOUTH); 135 jPanel2.add(jPanel1, BorderLayout.CENTER); 136 jPanel1.add(compile_progressBar, null); 137 } 138 139 void cancel_button_actionPerformed(ActionEvent e) { 140 Ajde.getDefault().getBuildManager().abortBuild(); 141 } 142 } | Popular Tags |