|
import art.library.model.devices.Device;
|
import art.library.model.devices.DeviceStatus;
|
import com.kitfox.svg.SVGDiagram;
|
|
|
public class DeviceGraphicsRuntime_JetFan extends DeviceGraphicsRuntime
|
{
|
|
public DeviceGraphicsRuntime_JetFan(art.library.model.devices.Device device, SVGDiagram diagram)
|
{
|
super(device, diagram);
|
}
|
|
public void status()
|
{
|
try
|
{
|
Device device = getDevice();
|
art.library.model.devices.tunnel.jetfan.JetFanStatus status = (art.library.model.devices.tunnel.jetfan.JetFanStatus) device.getDeviceStatus();
|
art.library.model.devices.tunnel.jetfan.JetFanAlarms alarms = (art.library.model.devices.tunnel.jetfan.JetFanAlarms) device.getDeviceAlarms();
|
String background = "#FF00FF";
|
String startingColor = "#ffff00";
|
String componentBackground = "background";
|
String componentArrowDirect = "direct";
|
String componentArrowReverse = "reverse";
|
String componentManSymbol = "man";
|
String componentHandSymbol = "manual";
|
String componentAlarmSymbol = "alarm";
|
setAttribute(componentArrowDirect, "display", "none");
|
setAttribute(componentArrowReverse, "display", "none");
|
setAttribute(componentManSymbol, "display", "none");
|
setAttribute(componentHandSymbol, "display", "none");
|
setAttribute(componentAlarmSymbol, "display", "none");
|
for (int i = 0; i <= 5; i++)
|
{
|
setAttribute("Alarm_" + i, "display", (alarms.getServerityAlarm() == i) ? "inline" : "none");
|
}
|
try
|
{
|
switch (status.status)
|
{
|
case DeviceStatus.STATUS_ONLINE:
|
background = "#00FF00";
|
break;
|
case DeviceStatus.STATUS_WARNING:
|
background = "#FFFF00";
|
break;
|
case DeviceStatus.STATUS_ALARM:
|
background = "#FF0000";
|
break;
|
case DeviceStatus.STATUS_INVALID:
|
background = "#B97A57";
|
break;
|
case DeviceStatus.STATUS_DISABLE:
|
background = "#808080";
|
break;
|
case DeviceStatus.STATUS_SIMULATION:
|
background = "#0000FF";
|
break;
|
case DeviceStatus.STATUS_OFFLINE:
|
background = "#FF00FF";
|
break;
|
case DeviceStatus.STATUS_UNKNOWN:
|
background = "#FF00FF";
|
break;
|
}
|
if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_DIRECT)
|
{
|
setAttribute(componentArrowDirect, "display", "inline");
|
setAttribute(componentArrowDirect, "fill", background);
|
} else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_REVERSE)
|
{
|
setAttribute(componentArrowReverse, "display", "inline");
|
setAttribute(componentArrowReverse, "fill", background);
|
} else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_DIRECT_STARTING_TIMING)
|
{
|
setAttribute(componentArrowDirect, "display", "inline");
|
setAttribute(componentArrowDirect, "fill", startingColor);
|
} else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_REVERSE_STARTING_TIMING)
|
{
|
setAttribute(componentArrowReverse, "display", "inline");
|
setAttribute(componentArrowReverse, "fill", startingColor);
|
}
|
setAttribute(componentHandSymbol, "display", (alarms.alarm_manual_control > 0) ? "inline" : "none");
|
setAttribute(componentManSymbol, "display", (alarms.alarm_local_control > 0) ? "inline" : "none");
|
setAttribute(componentManSymbol, "fill", "#" + Integer.toHexString(java.awt.Color.decode(background).darker().darker().getRGB()).substring(2));
|
setAttribute(componentBackground, "fill", background);
|
} catch (Exception e) {}
|
} catch (Exception ex) {}
|
}
|
|
public void commands()
|
{
|
|
art.library.model.devices.tunnel.jetfan.JetFanCommands commands = (art.library.model.devices.tunnel.jetfan.JetFanCommands) getDeviceCommands();
|
|
String commandBackground = "#9E9E9E";
|
String commandWindFlow = "#88A1EB";
|
|
setAttribute("direct", "display",(commands.state == art.library.model.devices.tunnel.jetfan.JetFanCommands.STATE_DIRECT) ? "inline" : "none");
|
setAttribute("reverse", "display", (commands.state == art.library.model.devices.tunnel.jetfan.JetFanCommands.STATE_REVERSE) ? "inline" : "none");
|
setAttribute("restart_hours", "display", (commands.resetWorkingHours == art.library.model.devices.tunnel.jetfan.JetFanCommands.CONDITION_YES) ? "inline" : "none");
|
setAttribute("restart_starts", "display", (commands.resetStartsNumber == art.library.model.devices.tunnel.jetfan.JetFanCommands.CONDITION_YES) ? "inline" : "none");
|
setAttribute("restart_stops", "display", (commands.resetStopsNumber == art.library.model.devices.tunnel.jetfan.JetFanCommands.CONDITION_YES) ? "inline" : "none");
|
|
setAttribute("background", "fill", commandBackground);
|
setAttribute("direct", "fill", commandWindFlow);
|
setAttribute("reverse", "fill", commandWindFlow);
|
|
}
|
// 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);
|
//
|
}
|