import art.library.model.devices.Device; import art.library.model.devices.DeviceStatus; import com.kitfox.svg.SVGDiagram; import com.kitfox.svg.SVGElement; public class DeviceGraphicsRuntime_JetFan2 extends DeviceGraphicsRuntime { public DeviceGraphicsRuntime_JetFan2(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.JetFanInformation information = (art.library.model.devices.tunnel.jetfan.JetFanInformation) device.getDeviceInformation(); art.library.model.devices.tunnel.jetfan.JetFanAlarms alarms = (art.library.model.devices.tunnel.jetfan.JetFanAlarms) device.getDeviceAlarms(); SVGElement background = getElement("Background"); SVGElement border = getElement("Border"); SVGElement alarm = getElement("Alarm"); SVGElement icon = getElement("Icon"); SVGElement text = getElement("Text Number"); setText("Text number", "" + information.number); setAttribute(background, "fill", "#00FF00"); setAttribute(border, "stroke", "#800080"); setAttribute(alarm, "display", "none"); setAttribute(icon, "fill", "#800080", 999); try { switch (status.status) { case DeviceStatus.STATUS_ALARM: case DeviceStatus.STATUS_ONLINE: { setAttribute(background, "fill", "#00FF00"); setAttribute(icon, "fill", "#008000"); setAttribute(border, "stroke", "#008000"); if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_DIRECT || status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_REVERSE) { setAttribute(background, "fill", "#00FF00"); setAttribute(icon, "fill", "#008000"); setAttribute(border, "stroke", "#008000"); } else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_DIRECT_STARTING_TIMING || status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_REVERSE_STARTING_TIMING) { setAttribute(background, "fill", "#ffff00"); setAttribute(icon, "fill", "#5A3B2A"); setAttribute(border, "stroke", "#5A3B2A"); } else if (status.state == art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_OFF) { if(alarms.getServerityAlarm() > 0) { setAttribute(background, "fill", "#808080"); setAttribute(icon, "fill", "#404040"); setAttribute(border, "stroke", "#404040"); } else { setAttribute(background, "display", "none"); setAttribute(border, "display", "none"); setAttribute(alarm, "display", "none"); setAttribute(icon, "display", "none"); setText("Text number", ""); } } break; } case DeviceStatus.STATUS_WARNING: break; case DeviceStatus.STATUS_DISABLE: setAttribute(background, "fill", "#0000FF"); setAttribute(icon, "fill", "#000080"); setAttribute(border, "stroke", "#000080"); break; case DeviceStatus.STATUS_SIMULATION: setAttribute(background, "fill", "#B97A57"); setAttribute(icon, "fill", "#5A3B2A"); setAttribute(border, "stroke", "#5A3B2A"); break; case DeviceStatus.STATUS_INVALID: case DeviceStatus.STATUS_OFFLINE: case DeviceStatus.STATUS_UNKNOWN: setAttribute(background, "fill", "#FF00FF"); setAttribute(icon, "fill", "#800080"); setAttribute(border, "stroke", "#800080"); return; } } catch(Exception e) {} try{ double strokeopacity = Math.pow(2, alarms.getServerityAlarm()) / 32; if (alarms.getServerityAlarm() > 0) { setAttribute(alarm, "stroke", "#FF0000"); setAttribute(alarm, "stroke-opacity", strokeopacity); setAttribute(alarm, "display", "inline"); setAttribute(border, "stroke-width", 0.75 + (0.3 * strokeopacity)); } else { if (status.state != art.library.model.devices.tunnel.jetfan.JetFanStatus.JETFAN_STATE_OFF) { setAttribute(border, "display", "inline"); setAttribute(border, "stroke-width", 6.5); setAttribute(border, "stroke-opacity", 1.0); setAttribute(border, "stroke-width", 0.75); } } }catch(Exception e){} }catch(Exception e){} } }