Permalink
Browse files

Display two BlameMonitors, for different stages

  • Loading branch information...
1 parent 5275847 commit 3124bedb80a2afd0e8752aeb17e05ef2abaa9f07 @philandstuff committed Feb 13, 2011
@@ -1,68 +0,0 @@
-package com.thoughtworks.go.monitor;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ppotter
- * Date: 02/02/2011
- * Time: 20:06
- * To change this template use File | Settings | File Templates.
- */
-public class BlameMonitor implements BuildMonitorListener {
- public BlameMonitor() {
- }
-
- private JPanel panel;
- private JLabel userLabel;
- private JLabel statusLabel;
- private JLabel emailLabel;
-
- public JPanel createWindow() {
- panel = new JPanel();
- userLabel = new JLabel("Blame Monitor");
- statusLabel = new JLabel("Blame Monitor");
- emailLabel = new JLabel("Blame Monitor");
- panel.setLayout(new GridLayout(3, 1));
- panel.add(userLabel);
- panel.add(emailLabel);
- panel.add(statusLabel);
-
- userLabel.setFont(new Font("Dialog",Font.PLAIN, 100));
- userLabel.setOpaque(false);
- statusLabel.setFont(new Font("Dialog",Font.PLAIN, 100));
- statusLabel.setOpaque(false);
- emailLabel.setFont(new Font("Dialog",Font.PLAIN, 100));
- emailLabel.setOpaque(false);
- panel.setVisible(true);
- return panel;
- }
-
- public void brokeTheBuild(String user) {
- panel.setBackground(Color.RED);
- showUser(user);
- statusLabel.setText("Broke the build");
- }
-
- public void fixedTheBuild(String user) {
- panel.setBackground(Color.GREEN);
- showUser(user);
- statusLabel.setText("Fixed the build");
- }
-
- public void pushedWorkingBuild(String user) {
- panel.setBackground(Color.GREEN);
- showUser(user);
- statusLabel.setText("Pushed");
- }
-
- private void showUser(String user) {
- String[] splits = user.split("[<>]");
- for (String split : splits) { System.out.println(split); }
- userLabel.setText(splits[0]);
- emailLabel.setText(splits[1]);
- }
-
-
-}
@@ -1,28 +1,41 @@
package com.thoughtworks.go.monitor;
import javax.swing.*;
+import java.awt.*;
public class BuildStatusMonitor {
+ private static final String goServer = "twu-ci";
+
public static void main(String[] args) throws InterruptedException {
- BlameMonitor blameMonitor = new BlameMonitor();
+ BlameDisplay buildDisplay = new BlameDisplay();
+ BlameDisplay wordpressDisplay = new BlameDisplay();
- JFrame frame = new JFrame("Build Monitor");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.pack();
- frame.setExtendedState(frame.getExtendedState()|JFrame.MAXIMIZED_BOTH);
- frame.add(blameMonitor.createWindow());
+ JFrame frame = createFrame();
+ frame.setLayout(new GridLayout(2,1));
+ frame.add(buildDisplay.createWindow());
+ frame.add(wordpressDisplay.createWindow());
frame.setVisible(true);
- StageMonitor monitor = new StageMonitor("all", "build", "twu-ci", blameMonitor, new SongListener());
+ StageMonitor buildMonitor = new StageMonitor("all", "build", goServer, buildDisplay, new SongListener());
+ StageMonitor wordpressMonitor = new StageMonitor("wordpress-cms", "manual-deploy-to-staging-server", goServer, wordpressDisplay, new SongListener());
while (true) {
try {
- monitor.pollForNewCompletion();
+ buildMonitor.pollForNewCompletion();
+ wordpressMonitor.pollForNewCompletion();
Thread.sleep(10000);
System.out.println("Polling...");
} catch (Exception ignore) {
ignore.printStackTrace();
}
}
}
+
+ private static JFrame createFrame() {
+ JFrame frame = new JFrame("Build Monitor");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
+ return frame;
+ }
}

0 comments on commit 3124bed

Please sign in to comment.