package JetFan;
|
|
|
import art.library.model.devices.Device;
|
import art.library.model.devices.DeviceGraphicsRuntime;
|
import art.library.model.devices.DeviceStatus;
|
import com.kitfox.svg.SVGDiagram;
|
import com.kitfox.svg.SVGElement;
|
|
|
public class DeviceGraphicsRuntime_JetFan_status_aspect extends DeviceGraphicsRuntime
|
{
|
|
public DeviceGraphicsRuntime_JetFan_status_aspect(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 = "hand";
|
String componentAlarmSymbol = "alarm";
|
setAttribute(componentArrowDirect, "display", "none");
|
setAttribute(componentArrowReverse, "display", "none");
|
setAttribute(componentManSymbol, "display", "none");
|
setAttribute(componentHandSymbol, "display", "none");
|
setAttribute(componentAlarmSymbol, "display", "none");
|
setAttribute(componentBackground, "display", "inline");
|
for (int i = 0; i <= 5; i++)
|
{
|
setAttribute("Alarm_" + i, "display", "none");
|
}
|
if (status.status != DeviceStatus.STATUS_OFFLINE)
|
{
|
for (int i = 1; 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);
|
} else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_OFF_STARTING_TIMING)
|
{
|
background = 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)
|
{
|
}
|
}
|
// 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);
|
//
|
}
|