Commit cfad37ac authored by Gwenael Cattez's avatar Gwenael Cattez

Add background color property to OnOffDevice GUI module

parent 9cb2ba67
......@@ -97,6 +97,11 @@ public abstract class SwOnOffDevice extends JFrame implements IOnOffDevice,Actio
*/
protected String offIconPath = "images/defaultOff.png";
/**
* @Property Color of the frame background
*/
protected String backgroundHexColor="0xFFFFFF";
/**
* The current status, default status is false
*/
......@@ -169,12 +174,12 @@ public abstract class SwOnOffDevice extends JFrame implements IOnOffDevice,Actio
this.setTitle(frameTitle);
this.setResizable(false);
updateSize();
updateLocation();
Container pane = this.getContentPane();
pane.setBackground(Color.white);
pane.setLayout(new GridBagLayout());
this.setBackgroundHexColor(this.backgroundHexColor);
this.updateSize();
this.updateLocation();
Container contentPane=this.getContentPane();
contentPane.setLayout(new GridBagLayout());
onIcon=new ImageIcon(getClass().getClassLoader().getResource(onIconPath));
offIcon=new ImageIcon(getClass().getClassLoader().getResource(offIconPath));
......@@ -188,7 +193,7 @@ public abstract class SwOnOffDevice extends JFrame implements IOnOffDevice,Actio
imageConstraint.weightx=0.9;
imageConstraint.weighty=0.9;
imageStatusLabel = new JLabel(offIcon, JLabel.CENTER);
pane.add(imageStatusLabel,imageConstraint);
contentPane.add(imageStatusLabel,imageConstraint);
Border imageBorder=BorderFactory.createLineBorder(Color.BLACK);
imageStatusLabel.setBorder(imageBorder);
......@@ -204,7 +209,7 @@ public abstract class SwOnOffDevice extends JFrame implements IOnOffDevice,Actio
setStatusButton = new JButton();
setStatusButton.setText(onText);
setStatusButton.addActionListener(this);
pane.add(setStatusButton, buttonConstraint);
contentPane.add(setStatusButton, buttonConstraint);
}
/*
......@@ -423,4 +428,29 @@ public abstract class SwOnOffDevice extends JFrame implements IOnOffDevice,Actio
this.frameYPosition = frameYPosition;
updateLocation();
}
public String getBackgroundHexColor()
{
return backgroundHexColor;
}
@Property
public void setBackgroundHexColor(String backgroundHexColor)
{
Color backgroundColor;
try
{
backgroundColor=Color.decode(backgroundHexColor);
this.backgroundHexColor = backgroundHexColor;
} catch (Exception e)
{
backgroundColor=Color.WHITE;
this.backgroundHexColor="0xFFFFFF";
}
if(this.getContentPane()!=null)
{
this.getContentPane().setBackground(backgroundColor);
}
}
}
......@@ -45,6 +45,8 @@
<!-- <module>fire-controller-bpel</module> -->
<module>fire-detector-dicepe</module>
<!-- <module>fire-detector-cep</module> -->
<module>newTurnstile</module>
<module>webexplorer-launcher</module>
</modules>
<dependencies>
......
......@@ -40,6 +40,7 @@
<property name="offText">stop</property>
<property name="onIconPath">images/SprinklerOn.jpg</property>
<property name="offIconPath">images/SprinklerOff.jpg</property>
<property name="backgroundHexColor">0x3399FF</property>
<property name="deviceID">sprinkler 1</property>
<reference name="fireControlCenter">
......
......@@ -40,6 +40,7 @@
<property name="offText">stop</property>
<property name="onIconPath">images/SprinklerOn.jpg</property>
<property name="offIconPath">images/SprinklerOff.jpg</property>
<property name="backgroundHexColor">0x3399FF</property>
<property name="deviceID">sprinkler 1</property>
<reference name="fireControlCenter">
......
......@@ -28,6 +28,7 @@ package org.ow2.frascati.demo.fireemergency.turnstile;
import itemis.demo.Status;
import itemis.demo.StatusListener;
import java.awt.Color;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
......
......@@ -40,6 +40,7 @@
<property name="offText">close</property>
<property name="onIconPath">images/DoorOpen.jpg</property>
<property name="offIconPath">images/DoorClosed.jpg</property>
<property name="backgroundHexColor">0x33CC00</property>
<property name="deviceID">door 1</property>
<reference name="fireControlCenter">
......
......@@ -40,6 +40,7 @@
<property name="offText">close</property>
<property name="onIconPath">images/DoorOpen.jpg</property>
<property name="offIconPath">images/DoorClosed.jpg</property>
<property name="backgroundHexColor">0x33CC00</property>
<property name="deviceID">door 1</property>
<reference name="fireControlCenter">
......
......@@ -507,6 +507,31 @@
</dependencies>
</profile>
<profile>
<id>uml</id>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.intent</groupId>
<artifactId>frascati-intent-uml-sequence-diagram</artifactId>
<version>${frascati.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>remote</id>
<dependencies>
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-introspection-impl</artifactId>
<version>${frascati.version}</version>
</dependency>
</dependencies>
<properties>
<org.ow2.frascati.bootstrap>org.ow2.frascati.bootstrap.FraSCAtiJDTRest</org.ow2.frascati.bootstrap>
</properties>
</profile>
<!-- To execute an SCA composite with FraSCAti Explorer and the FScript
plugin type 'mvn -Pexplorer-fscript'. -->
<profile>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment