Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Created October 13, 2010 00:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonm23/623167 to your computer and use it in GitHub Desktop.
Save jasonm23/623167 to your computer and use it in GitHub Desktop.
A simple framework for building a Hudson Status Monitor
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="false">
<s:Group width="600"
height="70">
<s:Rect width="100%"
height="100%"
radiusX="6"
radiusY="6"
visible="{(data.color == 'yellow')}">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x331100"
ratio="0"/>
<s:GradientEntry color="0xFF8800"
ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Rect width="100%"
height="100%"
radiusX="6"
radiusY="6"
visible="{(data.color == 'disabled')}">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x222222"
ratio="0"/>
<s:GradientEntry color="0x555555"
ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Rect width="100%"
height="100%"
radiusX="6"
radiusY="6"
visible="{(data.color == 'blue')}">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x004400"
ratio="0"/>
<s:GradientEntry color="0x00FF00"
ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Rect width="100%"
height="100%"
radiusX="6"
radiusY="6"
visible="{(data.color == 'blue_anime')}">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x000044"
ratio="0"/>
<s:GradientEntry color="0x0000FF"
ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Rect width="100%"
height="100%"
radiusX="6"
radiusY="6"
visible="{(data.color == 'red')}">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x440000"
ratio="0"/>
<s:GradientEntry color="0xFF0000"
ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Label left="20"
verticalCenter="0"
text="{data.name}"
color="#FFFFFF"
width="510"
maxDisplayedLines="1"
fontSize="32">
<s:filters>
<s:DropShadowFilter alpha="0.25"/>
</s:filters>
</s:Label>
<s:Group width="60"
height="50"
right="10"
verticalCenter="0"
visible="{(data.color == 'blue_anime')}">
<s:Ellipse width="100%"
height="100%">
<s:fill>
<s:SolidColor color="white"/>
</s:fill>
</s:Ellipse>
<s:Label text="BUILD"
color="0x000044"
fontSize="12"
fontWeight="bold"
verticalCenter="0"
horizontalCenter="0"/>
</s:Group>
<s:Group width="60"
height="50"
right="10"
verticalCenter="0"
visible="{(data.color == 'red')}">
<s:Ellipse width="100%"
height="100%">
<s:fill>
<s:SolidColor color="0xFFFFFF"/>
</s:fill>
</s:Ellipse>
<s:Label text="FAIL"
color="0x440000"
fontSize="12"
fontWeight="bold"
verticalCenter="0"
horizontalCenter="0"/>
</s:Group>
<s:Group width="60"
height="50"
right="10"
verticalCenter="0"
visible="{(data.color == 'yellow')}">
<s:Ellipse width="100%"
height="100%">
<s:fill>
<s:SolidColor color="0xFFFFFF"/>
</s:fill>
</s:Ellipse>
<s:Label text="TEST FAIL"
color="0xFF5500"
fontSize="12"
fontWeight="bold"
verticalCenter="0"
horizontalCenter="0"/>
</s:Group>
<s:Group width="50"
height="50"
right="30"
verticalCenter="0"
visible="{(data.color == 'disabled')}">
<s:Label text="DISABLED"
color="0x777777"
fontSize="12"
fontWeight="bold"
verticalCenter="0"
horizontalCenter="0"/>
</s:Group>
</s:Group>
</s:ItemRenderer>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/1.5.3">
<!-- Adobe AIR Application Descriptor File Template.
Specifies parameters for identifying, installing, and launching AIR applications.
xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/1.5.3
The last segment of the namespace specifies the version
of the AIR runtime required for this application to run.
minimumPatchLevel - The minimum patch level of the AIR runtime required to run
the application. Optional.
-->
<!-- The application identifier string, unique to this application. Required. -->
<id>HudsonStatus</id>
<!-- Used as the filename for the application. Required. -->
<filename>HudsonStatus</filename>
<!-- The name that is displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<name>HudsonStatus</name>
<!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
<version>v1</version>
<!-- Description, displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<!-- <description></description> -->
<!-- Copyright information. Optional -->
<!-- <copyright></copyright> -->
<!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
<!-- <publisherID></publisherID> -->
<!-- Settings for the application's initial window. Required. -->
<initialWindow>
<!-- The main SWF or HTML file of the application. Required. -->
<!-- Note: In Flash Builder, the SWF reference is set automatically. -->
<content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
<!-- The title of the main window. Optional. -->
<!-- <title></title> -->
<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<!-- We want a frameless window that we maximize on startup. -->
<systemChrome>none</systemChrome>
<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
<!-- <transparent></transparent> -->
<!-- Whether the window is initially visible. Optional. Default false. -->
<!-- <visible></visible> -->
<!-- Whether the user can minimize the window. Optional. Default true. -->
<!-- <minimizable></minimizable> -->
<!-- Whether the user can maximize the window. Optional. Default true. -->
<!-- <maximizable></maximizable> -->
<!-- Whether the user can resize the window. Optional. Default true. -->
<!-- <resizable></resizable> -->
<!-- The window's initial width. Optional. -->
<!-- <width></width> -->
<!-- The window's initial height. Optional. -->
<!-- <height></height> -->
<!-- The window's initial x position. Optional. -->
<!-- <x></x> -->
<!-- The window's initial y position. Optional. -->
<!-- <y></y> -->
<!-- The window's minimum size, specified as a width/height pair, such as "400 200". Optional. -->
<!-- <minSize></minSize> -->
<!-- The window's initial maximum size, specified as a width/height pair, such as "1600 1200". Optional. -->
<!-- <maxSize></maxSize> -->
</initialWindow>
<!-- The subpath of the standard default installation location to use. Optional. -->
<!-- <installFolder></installFolder> -->
<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
<!-- <programMenuFolder></programMenuFolder> -->
<!-- The icon the system uses for the application. For at least one resolution,
specify the path to a PNG file included in the AIR package. Optional. -->
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
<!-- Whether the application handles the update when a user double-clicks an update version
of the AIR file (true), or the default AIR application installer handles the update (false).
Optional. Default false. -->
<!-- <customUpdateUI></customUpdateUI> -->
<!-- Whether the application can be launched when the user clicks a link in a web browser.
Optional. Default false. -->
<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
<!-- Listing of file types for which the application can register. Optional. -->
<!-- <fileTypes> -->
<!-- Defines one file type. Optional. -->
<!-- <fileType> -->
<!-- The name that the system displays for the registered file type. Required. -->
<!-- <name></name> -->
<!-- The extension to register. Required. -->
<!-- <extension></extension> -->
<!-- The description of the file type. Optional. -->
<!-- <description></description> -->
<!-- The MIME content type. -->
<!-- <contentType></contentType> -->
<!-- The icon to display for the file type. Optional. -->
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
<!-- </fileType> -->
<!-- </fileTypes> -->
</application>
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="1230"
minHeight="600"
backgroundColor="#000000"
showStatusBar="false"
creationComplete="start()">
<fx:Declarations>
<fx:String id="hudsonserver">deadlock.netbeans.org/hudson</fx:String>
<s:HTTPService id="jobsRequest"
url="{'http://'+hudsonserver+'/api/xml?depth=1'}"
method="POST">
<s:request xmlns="">
</s:request>
</s:HTTPService>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
private var t:Timer = new Timer(1000, 0);
private function getHudsonStatus(e:TimerEvent):void
{
jobsRequest.send();
}
private function start():void
{
nativeWindow.maximize();
jobsRequest.send();
t.addEventListener(TimerEvent.TIMER, getHudsonStatus);
t.start();
}
]]>
</fx:Script>
<s:Rect width="100%" height="70">
<s:fill>
<s:LinearGradient rotation="90" >
<s:GradientEntry color="#000000" ratio="0"/>
<s:GradientEntry color="#333333" ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Rect top="70" width="100%" height="100%">
<s:fill>
<s:LinearGradient rotation="90" >
<s:GradientEntry color="#000000" ratio="0"/>
<s:GradientEntry color="#333333" ratio="1"/>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Label top="15"
left="10"
fontSize="50"
color="white"
fontWeight="bold"
text="{'Hudson Status : ' + hudsonserver}"/>
<s:Line top="70" left="0" right="0">
<s:stroke>
<s:SolidColorStroke color="#888888" />
</s:stroke>
</s:Line>
<s:DataGroup top="80"
horizontalCenter="0"
bottom="10"
dataProvider="{jobsRequest.lastResult.hudson.job}"
itemRenderer="HudsonJob">
<s:layout>
<!--
Adjust the requestedColumnCount to set the number of columns.
Otherwise modify the dimensions in the HudsonJob.mxml to format
the Job display.
-->
<s:TileLayout horizontalGap="10" requestedColumnCount="3"
verticalGap="10"/>
</s:layout>
</s:DataGroup>
<s:Label text="Click Here to Exit or Press Alt+F4" bottom="5" right="5" click="nativeApplication.exit()" color="#DDDDDD"/>
</s:WindowedApplication>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment