You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BuildProgressPanel.java 4.2KB

21 years ago
21 years ago
21 years ago
17 years ago
21 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
21 years ago
17 years ago
21 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/epl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * Helen Hawkins Converted to new interface (bug 148190)
  13. * ******************************************************************/
  14. package org.aspectj.ajde.ui.swing;
  15. import java.awt.BorderLayout;
  16. import java.awt.Dimension;
  17. import java.awt.event.ActionEvent;
  18. import javax.swing.JButton;
  19. import javax.swing.JLabel;
  20. import javax.swing.JPanel;
  21. import javax.swing.JProgressBar;
  22. /**
  23. * @author Mik Kersten
  24. */
  25. public class BuildProgressPanel extends JPanel {
  26. //private static final long serialVersionUID = -8045879840621749183L;
  27. private static final int MAX_VAL = 100;
  28. //private JDialog dialog = null;
  29. BorderLayout borderLayout1 = new BorderLayout();
  30. JPanel cancel_panel = new JPanel();
  31. JButton cancel_button = new JButton();
  32. JPanel jPanel2 = new JPanel();
  33. JLabel progress_label = new JLabel();
  34. JLabel configFile_label = new JLabel();
  35. BorderLayout borderLayout3 = new BorderLayout();
  36. JPanel jPanel1 = new JPanel();
  37. JProgressBar compile_progressBar = new JProgressBar();
  38. private boolean buildIsCancelled = false;
  39. public BuildProgressPanel() {
  40. try {
  41. jbInit();
  42. compile_progressBar.setMaximum(MAX_VAL);
  43. } catch (Exception e) {
  44. throw new RuntimeException(e.toString());
  45. }
  46. }
  47. // public void start() {
  48. // dialog =
  49. // new JDialog(TopManager.INSTANCE.getRootFrame(), "ajc Build Progress", false);
  50. // // progressDialog = new CompileProgressPanel();
  51. // dialog.setContentPane(this);
  52. // dialog.setSize(500, 110);
  53. // dialog.setLocationRelativeTo(TopManager.INSTANCE.getRootFrame());
  54. // dialog.setVisible(true);
  55. // }
  56. public void setProgressText(String text) {
  57. progress_label.setText(" " + text);
  58. }
  59. public void setConfigFile(String configFile) {
  60. configFile_label.setText(" Build configuration: " + configFile);
  61. }
  62. /**
  63. * Jumps the progress bar <CODE>newVal</CODE> seconds ahead.
  64. */
  65. public void setProgressBarVal(int newVal) {
  66. compile_progressBar.setValue(newVal);
  67. }
  68. /**
  69. * @param maxVal the value to which value to which the progress bar will
  70. * count up to (in seconds)
  71. */
  72. public void setProgressBarMax(int maxVal) {
  73. compile_progressBar.setMaximum(maxVal);
  74. }
  75. public int getProgressBarMax() {
  76. return compile_progressBar.getMaximum();
  77. }
  78. /**
  79. * Makes the progress bar move one second ahead.
  80. */
  81. public void incrementProgressBarVal() {
  82. int newVal = compile_progressBar.getValue() + 1;
  83. compile_progressBar.setValue(newVal);
  84. }
  85. /**
  86. * Jumps the progress bar to the end.
  87. */
  88. public void finish() {
  89. compile_progressBar.setValue(compile_progressBar.getMaximum());
  90. }
  91. private void jbInit() throws Exception {
  92. this.setLayout(borderLayout1);
  93. cancel_button.setFont(new java.awt.Font("Dialog", 0, 11));
  94. cancel_button.setText("Cancel");
  95. cancel_button.addActionListener(new java.awt.event.ActionListener() {
  96. public void actionPerformed(ActionEvent e) {
  97. cancel_button_actionPerformed(e);
  98. }
  99. });
  100. progress_label.setFont(new java.awt.Font("Dialog", 0, 11));
  101. progress_label.setText("");
  102. jPanel2.setPreferredSize(new Dimension(360, 24));
  103. jPanel2.setLayout(borderLayout3);
  104. configFile_label.setFont(new java.awt.Font("Dialog", 0, 11));
  105. configFile_label.setText("");
  106. compile_progressBar.setPreferredSize(new Dimension(330, 14));
  107. this.add(cancel_panel, BorderLayout.SOUTH);
  108. cancel_panel.add(cancel_button, null);
  109. this.add(jPanel2, BorderLayout.CENTER);
  110. jPanel2.add(configFile_label, BorderLayout.NORTH);
  111. jPanel2.add(progress_label, BorderLayout.SOUTH);
  112. jPanel2.add(jPanel1, BorderLayout.CENTER);
  113. jPanel1.add(compile_progressBar, null);
  114. }
  115. void cancel_button_actionPerformed(ActionEvent e) {
  116. buildIsCancelled = true;
  117. }
  118. public boolean isCancelRequested() {
  119. return buildIsCancelled;
  120. }
  121. }