package TicketMachine;
|
|
|
import art.library.model.devices.Device;
|
import art.library.model.devices.DeviceGraphicsRuntime;
|
import art.library.model.devices.DeviceStatus;
|
import com.kitfox.svg.SVGDiagram;
|
|
|
public class DeviceGraphicsRuntime_TicketMachine_status_aspect extends DeviceGraphicsRuntime
|
{
|
|
public DeviceGraphicsRuntime_TicketMachine_status_aspect(art.library.model.devices.Device device, SVGDiagram diagram)
|
{
|
super(device, diagram);
|
}
|
|
private boolean flashOn = false;
|
|
public void timer()
|
{
|
flashOn = !flashOn;
|
status();
|
}
|
|
public void status()
|
{
|
Device device = getDevice();
|
String color1 = "#000000";
|
String color2 = "#000000";
|
art.library.model.devices.ticketmachine.TicketMachineStatus status = (art.library.model.devices.ticketmachine.TicketMachineStatus) device
|
.getDeviceStatus();
|
|
switch (device.getStatus())
|
{
|
case DeviceStatus.STATUS_ONLINE:
|
color1 = "#00FF00";
|
color2 = "#007C00";
|
break;
|
case DeviceStatus.STATUS_WARNING:
|
color1 = "#FFFF00";
|
color2 = "#7C7C00";
|
break;
|
case DeviceStatus.STATUS_ALARM:
|
color1 = "#FF0000";
|
color2 = "#7C0000";
|
break;
|
case DeviceStatus.STATUS_INVALID:
|
color1 = "#B97A57";
|
color2 = "#5A3B2A";
|
break;
|
case DeviceStatus.STATUS_DISABLE:
|
color1 = "#7C7C7C";
|
color2 = "#3E3E3E";
|
break;
|
case DeviceStatus.STATUS_SIMULATION:
|
color1 = "#0000FF";
|
color2 = "#00007C";
|
break;
|
case DeviceStatus.STATUS_OFFLINE:
|
color1 = "#c000c0";
|
color2 = "#7C007C";
|
break;
|
case DeviceStatus.STATUS_UNKNOWN:
|
color1 = "#c000c0";
|
color2 = "#7C007C";
|
break;
|
}
|
|
setAttribute("Brightbase_1", "fill", color1);
|
setAttribute("Brightbase_2", "stroke", color1);
|
setAttribute("Darkbase_1", "fill", color2);
|
setAttribute("Darkbase_2", "fill", color2);
|
setAttribute("Darkbase_3", "fill", color2);
|
|
setAttribute("Hardware_0", "display", "none",999);
|
setAttribute("Hardware_1", "display", "none",999);
|
setAttribute("Hardware_2", "display", "none",999);
|
|
setAttribute("Paper_0", "display", "none",999);
|
setAttribute("Paper_1", "display", "none",999);
|
setAttribute("Paper_2", "display", "none",999);
|
|
setAttribute("Printer_0", "display", "none",999);
|
setAttribute("Printer_1", "display", "none",999);
|
setAttribute("Printer_2", "display", "none",999);
|
|
setAttribute("Hardware_" + status.paper, "display", "inline");
|
setAttribute("Paper_" + status.paper, "display", "inline");
|
setAttribute("Printer_" + status.printer, "display", "inline");
|
|
for (int i = 0; i < device.getDeviceAlarms().getServerityAlarm(); i++)
|
{
|
setAttribute("Alarm_" + i, "display", "none");
|
}
|
}
|
|
// java.io.StringWriter sw = new java.io.StringWriter();
|
// art.library.gui.flat.FlatDialog.showDialog(null, "Error", e.getMessage() + "\n\n" + sw.toString(), true, art.library.gui.flat.FlatDialog.DIALOG_ERROR);
|
//
|
}
|