link start!
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.sys.Cursor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.ConsoleColumns;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import java.util.Comparator;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.sys.Cursor;
|
||||
|
||||
public class AlarmDbTableModel
|
||||
extends ConsoleTableModel {
|
||||
private Array alarmList = new Array(class$javax$baja$alarm$BAlarmRecord == null ? (class$javax$baja$alarm$BAlarmRecord = AlarmDbTableModel.class$("javax.baja.alarm.BAlarmRecord")) : class$javax$baja$alarm$BAlarmRecord);
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public AlarmDbTableModel(ConsoleColumns consoleColumns) {
|
||||
super(consoleColumns);
|
||||
}
|
||||
|
||||
public synchronized void load(Cursor cursor) {
|
||||
this.clear();
|
||||
this.doAdd(cursor);
|
||||
}
|
||||
|
||||
public int getAlarmCount() {
|
||||
return this.alarmList.size();
|
||||
}
|
||||
|
||||
public int getSourceCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private synchronized void doAdd(Cursor cursor) {
|
||||
while (cursor.next()) {
|
||||
this.add((BAlarmRecord)cursor.get());
|
||||
}
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public synchronized void add(BAlarmRecord bAlarmRecord) {
|
||||
this.alarmList.add((Object)bAlarmRecord);
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
this.alarmList.clear();
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.alarmList.size();
|
||||
}
|
||||
|
||||
public BAlarmRecord getRecord(int n) {
|
||||
if (n < this.getRowCount()) {
|
||||
return (BAlarmRecord)((Object)this.alarmList.get(n));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized void sortByColumn(int n, boolean bl) {
|
||||
if (n < 0 || n >= super.getColumnCount()) {
|
||||
return;
|
||||
}
|
||||
this.setInitialSort(n, bl);
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n);
|
||||
if (bl) {
|
||||
this.sort(column, SortUtil.ASCENDING);
|
||||
} else {
|
||||
this.sort(column, SortUtil.DESCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
private void sort(ConsoleColumns.Column column, Comparator comparator) {
|
||||
int n = this.alarmList.size();
|
||||
for (int i = n / 2; i >= 1; i /= 2) {
|
||||
for (int j = i; j < n; ++j) {
|
||||
int n2;
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)((Object)this.alarmList.get(j));
|
||||
Object object = column.getValue(bAlarmRecord);
|
||||
for (n2 = j; n2 >= i && comparator.compare(object, column.getValue((BAlarmRecord)((Object)this.alarmList.get(n2 - i)))) < 0; n2 -= i) {
|
||||
this.alarmList.set(n2, this.alarmList.get(n2 - i));
|
||||
}
|
||||
this.alarmList.set(n2, (Object)bAlarmRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.SortUtil
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.ConsoleColumns;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import com.tridium.alarm.ui.SourceTableModel;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
|
||||
public class AlarmTableModel
|
||||
extends ConsoleTableModel {
|
||||
private SourceTableModel.AlarmList alarmList;
|
||||
|
||||
public AlarmTableModel(ConsoleColumns consoleColumns, SourceTableModel.AlarmList alarmList) {
|
||||
super(consoleColumns);
|
||||
this.alarmList = alarmList;
|
||||
alarmList.setModel(this);
|
||||
this.sortByColumn(this.getLastSortColumn(), this.getLastSortAscending());
|
||||
}
|
||||
|
||||
public int getAlarmCount() {
|
||||
return this.getRowCount();
|
||||
}
|
||||
|
||||
public int getSourceCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.alarmList.size();
|
||||
}
|
||||
|
||||
public BAlarmRecord getRecord(int n) {
|
||||
SourceTableModel.AlarmEntry alarmEntry = this.alarmList.getEntry(n);
|
||||
return alarmEntry.rec;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
super.close();
|
||||
this.alarmList.setModel(null);
|
||||
}
|
||||
|
||||
public synchronized void sortByColumn(int n, boolean bl) {
|
||||
if (n < 0 || n >= super.getColumnCount()) {
|
||||
return;
|
||||
}
|
||||
this.setInitialSort(n, bl);
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n);
|
||||
if (bl) {
|
||||
this.alarmList.sort(column, SortUtil.ASCENDING);
|
||||
} else {
|
||||
this.alarmList.sort(column, SortUtil.DESCENDING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.UiEnv
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.ui.UiEnv;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BAlarmClassDef
|
||||
extends BComponent {
|
||||
public static final Property defName = BAlarmClassDef.newProperty((int)0, (String)"", null);
|
||||
public static final Property alarmIcon = BAlarmClassDef.newProperty((int)0, (BValue)BOrd.NULL, null);
|
||||
public static final Property alarmUrl = BAlarmClassDef.newProperty((int)0, (BValue)BOrd.NULL, null);
|
||||
public static final Property alarmSound = BAlarmClassDef.newProperty((int)0, (BValue)BOrd.NULL, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmClassDef == null ? (class$com$tridium$alarm$ui$BAlarmClassDef = BAlarmClassDef.class$("com.tridium.alarm.ui.BAlarmClassDef")) : class$com$tridium$alarm$ui$BAlarmClassDef));
|
||||
public static BAlarmClassDef DEFAULT = new BAlarmClassDef();
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassDef;
|
||||
|
||||
public String getDefName() {
|
||||
return this.getString(defName);
|
||||
}
|
||||
|
||||
public void setDefName(String string) {
|
||||
this.setString(defName, string, null);
|
||||
}
|
||||
|
||||
public BOrd getAlarmIcon() {
|
||||
return (BOrd)this.get(alarmIcon);
|
||||
}
|
||||
|
||||
public void setAlarmIcon(BOrd bOrd) {
|
||||
this.set(alarmIcon, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getAlarmUrl() {
|
||||
return (BOrd)this.get(alarmUrl);
|
||||
}
|
||||
|
||||
public void setAlarmUrl(BOrd bOrd) {
|
||||
this.set(alarmUrl, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public BOrd getAlarmSound() {
|
||||
return (BOrd)this.get(alarmSound);
|
||||
}
|
||||
|
||||
public void setAlarmSound(BOrd bOrd) {
|
||||
this.set(alarmSound, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmClassDef() {
|
||||
if (UiEnv.get().isMicroEdition()) {
|
||||
int n = this.getFlags((Slot)alarmSound);
|
||||
this.setFlags((Slot)alarmSound, n | 4);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BComponentNamePickerFE
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.workbench.fieldeditors.BComponentNamePickerFE;
|
||||
import javax.baja.alarm.BAlarmClassFolder;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BAlarmClassFE
|
||||
extends BComponentNamePickerFE {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmClassFE == null ? (class$com$tridium$alarm$ui$BAlarmClassFE = BAlarmClassFE.class$("com.tridium.alarm.ui.BAlarmClassFE")) : class$com$tridium$alarm$ui$BAlarmClassFE));
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassFE;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BComponent;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClass;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmClassFolder;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BComponent[] list() throws Exception {
|
||||
BComponent bComponent = this.loadService(BAlarmService.TYPE);
|
||||
return this.loadFromFolder(bComponent);
|
||||
}
|
||||
|
||||
private BComponent[] loadFromFolder(BComponent bComponent) {
|
||||
Array array = new Array(class$javax$baja$sys$BComponent == null ? (class$javax$baja$sys$BComponent = BAlarmClassFE.class$("javax.baja.sys.BComponent")) : class$javax$baja$sys$BComponent);
|
||||
bComponent.lease();
|
||||
BComponent[] bComponentArray = (BComponent[])bComponent.getChildren(class$javax$baja$alarm$BAlarmClass == null ? (class$javax$baja$alarm$BAlarmClass = BAlarmClassFE.class$("javax.baja.alarm.BAlarmClass")) : class$javax$baja$alarm$BAlarmClass);
|
||||
for (int i = 0; i < bComponentArray.length; ++i) {
|
||||
array.add((Object)bComponentArray[i]);
|
||||
}
|
||||
BAlarmClassFolder[] bAlarmClassFolderArray = (BAlarmClassFolder[])bComponent.getChildren(class$javax$baja$alarm$BAlarmClassFolder == null ? (class$javax$baja$alarm$BAlarmClassFolder = BAlarmClassFE.class$("javax.baja.alarm.BAlarmClassFolder")) : class$javax$baja$alarm$BAlarmClassFolder);
|
||||
for (int i = 0; i < bAlarmClassFolderArray.length; ++i) {
|
||||
this.loadFromFolder((BComponent)bAlarmClassFolderArray[i]);
|
||||
BComponent[] bComponentArray2 = this.loadFromFolder((BComponent)bAlarmClassFolderArray[i]);
|
||||
for (int j = 0; j < bComponentArray2.length; ++j) {
|
||||
array.add((Object)bComponentArray2[j]);
|
||||
}
|
||||
}
|
||||
return (BComponent[])array.trim();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmClassDef;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BAlarmClassMapping
|
||||
extends BComponent {
|
||||
public static final Property alarmClassDefinitions = BAlarmClassMapping.newProperty((int)4, (BValue)new BComponent(), null);
|
||||
public static final Property alarmClassDefMapping = BAlarmClassMapping.newProperty((int)4, (BValue)new BComponent(), null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmClassMapping == null ? (class$com$tridium$alarm$ui$BAlarmClassMapping = BAlarmClassMapping.class$("com.tridium.alarm.ui.BAlarmClassMapping")) : class$com$tridium$alarm$ui$BAlarmClassMapping));
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassMapping;
|
||||
|
||||
public BComponent getAlarmClassDefinitions() {
|
||||
return (BComponent)this.get(alarmClassDefinitions);
|
||||
}
|
||||
|
||||
public void setAlarmClassDefinitions(BComponent bComponent) {
|
||||
this.set(alarmClassDefinitions, (BValue)bComponent, null);
|
||||
}
|
||||
|
||||
public BComponent getAlarmClassDefMapping() {
|
||||
return (BComponent)this.get(alarmClassDefMapping);
|
||||
}
|
||||
|
||||
public void setAlarmClassDefMapping(BComponent bComponent) {
|
||||
this.set(alarmClassDefMapping, (BValue)bComponent, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmClassDef getAlarmClassDefFor(String string) {
|
||||
BString bString = (BString)this.getAlarmClassDefMapping().get(string);
|
||||
if (bString == null) {
|
||||
return BAlarmClassDef.DEFAULT;
|
||||
}
|
||||
return (BAlarmClassDef)this.getAlarmClassDefinitions().get(SlotPath.escape((String)bString.toString()));
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,525 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.UiEnv
|
||||
* com.tridium.workbench.fieldeditors.BOrdFE
|
||||
* com.tridium.workbench.ord.BFileOrdChooser
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.registry.TypeInfo
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.SlotCursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BOrientation
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.pane.BSplitPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DefaultTableModel
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmClassDef;
|
||||
import com.tridium.alarm.ui.BAlarmClassFE;
|
||||
import com.tridium.alarm.ui.BAlarmClassMapping;
|
||||
import com.tridium.ui.UiEnv;
|
||||
import com.tridium.workbench.fieldeditors.BOrdFE;
|
||||
import com.tridium.workbench.ord.BFileOrdChooser;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BOrientation;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.pane.BSplitPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DefaultTableModel;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BAlarmClassMappingFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmClassMappingFE == null ? (class$com$tridium$alarm$ui$BAlarmClassMappingFE = BAlarmClassMappingFE.class$("com.tridium.alarm.ui.BAlarmClassMappingFE")) : class$com$tridium$alarm$ui$BAlarmClassMappingFE));
|
||||
protected BWidget popup;
|
||||
protected Context context;
|
||||
protected boolean isMicroEdition = false;
|
||||
protected Command mapCommand;
|
||||
protected Command removeMapCommand;
|
||||
protected Command addDefCommand;
|
||||
protected Command editDefCommand;
|
||||
protected Command delDefCommand;
|
||||
protected MappingTableModel mappingTableModel = new MappingTableModel();
|
||||
protected DefaultTableModel defTableModel;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmClassMappingFE.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassMappingFE;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassDef;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BString;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmClassMappingFE() {
|
||||
if (UiEnv.get().isMicroEdition()) {
|
||||
this.defTableModel = new DefaultTableModel(new String[]{lexicon.getText("alarmClassMapper.name"), lexicon.getText("alarmClassMapper.icon"), lexicon.getText("alarmClassMapper.hyperlink")});
|
||||
this.isMicroEdition = true;
|
||||
} else {
|
||||
this.defTableModel = new DefaultTableModel(new String[]{lexicon.getText("alarmClassMapper.name"), lexicon.getText("alarmClassMapper.icon"), lexicon.getText("alarmClassMapper.hyperlink"), lexicon.getText("alarmClassMapper.sound")});
|
||||
}
|
||||
Command command = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.alarmClassMappingFE"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n;
|
||||
if (BAlarmClassMappingFE.this.popup == null) {
|
||||
BAlarmClassMappingFE.this.popup = BAlarmClassMappingFE.this.createPopup();
|
||||
}
|
||||
if ((n = BDialog.open((BWidget)BAlarmClassMappingFE.this, (String)lexicon.getText("alarmClassMapper.title"), (Object)BAlarmClassMappingFE.this.popup, (int)3)) == 1) {
|
||||
BAlarmClassMappingFE.this.setModified();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton = new BButton(command, false, true);
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add("name", (BValue)new BLabel(lexicon.getText("alarmClassMapper.mapping")));
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add("btn", (BValue)bButton);
|
||||
bGridPane.add("button", (BValue)bToolBar);
|
||||
this.setContent((BWidget)bGridPane);
|
||||
}
|
||||
|
||||
public BWidget createPopup() {
|
||||
this.addDefCommand = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.addDef"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmClassMappingFE.this.addAlarmClassDef();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton = new BButton(this.addDefCommand);
|
||||
this.editDefCommand = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.editDef"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmClassMappingFE.this.editAlarmClassDef();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton2 = new BButton(this.editDefCommand);
|
||||
this.editDefCommand.setEnabled(this.defTableModel.getRowCount() > 0);
|
||||
this.delDefCommand = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.deleteDef"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmClassMappingFE.this.delAlarmClassDef();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton3 = new BButton(this.delDefCommand);
|
||||
this.delDefCommand.setEnabled(this.defTableModel.getRowCount() > 0);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
BEdgePane bEdgePane2 = new BEdgePane();
|
||||
BGridPane bGridPane = new BGridPane(3);
|
||||
bGridPane.add("add", (BValue)bButton);
|
||||
bGridPane.add("edit", (BValue)bButton2);
|
||||
bGridPane.add("del", (BValue)bButton3);
|
||||
bEdgePane2.setCenter((BWidget)new BBorderPane((BWidget)new BTable((TableModel)this.defTableModel, (TableController)new Controller())));
|
||||
bEdgePane2.setBottom((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
this.defTableModel.getTable().setMultipleSelection(false);
|
||||
bEdgePane.setCenter((BWidget)new BTitlePane(lexicon.getText("alarmClassMapper.alarmClassDefs"), (BWidget)bEdgePane2));
|
||||
this.mapCommand = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.mapAlarmClass"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmClassMappingFE.this.mapAlarmClass();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton4 = new BButton(this.mapCommand);
|
||||
this.removeMapCommand = new Command((BWidget)this, BAlarmClassMappingFE.lexicon.module, "commands.deleteAlarmClassMap"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmClassMappingFE.this.deleteAlarmClassMap();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.removeMapCommand.setEnabled(false);
|
||||
BButton bButton5 = new BButton(this.removeMapCommand);
|
||||
BGridPane bGridPane2 = new BGridPane(3);
|
||||
bGridPane2.add("b1", (BValue)bButton4);
|
||||
bGridPane2.add("b3", (BValue)bButton5);
|
||||
BEdgePane bEdgePane3 = new BEdgePane();
|
||||
BTable bTable = new BTable((TableModel)this.mappingTableModel, (TableController)new MappingTableController());
|
||||
bTable.setPreferredSize(800.0, 800.0);
|
||||
bEdgePane3.setCenter((BWidget)new BBorderPane((BWidget)bTable));
|
||||
bEdgePane3.setBottom((BWidget)new BBorderPane((BWidget)bGridPane2));
|
||||
BSplitPane bSplitPane = new BSplitPane(BOrientation.vertical, 50.0);
|
||||
bSplitPane.setWidget1((BWidget)bEdgePane);
|
||||
bSplitPane.setWidget2((BWidget)new BTitlePane(lexicon.getText("alarmClassMapper.alarmClassDefMapping"), (BWidget)bEdgePane3));
|
||||
return bSplitPane;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BAlarmClassMapping bAlarmClassMapping = (BAlarmClassMapping)bObject;
|
||||
this.context = context;
|
||||
BAlarmClassDef[] bAlarmClassDefArray = (BAlarmClassDef[])bAlarmClassMapping.getAlarmClassDefinitions().getChildren(class$com$tridium$alarm$ui$BAlarmClassDef == null ? (class$com$tridium$alarm$ui$BAlarmClassDef = BAlarmClassMappingFE.class$("com.tridium.alarm.ui.BAlarmClassDef")) : class$com$tridium$alarm$ui$BAlarmClassDef);
|
||||
for (int i = 0; i < bAlarmClassDefArray.length; ++i) {
|
||||
if (this.isMicroEdition) {
|
||||
this.defTableModel.addRow(new Object[]{SlotPath.unescape((String)bAlarmClassDefArray[i].getDefName()), bAlarmClassDefArray[i].getAlarmIcon(), bAlarmClassDefArray[i].getAlarmUrl()});
|
||||
continue;
|
||||
}
|
||||
this.defTableModel.addRow(new Object[]{SlotPath.unescape((String)bAlarmClassDefArray[i].getDefName()), bAlarmClassDefArray[i].getAlarmIcon(), bAlarmClassDefArray[i].getAlarmUrl(), bAlarmClassDefArray[i].getAlarmSound()});
|
||||
}
|
||||
this.defTableModel.updateTable();
|
||||
BComponent bComponent = bAlarmClassMapping.getAlarmClassDefMapping();
|
||||
SlotCursor slotCursor = bComponent.getProperties();
|
||||
boolean bl = false;
|
||||
while (slotCursor.next(class$javax$baja$sys$BString == null ? BAlarmClassMappingFE.class$("javax.baja.sys.BString") : class$javax$baja$sys$BString)) {
|
||||
Property property = slotCursor.property();
|
||||
String string = property.getName();
|
||||
BString bString = (BString)slotCursor.get();
|
||||
this.mappingTableModel.addRow(new Object[]{string, bString});
|
||||
}
|
||||
this.mappingTableModel.updateTable();
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject object, Context context) {
|
||||
try {
|
||||
BOrd bOrd;
|
||||
String string;
|
||||
BComponent bComponent = new BComponent();
|
||||
for (int i = 0; i < this.defTableModel.getRowCount(); ++i) {
|
||||
BAlarmClassDef bAlarmClassDef = new BAlarmClassDef();
|
||||
string = SlotPath.escape((String)((String)this.defTableModel.getValueAt(i, 0)));
|
||||
bOrd = (BOrd)this.defTableModel.getValueAt(i, 1);
|
||||
BOrd bOrd2 = (BOrd)this.defTableModel.getValueAt(i, 2);
|
||||
bAlarmClassDef.setDefName(string);
|
||||
bAlarmClassDef.setAlarmIcon(bOrd);
|
||||
bAlarmClassDef.setAlarmUrl(bOrd2);
|
||||
if (!this.isMicroEdition) {
|
||||
BOrd bOrd3 = (BOrd)this.defTableModel.getValueAt(i, 3);
|
||||
bAlarmClassDef.setAlarmSound(bOrd3);
|
||||
}
|
||||
bComponent.add(string, (BValue)bAlarmClassDef);
|
||||
}
|
||||
BComponent bComponent2 = new BComponent();
|
||||
for (int i = 0; i < this.mappingTableModel.getRowCount(); ++i) {
|
||||
string = SlotPath.escape((String)this.mappingTableModel.getAlarmClassName(i));
|
||||
bOrd = (BString)this.mappingTableModel.getValueAt(i, 1);
|
||||
bComponent2.add(string, (BValue)bOrd);
|
||||
}
|
||||
BAlarmClassMapping bAlarmClassMapping = (BAlarmClassMapping)((Object)object);
|
||||
bAlarmClassMapping.setAlarmClassDefinitions(bComponent);
|
||||
bAlarmClassMapping.setAlarmClassDefMapping(bComponent2);
|
||||
object = bAlarmClassMapping;
|
||||
return bAlarmClassMapping;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected BWidget makeAlarmClassDefPane(String string, BAlarmClassDef bAlarmClassDef) {
|
||||
if (bAlarmClassDef == null) {
|
||||
bAlarmClassDef = new BAlarmClassDef();
|
||||
}
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add("nameLbl", (BValue)new BLabel(lexicon.getText("alarmClassMapper.name")));
|
||||
bGridPane.add("nameField", (BValue)new BTextField(string, 20));
|
||||
bGridPane.add("iconLbl", (BValue)new BLabel(lexicon.getText("alarmClassMapper.icon")));
|
||||
BOrdFE bOrdFE = new BOrdFE();
|
||||
bOrdFE.allowLinkButton(false);
|
||||
bOrdFE.loadMenu(new TypeInfo[]{BFileOrdChooser.TYPE.getTypeInfo()});
|
||||
bOrdFE.loadValue((BObject)bAlarmClassDef.getAlarmIcon());
|
||||
bGridPane.add("iconField", (BValue)bOrdFE);
|
||||
bGridPane.add("hyperlinkLbl", (BValue)new BLabel(lexicon.getText("alarmClassMapper.hyperlink")));
|
||||
BOrdFE bOrdFE2 = new BOrdFE();
|
||||
bOrdFE2.allowLinkButton(false);
|
||||
bOrdFE2.loadMenu(new TypeInfo[0]);
|
||||
bOrdFE2.loadValue((BObject)bAlarmClassDef.getAlarmUrl());
|
||||
bGridPane.add("hyperlinkField", (BValue)bOrdFE2);
|
||||
if (!this.isMicroEdition) {
|
||||
bGridPane.add("soundLbl", (BValue)new BLabel(lexicon.getText("alarmClassMapper.sound")));
|
||||
BOrdFE bOrdFE3 = new BOrdFE();
|
||||
bOrdFE3.allowLinkButton(false);
|
||||
bOrdFE3.loadMenu(new TypeInfo[]{BFileOrdChooser.TYPE.getTypeInfo()});
|
||||
bOrdFE3.loadValue((BObject)bAlarmClassDef.getAlarmSound());
|
||||
bGridPane.add("soundField", (BValue)bOrdFE3);
|
||||
}
|
||||
return bGridPane;
|
||||
}
|
||||
|
||||
protected void addAlarmClassDef() {
|
||||
BWidget bWidget = this.makeAlarmClassDefPane("", null);
|
||||
int n = BDialog.open((BWidget)this, (String)lexicon.getText("commands.addDef.label"), (Object)bWidget, (int)3);
|
||||
if (n == 2) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String string = ((BTextField)bWidget.get("nameField")).getText();
|
||||
BOrd bOrd = (BOrd)((BOrdFE)bWidget.get("iconField")).saveValue();
|
||||
BOrd bOrd2 = (BOrd)((BOrdFE)bWidget.get("hyperlinkField")).saveValue();
|
||||
if (!this.isMicroEdition) {
|
||||
BOrd bOrd3 = (BOrd)((BOrdFE)bWidget.get("soundField")).saveValue();
|
||||
this.defTableModel.addRow(new Object[]{string, bOrd, bOrd2, bOrd3});
|
||||
} else {
|
||||
this.defTableModel.addRow(new Object[]{string, bOrd, bOrd2});
|
||||
}
|
||||
this.defTableModel.updateTable();
|
||||
this.editDefCommand.setEnabled(true);
|
||||
this.delDefCommand.setEnabled(true);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void editAlarmClassDef() {
|
||||
BWidget bWidget;
|
||||
int n = this.defTableModel.getTable().getSelection().getRow();
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
BAlarmClassDef bAlarmClassDef = new BAlarmClassDef();
|
||||
String string = (String)this.defTableModel.getValueAt(n, 0);
|
||||
BOrd bOrd = (BOrd)this.defTableModel.getValueAt(n, 1);
|
||||
BOrd bOrd2 = (BOrd)this.defTableModel.getValueAt(n, 2);
|
||||
bAlarmClassDef.setDefName(string);
|
||||
bAlarmClassDef.setAlarmIcon(bOrd);
|
||||
bAlarmClassDef.setAlarmUrl(bOrd2);
|
||||
if (!this.isMicroEdition) {
|
||||
bWidget = (BOrd)this.defTableModel.getValueAt(n, 3);
|
||||
bAlarmClassDef.setAlarmSound((BOrd)bWidget);
|
||||
}
|
||||
bWidget = this.makeAlarmClassDefPane(bAlarmClassDef.getDefName(), bAlarmClassDef);
|
||||
int n2 = BDialog.open((BWidget)this, (String)lexicon.getText("commands.editDef.label"), (Object)bWidget, (int)3);
|
||||
if (n2 == 2) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
string = ((BTextField)bWidget.get("nameField")).getText();
|
||||
bOrd = (BOrd)((BOrdFE)bWidget.get("iconField")).saveValue();
|
||||
bOrd2 = (BOrd)((BOrdFE)bWidget.get("hyperlinkField")).saveValue();
|
||||
this.defTableModel.set(n, 0, (Object)string);
|
||||
this.defTableModel.set(n, 1, (Object)bOrd);
|
||||
this.defTableModel.set(n, 2, (Object)bOrd2);
|
||||
if (!this.isMicroEdition) {
|
||||
BOrd bOrd3 = (BOrd)((BOrdFE)bWidget.get("soundField")).saveValue();
|
||||
this.defTableModel.set(n, 3, (Object)bOrd3);
|
||||
}
|
||||
this.defTableModel.updateTable();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void delAlarmClassDef() {
|
||||
int n = this.defTableModel.getTable().getSelection().getRow();
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
String string = (String)this.defTableModel.getValueAt(n, 0);
|
||||
this.defTableModel.removeRow(n);
|
||||
this.defTableModel.updateTable();
|
||||
this.delDefCommand.setEnabled(this.defTableModel.getRowCount() > 0);
|
||||
this.editDefCommand.setEnabled(this.defTableModel.getRowCount() > 0);
|
||||
try {
|
||||
int n2 = this.mappingTableModel.getRowCount();
|
||||
for (int i = n2 - 1; i >= 0; --i) {
|
||||
String string2 = this.mappingTableModel.getValueAt(i, 1).toString();
|
||||
if (!string.equals(string2)) continue;
|
||||
this.mappingTableModel.removeRow(n);
|
||||
this.mappingTableModel.updateTable();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void mapAlarmClass() {
|
||||
String string;
|
||||
BTextDropDown bTextDropDown = new BTextDropDown(false);
|
||||
for (int i = 0; i < this.defTableModel.getRowCount(); ++i) {
|
||||
string = (String)this.defTableModel.getValueAt(i, 0);
|
||||
bTextDropDown.getList().addItem((Object)string);
|
||||
if (i != 0) continue;
|
||||
bTextDropDown.setText(string);
|
||||
}
|
||||
BAlarmClassFE bAlarmClassFE = new BAlarmClassFE();
|
||||
this.add("fe", (BValue)bAlarmClassFE);
|
||||
bAlarmClassFE.loadValue((BObject)BString.make((String)"defaultAlarmClass"));
|
||||
this.remove((BComplex)bAlarmClassFE);
|
||||
string = new BGridPane(2);
|
||||
string.add("acLbl", (BValue)new BLabel(lexicon.getText("alarm.alarmClass")));
|
||||
string.add("ac", (BValue)bAlarmClassFE);
|
||||
string.add("defLbl", (BValue)new BLabel(lexicon.getText("alarmClassMapper.definition")));
|
||||
string.add("def", (BValue)bTextDropDown);
|
||||
int n = BDialog.open((BWidget)this, (String)lexicon.getText("commands.mapAlarmClass"), (Object)string, (int)3);
|
||||
if (n == 2) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String string2 = bAlarmClassFE.saveValue().toString(this.context);
|
||||
String string3 = bTextDropDown.getText();
|
||||
for (int i = 0; i < this.mappingTableModel.getRowCount(); ++i) {
|
||||
String string4 = (String)this.mappingTableModel.getValueAt(i, 0);
|
||||
if (!string4.equals(string2)) continue;
|
||||
this.mappingTableModel.removeRow(i);
|
||||
this.mappingTableModel.updateTable();
|
||||
}
|
||||
this.mappingTableModel.addRow(new Object[]{string2, BString.make((String)string3)});
|
||||
this.mappingTableModel.updateTable();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void deleteAlarmClassMap() {
|
||||
try {
|
||||
int n = this.mappingTableModel.getTable().getSelection().getRow();
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
this.mappingTableModel.removeRow(n);
|
||||
this.mappingTableModel.updateTable();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class MappingTableController
|
||||
extends TableController {
|
||||
MappingTableController() {
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
if (this.getTable().getSelection().getRowCount() > 0) {
|
||||
BAlarmClassMappingFE.this.removeMapCommand.setEnabled(true);
|
||||
} else {
|
||||
BAlarmClassMappingFE.this.removeMapCommand.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
if (this.getTable().getSelection().getRowCount() > 0) {
|
||||
BAlarmClassMappingFE.this.editDefCommand.setEnabled(true);
|
||||
BAlarmClassMappingFE.this.delDefCommand.setEnabled(true);
|
||||
} else {
|
||||
BAlarmClassMappingFE.this.editDefCommand.setEnabled(false);
|
||||
BAlarmClassMappingFE.this.delDefCommand.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellReleased(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
super.cellReleased(bMouseEvent, n, n2);
|
||||
if (bMouseEvent.getClickCount() == 2) {
|
||||
BAlarmClassMappingFE.this.editAlarmClassDef();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MappingTableModel
|
||||
extends DefaultTableModel {
|
||||
BAlarmService alarmService = null;
|
||||
|
||||
public MappingTableModel() {
|
||||
super(new String[]{lexicon.getText("alarmClassMapper.alarmClass"), lexicon.getText("alarmClassMapper.definition")});
|
||||
}
|
||||
|
||||
public synchronized Object getValueAt(int n, int n2) {
|
||||
if (n2 == 0) {
|
||||
String string = super.getValueAt(n, n2).toString();
|
||||
return this.getAlarmService().getAlarmClassDisplayName(BString.make((String)string), null).toString();
|
||||
}
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
|
||||
public String getAlarmClassName(int n) {
|
||||
return super.getValueAt(n, 0).toString();
|
||||
}
|
||||
|
||||
private BAlarmService getAlarmService() {
|
||||
if (this.alarmService == null) {
|
||||
BWbShell bWbShell = BAlarmClassMappingFE.this.getWbShell();
|
||||
BOrd bOrd = BOrd.make((BOrd)bWbShell.getActiveOrd(), (String)"service:alarm:AlarmService");
|
||||
this.alarmService = (BAlarmService)bOrd.get();
|
||||
}
|
||||
return this.alarmService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* com.tridium.workbench.bql.filter.ColumnNameTableModel
|
||||
* com.tridium.workbench.util.CollectionTableModel
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.collection.ColumnList
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nre.util.IntHashMap
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableCellRenderer
|
||||
* javax.baja.ui.table.TableCellRenderer$Cell
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.view.BWbComponentView
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import com.tridium.workbench.bql.filter.ColumnNameTableModel;
|
||||
import com.tridium.workbench.util.CollectionTableModel;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.collection.ColumnList;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nre.util.IntHashMap;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableCellRenderer;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.view.BWbComponentView;
|
||||
|
||||
public class BAlarmClassSummary
|
||||
extends BWbComponentView {
|
||||
public static final Action updateCommands = BAlarmClassSummary.newAction((int)4, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmClassSummary == null ? (class$com$tridium$alarm$ui$BAlarmClassSummary = BAlarmClassSummary.class$("com.tridium.alarm.ui.BAlarmClassSummary")) : class$com$tridium$alarm$ui$BAlarmClassSummary));
|
||||
private static final String[] ATTRS = new String[]{"displayName", "totalAlarmCount", "openAlarmCount", "inAlarmCount", "unackedAlarmCount", "timeOfLastAlarm", "ackRequired", "priority", "toPathString"};
|
||||
private static final int[] DISPLAY = new int[]{0, 1, 2, 3, 4, 5};
|
||||
private static Lexicon lex = Lexicon.make((String)"alarm");
|
||||
private BTable table = new BTable();
|
||||
private BITable itable;
|
||||
private CollectionTableModel collectionModel;
|
||||
private ToggleCommand enableToOffnormal;
|
||||
private ToggleCommand enableToFault;
|
||||
private Command editAlarmClass;
|
||||
private IntHashMap nameMap;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmClassSummary;
|
||||
|
||||
public void updateCommands() {
|
||||
this.invoke(updateCommands, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmClassSummary() {
|
||||
this.table.setController((TableController)new Controller());
|
||||
this.table.setCellRenderer((TableCellRenderer)new CellRenderer());
|
||||
this.setContent((BWidget)BTitlePane.makePane((String)TYPE.getDisplayName(null), (BTable)this.table, (String)lex.getText("alarm.alarmClasses")));
|
||||
this.add("selectionLink", (BValue)new BLink((BComponent)this.table, (Slot)BTable.selectionModified, (Slot)updateCommands));
|
||||
this.nameMap = new IntHashMap();
|
||||
this.nameMap.put(0, (Object)"alarmClass.name");
|
||||
this.nameMap.put(1, (Object)"alarmClass.totalAlarmCount");
|
||||
this.nameMap.put(2, (Object)"alarmClass.openAlarmCount");
|
||||
this.nameMap.put(3, (Object)"alarmClass.inAlarmCount");
|
||||
this.nameMap.put(4, (Object)"alarmClass.unackedAlarmCount");
|
||||
this.nameMap.put(5, (Object)"alarmClass.timeOfLastAlarm");
|
||||
this.nameMap.put(6, (Object)"alarmClass.ackRequired");
|
||||
this.nameMap.put(7, (Object)"alarmClass.priority");
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) throws Exception {
|
||||
this.updateTable();
|
||||
this.table.fireTableModified(null);
|
||||
}
|
||||
|
||||
private void updateTable() {
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)this.query()).normalize();
|
||||
this.itable = ((BICollection)bOrd2.resolve().get()).toTable();
|
||||
boolean bl = false;
|
||||
int n = -1;
|
||||
boolean bl2 = true;
|
||||
if (this.table.getModel() instanceof AlarmClassSummaryTableModel) {
|
||||
bl = true;
|
||||
n = ((AlarmClassSummaryTableModel)this.table.getModel()).sortCol;
|
||||
bl2 = ((AlarmClassSummaryTableModel)this.table.getModel()).sortAsc;
|
||||
}
|
||||
this.collectionModel = new CollectionTableModel(this.itable, this.getCurrentContext());
|
||||
ColumnNameTableModel columnNameTableModel = new ColumnNameTableModel((TableModel)this.collectionModel, this.nameMap, lex);
|
||||
AlarmClassSummaryTableModel alarmClassSummaryTableModel = new AlarmClassSummaryTableModel((TableModel)columnNameTableModel, DISPLAY);
|
||||
alarmClassSummaryTableModel.setColumnShowable(1, false);
|
||||
alarmClassSummaryTableModel.setColumnShowable(6, false);
|
||||
if (bl && n != -1) {
|
||||
alarmClassSummaryTableModel.sortByColumn(n, bl2);
|
||||
}
|
||||
this.table.setModel((TableModel)alarmClassSummaryTableModel);
|
||||
this.table.relayout();
|
||||
}
|
||||
|
||||
private String query() {
|
||||
StringBuffer stringBuffer = new StringBuffer(128);
|
||||
stringBuffer.append("station:|slot:/|bql:select ");
|
||||
for (int i = 0; i < ATTRS.length; ++i) {
|
||||
if (i != 0) {
|
||||
stringBuffer.append(", ");
|
||||
}
|
||||
stringBuffer.append(ATTRS[i]);
|
||||
}
|
||||
stringBuffer.append(" from alarm:AlarmClass");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public void doUpdateCommands() {
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private class CellRenderer
|
||||
extends TableCellRenderer {
|
||||
private CellRenderer() {
|
||||
}
|
||||
|
||||
public BBrush getBackground(TableCellRenderer.Cell cell) {
|
||||
if (cell.row == this.getTable().getModel().getRowCount() - 2) {
|
||||
return Theme.table().getGridBrush();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class AlarmClassSummaryTableModel
|
||||
extends DynamicTableModel {
|
||||
public int sortCol = -1;
|
||||
public boolean sortAsc = true;
|
||||
|
||||
public AlarmClassSummaryTableModel(TableModel tableModel, int[] nArray) {
|
||||
super(tableModel, nArray);
|
||||
}
|
||||
|
||||
public AlarmClassSummaryTableModel(TableModel tableModel) {
|
||||
super(tableModel);
|
||||
}
|
||||
|
||||
public void sortByColumn(int n, boolean bl) {
|
||||
this.sortCol = n;
|
||||
this.sortAsc = bl;
|
||||
super.sortByColumn(n, bl);
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
if (n < super.getRowCount()) {
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
if (n == super.getRowCount()) {
|
||||
return "";
|
||||
}
|
||||
switch (n2) {
|
||||
case 0: {
|
||||
return lex.getText("alarmClass.total");
|
||||
}
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4: {
|
||||
int n3 = 0;
|
||||
for (int i = 0; i < super.getRowCount(); ++i) {
|
||||
n3 += Integer.parseInt((String)this.getValueAt(i, n2));
|
||||
}
|
||||
return "" + n3;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return super.getRowCount() + 2;
|
||||
}
|
||||
}
|
||||
|
||||
public class GotoPoint
|
||||
extends Goto {
|
||||
public GotoPoint(int n, BITable bITable) {
|
||||
super("alarmClass.goto.alarmClass", n, bITable);
|
||||
}
|
||||
|
||||
public BOrd getTargetOrd() {
|
||||
return BOrd.make((String)("slot:" + BAlarmClassSummary.this.itable.getString(this.row, BAlarmClassSummary.this.itable.getColumns().get("toPathString"))));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Goto
|
||||
extends Command {
|
||||
int row;
|
||||
BITable itable;
|
||||
|
||||
public Goto(String string, int n, BITable bITable) {
|
||||
super((BWidget)BAlarmClassSummary.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmClassSummary == null ? (class$com$tridium$alarm$ui$BAlarmClassSummary = BAlarmClassSummary.class$("com.tridium.alarm.ui.BAlarmClassSummary")) : class$com$tridium$alarm$ui$BAlarmClassSummary)), string);
|
||||
this.row = n;
|
||||
this.itable = bITable;
|
||||
}
|
||||
|
||||
public abstract BOrd getTargetOrd();
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BOrd bOrd = this.getTargetOrd();
|
||||
if (bOrd == null) {
|
||||
return null;
|
||||
}
|
||||
BOrd bOrd2 = ((BWbShell)BAlarmClassSummary.this.getShell()).getActiveOrd();
|
||||
BOrd bOrd3 = BOrd.make((BOrd)bOrd2, (BOrd)bOrd).normalize();
|
||||
((BWbShell)this.getShell()).hyperlink(bOrd3);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class Controller
|
||||
extends TableController {
|
||||
private Controller() {
|
||||
}
|
||||
|
||||
protected void cellDoubleClicked(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
if (n >= this.getTable().getModel().getRowCount() - 2) {
|
||||
return;
|
||||
}
|
||||
ColumnList columnList = BAlarmClassSummary.this.itable.getColumns();
|
||||
BOrd bOrd = null;
|
||||
String string = BAlarmClassSummary.this.itable.getString(n, columnList.get("toPathString"));
|
||||
BOrd bOrd2 = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
bOrd = BOrd.make((BOrd)bOrd2, (String)("slot:" + string)).normalize();
|
||||
if (bOrd != null) {
|
||||
((BWbShell)this.getShell()).hyperlink(bOrd);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
if (n >= this.getTable().getModel().getRowCount() - 2) {
|
||||
return;
|
||||
}
|
||||
ColumnList columnList = BAlarmClassSummary.this.itable.getColumns();
|
||||
String string = BAlarmClassSummary.this.itable.getString(n, columnList.get("toPathString"));
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)("slot:" + string)).normalize();
|
||||
BComponent bComponent = (BComponent)bOrd2.get();
|
||||
BMenu bMenu = new BMenu();
|
||||
bMenu.add(null, (Command)new GotoPoint(n, BAlarmClassSummary.this.itable));
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.filter.BFilterEntry
|
||||
* com.tridium.bql.filter.BFilterSet
|
||||
* com.tridium.ui.UiEnv
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BBrush$Solid
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.SlotCursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.options.BUserOptions
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmClassMapping;
|
||||
import com.tridium.alarm.ui.BAlarmDataCols;
|
||||
import com.tridium.alarm.ui.BTimeZoneDisplay;
|
||||
import com.tridium.bql.filter.BFilterEntry;
|
||||
import com.tridium.bql.filter.BFilterSet;
|
||||
import com.tridium.ui.UiEnv;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.SlotCursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.options.BUserOptions;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
|
||||
public class BAlarmConsoleOptions
|
||||
extends BUserOptions {
|
||||
public static final Property notesRequiredOnAck = BAlarmConsoleOptions.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property soundsEnabled = BAlarmConsoleOptions.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property defaultSoundFile = BAlarmConsoleOptions.newProperty((int)0, (BValue)BOrd.make((String)"module://alarm/com/tridium/alarm/ui/sounds/smallBeep.wav"), (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:AudioFile")));
|
||||
public static final Property continuousAlarm = BAlarmConsoleOptions.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property continuousAlarmDelay = BAlarmConsoleOptions.newProperty((int)0, (BValue)BRelTime.make((long)10000L), null);
|
||||
public static final Property alarmFilters = BAlarmConsoleOptions.newProperty((int)4, (BValue)new BFilterSet(), null);
|
||||
public static final Property lowPriorityColor = BAlarmConsoleOptions.newProperty((int)0, (BValue)((BBrush.Solid)Theme.table().getWindowBackground().getPaint()).getColor(), null);
|
||||
public static final Property midPriorityColor = BAlarmConsoleOptions.newProperty((int)0, (BValue)((BBrush.Solid)Theme.table().getWindowBackground().getPaint()).getColor(), null);
|
||||
public static final Property highPriorityColor = BAlarmConsoleOptions.newProperty((int)0, (BValue)((BBrush.Solid)Theme.table().getWindowBackground().getPaint()).getColor(), null);
|
||||
public static final Property timeZoneDisplay = BAlarmConsoleOptions.newProperty((int)0, (BValue)BTimeZoneDisplay.console, null);
|
||||
public static final Property displayColumns = BAlarmConsoleOptions.newProperty((int)4, (String)"0,2,3,5,6,7,14", null);
|
||||
public static final Property sortColumn = BAlarmConsoleOptions.newProperty((int)4, (int)7, null);
|
||||
public static final Property sortAscending = BAlarmConsoleOptions.newProperty((int)4, (boolean)true, null);
|
||||
public static final Property alarmDataCols = BAlarmConsoleOptions.newProperty((int)4, (BValue)new BAlarmDataCols(new String[]{"msgText"}), null);
|
||||
public static final Property alarmClassMapping = BAlarmConsoleOptions.newProperty((int)0, (BValue)new BAlarmClassMapping(), (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:AlarmClassMappingFE")));
|
||||
public static final Property alarmAckResponses = BAlarmConsoleOptions.newProperty((int)0, (BValue)new BVector(), (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:StringListFE")));
|
||||
public static final Property viewInstructions = BAlarmConsoleOptions.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property instructionsDividerPosition = BAlarmConsoleOptions.newProperty((int)4, (int)80, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmConsoleOptions == null ? (class$com$tridium$alarm$ui$BAlarmConsoleOptions = BAlarmConsoleOptions.class$("com.tridium.alarm.ui.BAlarmConsoleOptions")) : class$com$tridium$alarm$ui$BAlarmConsoleOptions));
|
||||
private static BAlarmConsoleOptions options;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsoleOptions;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
static /* synthetic */ Class class$com$tridium$bql$filter$BFilterEntry;
|
||||
|
||||
public boolean getNotesRequiredOnAck() {
|
||||
return this.getBoolean(notesRequiredOnAck);
|
||||
}
|
||||
|
||||
public void setNotesRequiredOnAck(boolean bl) {
|
||||
this.setBoolean(notesRequiredOnAck, bl, null);
|
||||
}
|
||||
|
||||
public boolean getSoundsEnabled() {
|
||||
return this.getBoolean(soundsEnabled);
|
||||
}
|
||||
|
||||
public void setSoundsEnabled(boolean bl) {
|
||||
this.setBoolean(soundsEnabled, bl, null);
|
||||
}
|
||||
|
||||
public BOrd getDefaultSoundFile() {
|
||||
return (BOrd)this.get(defaultSoundFile);
|
||||
}
|
||||
|
||||
public void setDefaultSoundFile(BOrd bOrd) {
|
||||
this.set(defaultSoundFile, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public boolean getContinuousAlarm() {
|
||||
return this.getBoolean(continuousAlarm);
|
||||
}
|
||||
|
||||
public void setContinuousAlarm(boolean bl) {
|
||||
this.setBoolean(continuousAlarm, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getContinuousAlarmDelay() {
|
||||
return (BRelTime)this.get(continuousAlarmDelay);
|
||||
}
|
||||
|
||||
public void setContinuousAlarmDelay(BRelTime bRelTime) {
|
||||
this.set(continuousAlarmDelay, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BFilterSet getAlarmFilters() {
|
||||
return (BFilterSet)this.get(alarmFilters);
|
||||
}
|
||||
|
||||
public void setAlarmFilters(BFilterSet bFilterSet) {
|
||||
this.set(alarmFilters, (BValue)bFilterSet, null);
|
||||
}
|
||||
|
||||
public BColor getLowPriorityColor() {
|
||||
return (BColor)this.get(lowPriorityColor);
|
||||
}
|
||||
|
||||
public void setLowPriorityColor(BColor bColor) {
|
||||
this.set(lowPriorityColor, (BValue)bColor, null);
|
||||
}
|
||||
|
||||
public BColor getMidPriorityColor() {
|
||||
return (BColor)this.get(midPriorityColor);
|
||||
}
|
||||
|
||||
public void setMidPriorityColor(BColor bColor) {
|
||||
this.set(midPriorityColor, (BValue)bColor, null);
|
||||
}
|
||||
|
||||
public BColor getHighPriorityColor() {
|
||||
return (BColor)this.get(highPriorityColor);
|
||||
}
|
||||
|
||||
public void setHighPriorityColor(BColor bColor) {
|
||||
this.set(highPriorityColor, (BValue)bColor, null);
|
||||
}
|
||||
|
||||
public BTimeZoneDisplay getTimeZoneDisplay() {
|
||||
return (BTimeZoneDisplay)this.get(timeZoneDisplay);
|
||||
}
|
||||
|
||||
public void setTimeZoneDisplay(BTimeZoneDisplay bTimeZoneDisplay) {
|
||||
this.set(timeZoneDisplay, (BValue)bTimeZoneDisplay, null);
|
||||
}
|
||||
|
||||
public String getDisplayColumns() {
|
||||
return this.getString(displayColumns);
|
||||
}
|
||||
|
||||
public void setDisplayColumns(String string) {
|
||||
this.setString(displayColumns, string, null);
|
||||
}
|
||||
|
||||
public int getSortColumn() {
|
||||
return this.getInt(sortColumn);
|
||||
}
|
||||
|
||||
public void setSortColumn(int n) {
|
||||
this.setInt(sortColumn, n, null);
|
||||
}
|
||||
|
||||
public boolean getSortAscending() {
|
||||
return this.getBoolean(sortAscending);
|
||||
}
|
||||
|
||||
public void setSortAscending(boolean bl) {
|
||||
this.setBoolean(sortAscending, bl, null);
|
||||
}
|
||||
|
||||
public BVector getAlarmDataCols() {
|
||||
return (BVector)this.get(alarmDataCols);
|
||||
}
|
||||
|
||||
public void setAlarmDataCols(BVector bVector) {
|
||||
this.set(alarmDataCols, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public BAlarmClassMapping getAlarmClassMapping() {
|
||||
return (BAlarmClassMapping)this.get(alarmClassMapping);
|
||||
}
|
||||
|
||||
public void setAlarmClassMapping(BAlarmClassMapping bAlarmClassMapping) {
|
||||
this.set(alarmClassMapping, (BValue)bAlarmClassMapping, null);
|
||||
}
|
||||
|
||||
public BVector getAlarmAckResponses() {
|
||||
return (BVector)this.get(alarmAckResponses);
|
||||
}
|
||||
|
||||
public void setAlarmAckResponses(BVector bVector) {
|
||||
this.set(alarmAckResponses, (BValue)bVector, null);
|
||||
}
|
||||
|
||||
public boolean getViewInstructions() {
|
||||
return this.getBoolean(viewInstructions);
|
||||
}
|
||||
|
||||
public void setViewInstructions(boolean bl) {
|
||||
this.setBoolean(viewInstructions, bl, null);
|
||||
}
|
||||
|
||||
public double getInstructionsDividerPosition() {
|
||||
return this.getDouble(instructionsDividerPosition);
|
||||
}
|
||||
|
||||
public void setInstructionsDividerPosition(double d) {
|
||||
this.setDouble(instructionsDividerPosition, d, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmConsoleOptions() {
|
||||
if (UiEnv.get().isMicroEdition()) {
|
||||
int n = this.getFlags((Slot)defaultSoundFile);
|
||||
this.setFlags((Slot)defaultSoundFile, n | 4);
|
||||
}
|
||||
}
|
||||
|
||||
public static BAlarmConsoleOptions getDefault() {
|
||||
if (options == null) {
|
||||
options = BWidget.getApplication() == null ? new BAlarmConsoleOptions() : (BAlarmConsoleOptions)BAlarmConsoleOptions.load((Type)TYPE);
|
||||
UiLexicon uiLexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmConsoleOptions.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
SlotCursor slotCursor = options.getAlarmFilters().getProperties();
|
||||
while (slotCursor.next(class$com$tridium$bql$filter$BFilterEntry == null ? BAlarmConsoleOptions.class$("com.tridium.bql.filter.BFilterEntry") : class$com$tridium$bql$filter$BFilterEntry)) {
|
||||
BFilterEntry bFilterEntry = (BFilterEntry)slotCursor.get();
|
||||
bFilterEntry.setLabel(uiLexicon.getText(bFilterEntry.getName()));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if (BWidget.getApplication() != null) {
|
||||
super.save();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.pdf.BPdfFlowPane
|
||||
* com.tridium.pdf.BWidgetToPdf
|
||||
* com.tridium.pdf.gx.PdfDocument
|
||||
* javax.baja.gx.BFont
|
||||
* javax.baja.gx.Insets
|
||||
* javax.baja.pdf.BPdfExporter
|
||||
* javax.baja.pdf.PdfOp
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.view.BIWbViewExporter
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.pdf.BPdfFlowPane;
|
||||
import com.tridium.pdf.BWidgetToPdf;
|
||||
import com.tridium.pdf.gx.PdfDocument;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.gx.BFont;
|
||||
import javax.baja.gx.Insets;
|
||||
import javax.baja.pdf.BPdfExporter;
|
||||
import javax.baja.pdf.PdfOp;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.view.BIWbViewExporter;
|
||||
|
||||
public class BAlarmConsoleToPdf
|
||||
extends BPdfExporter
|
||||
implements BIWbViewExporter {
|
||||
public static final Property showAllColumns = BAlarmConsoleToPdf.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property showOnlySelectedRows = BAlarmConsoleToPdf.newProperty((int)0, (boolean)false, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmConsoleToPdf == null ? (class$com$tridium$alarm$ui$BAlarmConsoleToPdf = BAlarmConsoleToPdf.class$("com.tridium.alarm.ui.BAlarmConsoleToPdf")) : class$com$tridium$alarm$ui$BAlarmConsoleToPdf));
|
||||
private BPdfFlowPane pane;
|
||||
private PdfDocument doc;
|
||||
private PdfOp op;
|
||||
private String msgTxt = null;
|
||||
private String notesTxt = null;
|
||||
private boolean showAlarmData = false;
|
||||
private static Lexicon lex = Lexicon.make((String)"alarm");
|
||||
private static final int MAXSTR = 70;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsoleToPdf;
|
||||
|
||||
public boolean getShowAllColumns() {
|
||||
return this.getBoolean(showAllColumns);
|
||||
}
|
||||
|
||||
public void setShowAllColumns(boolean bl) {
|
||||
this.setBoolean(showAllColumns, bl, null);
|
||||
}
|
||||
|
||||
public boolean getShowOnlySelectedRows() {
|
||||
return this.getBoolean(showOnlySelectedRows);
|
||||
}
|
||||
|
||||
public void setShowOnlySelectedRows(boolean bl) {
|
||||
this.setBoolean(showOnlySelectedRows, bl, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void export(PdfOp pdfOp) throws Exception {
|
||||
this.op = pdfOp;
|
||||
BAlarmConsole bAlarmConsole = (BAlarmConsole)pdfOp.get();
|
||||
TableModel tableModel = bAlarmConsole.sourceTable.getModel();
|
||||
TableSelection tableSelection = bAlarmConsole.sourceTable.getController().getSelection();
|
||||
BWidgetToPdf bWidgetToPdf = new BWidgetToPdf();
|
||||
this.doc = new PdfDocument(pdfOp.getOutputStream(), pdfOp.getWidth(), pdfOp.getHeight());
|
||||
this.pane = new BPdfFlowPane();
|
||||
this.makeHeader(bAlarmConsole.recipient);
|
||||
for (int i = 0; i < tableModel.getRowCount(); ++i) {
|
||||
if (this.getShowOnlySelectedRows() && (!this.getShowOnlySelectedRows() || !tableSelection.isSelected(i))) continue;
|
||||
this.makeRecord(tableModel, i);
|
||||
}
|
||||
this.pane.setupPane();
|
||||
bWidgetToPdf.renderDocument((BWidget)this.pane, this.doc, pdfOp);
|
||||
}
|
||||
|
||||
private void makeHeader(BConsoleRecipient bConsoleRecipient) {
|
||||
BFont bFont = BFont.make((String)lex.getText("alarmConsoleToPdf.font.reportHeader"));
|
||||
BFont bFont2 = BFont.make((String)lex.getText("alarmConsoleToPdf.font.normal"));
|
||||
BLabel bLabel = new BLabel(lex.getText("alarmConsoleToPdf.header") + " " + bConsoleRecipient.getDisplayName((Context)this.op));
|
||||
bLabel.setHalign(BHalign.left);
|
||||
bLabel.setFont(bFont);
|
||||
this.pane.add(null, (BValue)bLabel);
|
||||
BLabel bLabel2 = new BLabel(BAbsTime.now().toString((Context)this.op), bFont2, BHalign.left);
|
||||
this.pane.add(null, (BValue)bLabel2);
|
||||
}
|
||||
|
||||
private void makeRecord(TableModel tableModel, int n) {
|
||||
BFacets bFacets;
|
||||
this.notesTxt = null;
|
||||
this.msgTxt = null;
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)((Object)tableModel.getSubject(n));
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
BString bString = (BString)bAlarmRecord.getAlarmData().get("sourceName");
|
||||
if (bString != null && bString != BString.DEFAULT) {
|
||||
stringBuffer.append(BFormat.make((String)bString.toString((Context)this.op)).format((Object)bAlarmRecord));
|
||||
} else {
|
||||
stringBuffer.append(bAlarmRecord.get(BAlarmRecord.source).toString((Context)this.op));
|
||||
}
|
||||
stringBuffer.append(" - ").append(bAlarmRecord.getSourceState().toString((Context)this.op)).append(" / ");
|
||||
stringBuffer.append(bAlarmRecord.getAckState().toString((Context)this.op));
|
||||
BLabel bLabel = new BLabel(stringBuffer.toString(), BFont.make((String)lex.getText("alarmConsoleToPdf.font.source")), BHalign.left);
|
||||
bLabel.setImage(tableModel.getRowIcon(n));
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
ArrayList<String> arrayList2 = new ArrayList<String>();
|
||||
this.buildColumnsAndValues(arrayList, arrayList2, tableModel, n);
|
||||
if (this.showAlarmData) {
|
||||
bFacets = bAlarmRecord.getAlarmData();
|
||||
String[] stringArray = bFacets.list();
|
||||
arrayList.add("");
|
||||
arrayList2.add("");
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
String string = bFacets.get(stringArray[i]).toString((Context)this.op);
|
||||
if (stringArray[i].equals("notes")) {
|
||||
this.notesTxt = string;
|
||||
continue;
|
||||
}
|
||||
arrayList.add("Alarm Data (" + stringArray[i] + ")");
|
||||
if (stringArray[i].equals("msgText") && string.length() > 70) {
|
||||
string = string.substring(0, 68) + "...";
|
||||
}
|
||||
arrayList2.add(string);
|
||||
}
|
||||
}
|
||||
bFacets = new BTable((TableModel)new Model(arrayList, arrayList2));
|
||||
this.pane.add(null, (BValue)new BLabel(""));
|
||||
this.pane.add(null, (BValue)bLabel);
|
||||
this.pane.add(null, (BValue)bFacets);
|
||||
if (this.msgTxt != null) {
|
||||
this.buildMultiLineLabels("Message", this.msgTxt, ' ');
|
||||
}
|
||||
if (this.notesTxt != null) {
|
||||
this.pane.add(null, (BValue)new BLabel(""));
|
||||
this.buildMultiLineLabels("Note", this.notesTxt, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
private void buildColumnsAndValues(ArrayList arrayList, ArrayList arrayList2, TableModel tableModel, int n) {
|
||||
if (this.getShowAllColumns()) {
|
||||
String[] stringArray = tableModel.getColumnNames();
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
String string = stringArray[i];
|
||||
if (string.equals("Msg Text")) {
|
||||
this.msgTxt = tableModel.getRowValues(n)[i].toString();
|
||||
if (this.msgTxt.length() > 70 || this.msgTxt.length() == 0) continue;
|
||||
this.msgTxt = null;
|
||||
} else if (string.equals("Alarm Data")) {
|
||||
this.showAlarmData = true;
|
||||
continue;
|
||||
}
|
||||
arrayList.add(string);
|
||||
arrayList2.add(tableModel.getRowValues(n)[i]);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < tableModel.getColumnCount(); ++i) {
|
||||
String string = tableModel.getColumnName(i);
|
||||
if (string.equals("Msg Text")) {
|
||||
this.msgTxt = tableModel.getValueAt(n, i).toString();
|
||||
if (this.msgTxt.length() > 70 || this.msgTxt.length() == 0) continue;
|
||||
this.msgTxt = null;
|
||||
} else if (string.equals("Alarm Data")) {
|
||||
this.showAlarmData = true;
|
||||
continue;
|
||||
}
|
||||
arrayList.add(string);
|
||||
arrayList2.add(tableModel.getValueAt(n, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildMultiLineLabels(String string, String string2, char c) {
|
||||
if (string2 == null || string2.length() == 0) {
|
||||
return;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(string).append(": ").append(string2);
|
||||
BLabel[] bLabelArray = this.split(stringBuffer.toString(), c);
|
||||
for (int i = 0; i < bLabelArray.length; ++i) {
|
||||
this.pane.add(null, (BValue)bLabelArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private BLabel[] split(String string, char c) {
|
||||
BFont bFont = BFont.make((String)lex.getText("alarmConsoleToPdf.font.normal"));
|
||||
Insets insets = this.doc.getMargins();
|
||||
double d = this.doc.getPageSize().width - insets.right;
|
||||
ArrayList<BLabel> arrayList = new ArrayList<BLabel>();
|
||||
String string2 = string;
|
||||
while (bFont.width(string2) > d) {
|
||||
int n;
|
||||
int n2 = string2.indexOf(c, 0);
|
||||
boolean bl = false;
|
||||
if (n2 == -1 || bFont.width(string2.substring(0, n2)) > d) {
|
||||
bl = true;
|
||||
n = 1;
|
||||
while (bFont.width(string2.substring(0, n)) < d) {
|
||||
++n;
|
||||
}
|
||||
n2 = n - 2;
|
||||
} else {
|
||||
n = n2;
|
||||
String string3 = string2.substring(0, n2 + 1);
|
||||
while (bFont.width(string3) < d && n != -1) {
|
||||
n2 = n;
|
||||
n = string2.indexOf(c, n + 1);
|
||||
string3 = string2.substring(0, n + 1);
|
||||
}
|
||||
}
|
||||
String string4 = string2.substring(0, n2 + 1);
|
||||
if (bl) {
|
||||
string4 = string4 + "-";
|
||||
}
|
||||
string2 = string2.substring(n2 + 1);
|
||||
arrayList.add(new BLabel(string4, bFont, BHalign.left));
|
||||
}
|
||||
arrayList.add(new BLabel(string2, bFont, BHalign.left));
|
||||
return arrayList.toArray(new BLabel[arrayList.size()]);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Model
|
||||
extends TableModel {
|
||||
private String[] cols = new String[]{"Attribute", "Value"};
|
||||
private ArrayList names = new ArrayList();
|
||||
private ArrayList values = new ArrayList();
|
||||
|
||||
public Model(ArrayList arrayList, ArrayList arrayList2) {
|
||||
this.names = arrayList;
|
||||
this.values = arrayList2;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.names.size();
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.cols.length;
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
return this.cols[n];
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
return n2 == 0 ? this.names.get(n) : this.values.get(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.message.FoxMessage
|
||||
* com.tridium.fox.message.FoxTuple
|
||||
* com.tridium.fox.session.FoxRequest
|
||||
* com.tridium.fox.session.FoxResponse
|
||||
* com.tridium.fox.session.InvalidCommandException
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BAlarmConsoleChannel;
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.fox.FoxAlarmCodec;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalTool;
|
||||
import com.tridium.alarm.ui.portal.BPortalAlarmConsole;
|
||||
import com.tridium.fox.message.FoxMessage;
|
||||
import com.tridium.fox.message.FoxTuple;
|
||||
import com.tridium.fox.session.FoxRequest;
|
||||
import com.tridium.fox.session.FoxResponse;
|
||||
import com.tridium.fox.session.InvalidCommandException;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BAlarmConsoleUIChannel
|
||||
extends BAlarmConsoleChannel {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmConsoleUIChannel == null ? (class$com$tridium$alarm$ui$BAlarmConsoleUIChannel = BAlarmConsoleUIChannel.class$("com.tridium.alarm.ui.BAlarmConsoleUIChannel")) : class$com$tridium$alarm$ui$BAlarmConsoleUIChannel));
|
||||
private Array recips = new Array(class$java$lang$String == null ? (class$java$lang$String = BAlarmConsoleUIChannel.class$("java.lang.String")) : class$java$lang$String);
|
||||
private Array consoles = new Array(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmConsoleUIChannel.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
private HashMap recipOrdMap = new HashMap();
|
||||
private BAlarmPortalTool tool;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsoleUIChannel;
|
||||
static /* synthetic */ Class class$java$lang$String;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmConsoleUIChannel() {
|
||||
super("alarmui");
|
||||
}
|
||||
|
||||
public FoxResponse process(FoxRequest foxRequest) throws Exception {
|
||||
String string = foxRequest.command;
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("AlarmConsoleChannel: command = " + string);
|
||||
}
|
||||
if (string == "new") {
|
||||
return this.newAlarms(foxRequest);
|
||||
}
|
||||
if (string == "error") {
|
||||
return this.error(foxRequest);
|
||||
}
|
||||
throw new InvalidCommandException(string);
|
||||
}
|
||||
|
||||
private FoxResponse newAlarms(FoxRequest foxRequest) {
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("recieved: new");
|
||||
foxRequest.dump();
|
||||
}
|
||||
FoxTuple[] foxTupleArray = foxRequest.list("alarmRec");
|
||||
for (int i = 0; i < foxTupleArray.length; ++i) {
|
||||
try {
|
||||
BAlarmRecord bAlarmRecord = FoxAlarmCodec.decodeAlarm(((FoxMessage)foxTupleArray[i]).getMessage("alarm"));
|
||||
String string = ((FoxMessage)foxTupleArray[i]).getString("ord");
|
||||
BAlarmConsole[] bAlarmConsoleArray = this.getConsolesRegisteredOn(string);
|
||||
for (int j = 0; j < bAlarmConsoleArray.length; ++j) {
|
||||
BOrd bOrd;
|
||||
BAlarmRecord bAlarmRecord2;
|
||||
BOrdList bOrdList;
|
||||
if (bAlarmConsoleArray[j] == null) {
|
||||
bOrdList = bAlarmRecord.getSource();
|
||||
bAlarmRecord2 = (BAlarmRecord)bAlarmRecord.newCopy();
|
||||
bOrd = (BOrd)this.recipOrdMap.get(string);
|
||||
if (bOrd == null) continue;
|
||||
bOrdList = BOrdList.add((BOrdList)bOrdList, (BOrd)bOrd);
|
||||
bAlarmRecord2.setSource(bOrdList);
|
||||
this.tool.processAlarm(bAlarmRecord2);
|
||||
continue;
|
||||
}
|
||||
if (bAlarmConsoleArray[j] instanceof BPortalAlarmConsole) {
|
||||
bOrdList = bAlarmRecord.getSource();
|
||||
bAlarmRecord2 = (BAlarmRecord)bAlarmRecord.newCopy();
|
||||
bOrd = (BOrd)this.recipOrdMap.get(string);
|
||||
if (bOrd == null) continue;
|
||||
bOrdList = BOrdList.add((BOrdList)bOrdList, (BOrd)bOrd);
|
||||
bAlarmRecord2.setSource(bOrdList);
|
||||
bAlarmConsoleArray[j].processAlarm(bAlarmRecord2);
|
||||
continue;
|
||||
}
|
||||
bAlarmConsoleArray[j].processAlarm(bAlarmRecord);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ackAlarms(BConsoleRecipient bConsoleRecipient, BAlarmRecord[] bAlarmRecordArray) throws Exception {
|
||||
int n;
|
||||
int n2 = 100;
|
||||
int n3 = 0;
|
||||
int n4 = n = n2 < bAlarmRecordArray.length ? n2 : bAlarmRecordArray.length;
|
||||
while (n3 < bAlarmRecordArray.length) {
|
||||
int n5;
|
||||
FoxRequest foxRequest = this.makeRequest("ack");
|
||||
foxRequest.add("ord", bConsoleRecipient.getOrdInSession().encodeToString());
|
||||
int n6 = 0;
|
||||
for (n5 = n3; n5 < n; ++n5) {
|
||||
++n6;
|
||||
foxRequest.add("alarm", FoxAlarmCodec.encodeAlarm(bAlarmRecordArray[n5]));
|
||||
}
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("sending: ack");
|
||||
}
|
||||
n5 = foxRequest.list("alarm").length;
|
||||
this.sendAsync(foxRequest);
|
||||
n3 = n;
|
||||
n = (n += n2) < bAlarmRecordArray.length ? n : bAlarmRecordArray.length;
|
||||
}
|
||||
}
|
||||
|
||||
public String getInitialAlarmQuery(BAlarmConsole bAlarmConsole, BConsoleRecipient bConsoleRecipient) throws Exception {
|
||||
return this.getInitialAlarmQuery(bAlarmConsole, bConsoleRecipient, BOrd.NULL);
|
||||
}
|
||||
|
||||
public String getInitialAlarmQuery(BAlarmPortalTool bAlarmPortalTool, BConsoleRecipient bConsoleRecipient) throws Exception {
|
||||
this.tool = bAlarmPortalTool;
|
||||
return this.getInitialAlarmQuery(null, bConsoleRecipient, BOrd.NULL);
|
||||
}
|
||||
|
||||
public String getInitialAlarmQuery(BAlarmConsole bAlarmConsole, BConsoleRecipient bConsoleRecipient, BOrd bOrd) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("getInitialAlarmQuery");
|
||||
String string = bConsoleRecipient.getOrdInSession().encodeToString();
|
||||
foxRequest.add("ord", string);
|
||||
if (bOrd != null && !bOrd.isNull()) {
|
||||
this.recipOrdMap.put(string, bOrd);
|
||||
}
|
||||
try {
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string2 = foxResponse.getString("error", null);
|
||||
if (string2 != null) {
|
||||
throw new Exception(string2);
|
||||
}
|
||||
this.register(bAlarmConsole, string);
|
||||
return foxResponse.getString("query");
|
||||
}
|
||||
catch (InterruptedIOException interruptedIOException) {
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
// empty catch block
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private FoxResponse error(FoxRequest foxRequest) {
|
||||
try {
|
||||
String string = foxRequest.getString("msg");
|
||||
Exception exception = new Exception(foxRequest.getString("error"));
|
||||
String string2 = foxRequest.getString("ord");
|
||||
BAlarmConsole[] bAlarmConsoleArray = this.getConsolesRegisteredOn(string2);
|
||||
for (int i = 0; i < bAlarmConsoleArray.length; ++i) {
|
||||
if (bAlarmConsoleArray[i] == null) continue;
|
||||
bAlarmConsoleArray[i].showError(string, exception);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void unregister(BConsoleRecipient bConsoleRecipient) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("unregister");
|
||||
String string = bConsoleRecipient.getOrdInSession().encodeToString();
|
||||
foxRequest.add("ord", string);
|
||||
try {
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string2 = foxResponse.getString("error", null);
|
||||
if (string2 != null) {
|
||||
throw new Exception(string2);
|
||||
}
|
||||
}
|
||||
catch (InterruptedIOException interruptedIOException) {
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAlarm(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
FoxRequest foxRequest = this.makeRequest("updateAlarm");
|
||||
foxRequest.add("alarm", FoxAlarmCodec.encodeAlarm(bAlarmRecord));
|
||||
if (this.isTraceOn()) {
|
||||
this.trace("sending: update : timestamp: " + bAlarmRecord.getTimestamp());
|
||||
this.trace(" source: " + bAlarmRecord.getSource().encodeToString());
|
||||
}
|
||||
try {
|
||||
FoxResponse foxResponse = this.sendSync(foxRequest);
|
||||
String string = foxResponse.getString("error", null);
|
||||
if (string != null) {
|
||||
throw new Exception(string);
|
||||
}
|
||||
}
|
||||
catch (InterruptedIOException interruptedIOException) {
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
private void register(BAlarmConsole bAlarmConsole, String string) {
|
||||
this.recips.add((Object)string);
|
||||
this.consoles.add((Object)bAlarmConsole);
|
||||
}
|
||||
|
||||
public void unregister(BAlarmConsole bAlarmConsole) {
|
||||
int n = this.consoles.indexOf((Object)bAlarmConsole);
|
||||
if (n < 0) {
|
||||
return;
|
||||
}
|
||||
if (this.consoles.size() > n) {
|
||||
this.consoles.remove(n);
|
||||
}
|
||||
if (this.recips.size() > n) {
|
||||
this.recips.remove(n);
|
||||
}
|
||||
}
|
||||
|
||||
private BAlarmConsole[] getConsolesRegisteredOn(String string) {
|
||||
Array array = new Array(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmConsoleUIChannel.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
for (int i = 0; i < this.recips.size(); ++i) {
|
||||
if (!this.recips.get(i).equals(string)) continue;
|
||||
array.add(this.consoles.get(i));
|
||||
}
|
||||
return (BAlarmConsole[])array.trim();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BAlarmDataCols
|
||||
extends BVector {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmDataCols == null ? (class$com$tridium$alarm$ui$BAlarmDataCols = BAlarmDataCols.class$("com.tridium.alarm.ui.BAlarmDataCols")) : class$com$tridium$alarm$ui$BAlarmDataCols));
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDataCols;
|
||||
|
||||
public BAlarmDataCols() {
|
||||
}
|
||||
|
||||
public BAlarmDataCols(String[] stringArray) {
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
this.add(stringArray[i], (BValue)BString.make((String)stringArray[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BMonth
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BRadioButton
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.ToggleCommandGroup
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.BWbEditor
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmDbView;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BMonth;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BRadioButton;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.ToggleCommandGroup;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.BWbEditor;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BAlarmDbMaintenance
|
||||
extends BAlarmDbView {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmDbMaintenance == null ? (class$com$tridium$alarm$ui$BAlarmDbMaintenance = BAlarmDbMaintenance.class$("com.tridium.alarm.ui.BAlarmDbMaintenance")) : class$com$tridium$alarm$ui$BAlarmDbMaintenance));
|
||||
private static Lexicon lex = Lexicon.make((String)"alarm");
|
||||
private ToggleCommand clearRecordsBeforeSelected;
|
||||
private ToggleCommand clearAllRecords;
|
||||
private ToggleCommand clearOldRecords;
|
||||
private Command runMaintenance;
|
||||
private BWbEditor dateEditor;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDbMaintenance;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) {
|
||||
super.doLoadValue(bObject, context);
|
||||
BWidget bWidget = this.getContent();
|
||||
this.setContent((BWidget)new BLabel(""));
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
bGridPane.setValign(BValign.top);
|
||||
OptionGroup optionGroup = new OptionGroup();
|
||||
this.clearOldRecords = new ClearOldRecords();
|
||||
optionGroup.add(this.clearOldRecords);
|
||||
bGridPane.add("clearOld", (BValue)new BRadioButton(this.clearOldRecords));
|
||||
this.dateEditor = BWbFieldEditor.makeFor((BObject)BAbsTime.DEFAULT);
|
||||
BAbsTime bAbsTime = Clock.time();
|
||||
BAbsTime bAbsTime2 = BAbsTime.make((int)(bAbsTime.getYear() - 5), (BMonth)bAbsTime.getMonth(), (int)bAbsTime.getDay());
|
||||
this.dateEditor.loadValue((BObject)bAbsTime2);
|
||||
BFlowPane bFlowPane = new BFlowPane();
|
||||
bFlowPane.add("before", (BValue)new BLabel(lex.getText("before")));
|
||||
bFlowPane.add("dateEditor", (BValue)this.dateEditor);
|
||||
bGridPane.add("date", (BValue)new BBorderPane((BWidget)bFlowPane, 0.0, 0.0, 0.0, 10.0));
|
||||
this.clearRecordsBeforeSelected = new ClearRecordsBeforeSelected();
|
||||
optionGroup.add(this.clearRecordsBeforeSelected);
|
||||
bGridPane.add("clearBeforeSelected", (BValue)new BRadioButton(this.clearRecordsBeforeSelected));
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
this.clearAllRecords = new ClearAllRecords();
|
||||
optionGroup.add(this.clearAllRecords);
|
||||
bGridPane.add("clearAll", (BValue)new BRadioButton(this.clearAllRecords));
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
this.runMaintenance = new RunMaintenance();
|
||||
BButton bButton = new BButton(this.runMaintenance);
|
||||
BGridPane bGridPane2 = new BGridPane(1);
|
||||
bGridPane2.add("run", (BValue)bButton);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
bEdgePane.setBottom((BWidget)bGridPane2);
|
||||
BEdgePane bEdgePane2 = new BEdgePane();
|
||||
bEdgePane2.setCenter(bWidget);
|
||||
bEdgePane2.setBottom((BWidget)bEdgePane);
|
||||
this.setContent((BWidget)bEdgePane2);
|
||||
this.query();
|
||||
}
|
||||
|
||||
public void runMaintenance() {
|
||||
try {
|
||||
if (this.clearAllRecords.isSelected()) {
|
||||
String string;
|
||||
String string2 = lex.getText("confirmClear.title");
|
||||
if (BDialog.confirm((BWidget)this, (String)string2, (Object)(string = lex.getText("confirmClear"))) != 4) {
|
||||
return;
|
||||
}
|
||||
} else if (this.clearRecordsBeforeSelected.isSelected()) {
|
||||
int n = this.table.getSelection().getRow();
|
||||
if (n == -1) {
|
||||
BDialog.error((BWidget)this, (String)lex.getText("confirmClear.title"), (Object)lex.getText("alarm.noRecordSelected"));
|
||||
} else {
|
||||
String string;
|
||||
BAbsTime bAbsTime = this.model.getRecord(n).getTimestamp();
|
||||
String string3 = lex.getText("confirmClear.title");
|
||||
if (BDialog.confirm((BWidget)this, (String)string3, (Object)(string = lex.getText("confirmClear"))) != 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (this.clearOldRecords.isSelected()) {
|
||||
BAbsTime bAbsTime = (BAbsTime)this.dateEditor.saveValue();
|
||||
String string = lex.getText("confirmClear.title");
|
||||
String string4 = lex.getText("confirmClear.before", new Object[]{bAbsTime.toString()});
|
||||
if (BDialog.confirm((BWidget)this, (String)string, (Object)string4) != 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.query();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
new MaintenanceThread().start();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
protected void cellReleased(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
super.cellReleased(bMouseEvent, n, n2);
|
||||
if (bMouseEvent.getClickCount() == 2) {
|
||||
BAlarmDbMaintenance.this.showDetailsDialog(BAlarmDbMaintenance.this.model.getRecord(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RunMaintenance
|
||||
extends Command {
|
||||
public RunMaintenance() {
|
||||
super((BWidget)BAlarmDbMaintenance.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmDbMaintenance == null ? (class$com$tridium$alarm$ui$BAlarmDbMaintenance = BAlarmDbMaintenance.class$("com.tridium.alarm.ui.BAlarmDbMaintenance")) : class$com$tridium$alarm$ui$BAlarmDbMaintenance)), "command.runMaintenance");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmDbMaintenance.this.runMaintenance();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class ClearOldRecords
|
||||
extends ToggleCommand {
|
||||
public ClearOldRecords() {
|
||||
super((BWidget)BAlarmDbMaintenance.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmDbMaintenance == null ? (class$com$tridium$alarm$ui$BAlarmDbMaintenance = BAlarmDbMaintenance.class$("com.tridium.alarm.ui.BAlarmDbMaintenance")) : class$com$tridium$alarm$ui$BAlarmDbMaintenance)), "command.clearOldRecords");
|
||||
}
|
||||
}
|
||||
|
||||
private class ClearRecordsBeforeSelected
|
||||
extends ToggleCommand {
|
||||
public ClearRecordsBeforeSelected() {
|
||||
super((BWidget)BAlarmDbMaintenance.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmDbMaintenance == null ? (class$com$tridium$alarm$ui$BAlarmDbMaintenance = BAlarmDbMaintenance.class$("com.tridium.alarm.ui.BAlarmDbMaintenance")) : class$com$tridium$alarm$ui$BAlarmDbMaintenance)), "command.clearRecordsBeforeSelected");
|
||||
}
|
||||
}
|
||||
|
||||
private class ClearAllRecords
|
||||
extends ToggleCommand {
|
||||
public ClearAllRecords() {
|
||||
super((BWidget)BAlarmDbMaintenance.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmDbMaintenance == null ? (class$com$tridium$alarm$ui$BAlarmDbMaintenance = BAlarmDbMaintenance.class$("com.tridium.alarm.ui.BAlarmDbMaintenance")) : class$com$tridium$alarm$ui$BAlarmDbMaintenance)), "command.clearAllRecords");
|
||||
}
|
||||
}
|
||||
|
||||
private class OptionGroup
|
||||
extends ToggleCommandGroup {
|
||||
private OptionGroup() {
|
||||
}
|
||||
|
||||
public void selected(ToggleCommand toggleCommand) {
|
||||
if (BAlarmDbMaintenance.this.dateEditor != null) {
|
||||
BAlarmDbMaintenance.this.dateEditor.setReadonly(toggleCommand != BAlarmDbMaintenance.this.clearOldRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MaintenanceThread
|
||||
extends Thread {
|
||||
public void run() {
|
||||
BAlarmDbMaintenance.this.enterBusy();
|
||||
try {
|
||||
if (BAlarmDbMaintenance.this.clearAllRecords.isSelected()) {
|
||||
BAlarmDbMaintenance.this.getAlarmDbChannel().clearAllRecords();
|
||||
} else if (BAlarmDbMaintenance.this.clearRecordsBeforeSelected.isSelected()) {
|
||||
int n = BAlarmDbMaintenance.this.table.getSelection().getRow();
|
||||
BAbsTime bAbsTime = BAlarmDbMaintenance.this.model.getRecord(n).getTimestamp();
|
||||
BAlarmDbMaintenance.this.getAlarmDbChannel().clearOldRecords(bAbsTime);
|
||||
BAlarmDbMaintenance.this.model.getSelection().deselectAll();
|
||||
} else if (BAlarmDbMaintenance.this.clearOldRecords.isSelected()) {
|
||||
BAbsTime bAbsTime = (BAbsTime)BAlarmDbMaintenance.this.dateEditor.saveValue();
|
||||
BAlarmDbMaintenance.this.getAlarmDbChannel().clearOldRecords(bAbsTime);
|
||||
}
|
||||
BAlarmDbMaintenance.this.query();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
BAlarmDbMaintenance.this.exitBusy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,584 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.filter.BAbsTimeFilter
|
||||
* com.tridium.bql.filter.BFilterEntry
|
||||
* com.tridium.bql.filter.BFilterSet
|
||||
* com.tridium.bql.util.BDynamicTimeRange
|
||||
* com.tridium.fox.sys.BFoxClientConnection
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.workbench.bql.filter.BFilterSetEditor
|
||||
* com.tridium.workbench.fieldeditors.BDynamicTimeRangeFE
|
||||
* com.tridium.workbench.fieldeditors.BFrozenEnumFE
|
||||
* javax.baja.agent.AgentFilter
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.bql.BIBqlFilter
|
||||
* javax.baja.bql.BqlQuery
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
* javax.baja.workbench.view.BWbComponentView
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.fox.BAlarmDbChannel;
|
||||
import com.tridium.alarm.ui.AlarmDbTableModel;
|
||||
import com.tridium.alarm.ui.BAlarmConsoleOptions;
|
||||
import com.tridium.alarm.ui.BAlarmDetailsDialog;
|
||||
import com.tridium.alarm.ui.BIAlarmServiceView;
|
||||
import com.tridium.alarm.ui.BNotesDialog;
|
||||
import com.tridium.alarm.ui.BTimeZoneDisplay;
|
||||
import com.tridium.alarm.ui.ConsoleColumns;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import com.tridium.bql.filter.BAbsTimeFilter;
|
||||
import com.tridium.bql.filter.BFilterEntry;
|
||||
import com.tridium.bql.filter.BFilterSet;
|
||||
import com.tridium.bql.util.BDynamicTimeRange;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.workbench.bql.filter.BFilterSetEditor;
|
||||
import com.tridium.workbench.fieldeditors.BDynamicTimeRangeFE;
|
||||
import com.tridium.workbench.fieldeditors.BFrozenEnumFE;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.agent.AgentFilter;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.alarm.BAlarmDatabase;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.bql.BIBqlFilter;
|
||||
import javax.baja.bql.BqlQuery;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
import javax.baja.workbench.view.BWbComponentView;
|
||||
|
||||
public class BAlarmDbView
|
||||
extends BWbComponentView
|
||||
implements BIAlarmServiceView {
|
||||
public static final Property defaultTimeRange = BAlarmDbView.newProperty((int)0, (BValue)BDynamicTimeRange.DEFAULT, null);
|
||||
public static final Property timeZoneDisplay = BAlarmDbView.newProperty((int)0, (BValue)BTimeZoneDisplay.console, null);
|
||||
public static final Action query = BAlarmDbView.newAction((int)16, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmDbView == null ? (class$com$tridium$alarm$ui$BAlarmDbView = BAlarmDbView.class$("com.tridium.alarm.ui.BAlarmDbView")) : class$com$tridium$alarm$ui$BAlarmDbView));
|
||||
private static UiLexicon lex = new UiLexicon(class$com$tridium$alarm$ui$BAlarmDbView == null ? (class$com$tridium$alarm$ui$BAlarmDbView = BAlarmDbView.class$("com.tridium.alarm.ui.BAlarmDbView")) : class$com$tridium$alarm$ui$BAlarmDbView);
|
||||
public static final BFacets TIME_FACETS = BFacets.make((String)"showSeconds", (boolean)true);
|
||||
BTable table;
|
||||
AlarmDbTableModel model;
|
||||
BAlarmService alarmService;
|
||||
Context context;
|
||||
private BAlarmDatabase alarmDatabase;
|
||||
private BFilterSet filterSet;
|
||||
private BDynamicTimeRangeFE timeRangeEd;
|
||||
private Command filterCmd;
|
||||
private Command notesCmd;
|
||||
private Command tzCmd;
|
||||
private Command addColumnCommand;
|
||||
private Command removeColumnCommand;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDbView;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BString;
|
||||
static /* synthetic */ Class class$java$lang$Integer;
|
||||
|
||||
public BDynamicTimeRange getDefaultTimeRange() {
|
||||
return (BDynamicTimeRange)this.get(defaultTimeRange);
|
||||
}
|
||||
|
||||
public void setDefaultTimeRange(BDynamicTimeRange bDynamicTimeRange) {
|
||||
this.set(defaultTimeRange, (BValue)bDynamicTimeRange, null);
|
||||
}
|
||||
|
||||
public BTimeZoneDisplay getTimeZoneDisplay() {
|
||||
return (BTimeZoneDisplay)this.get(timeZoneDisplay);
|
||||
}
|
||||
|
||||
public void setTimeZoneDisplay(BTimeZoneDisplay bTimeZoneDisplay) {
|
||||
this.set(timeZoneDisplay, (BValue)bTimeZoneDisplay, null);
|
||||
}
|
||||
|
||||
public void query() {
|
||||
this.invoke(query, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public ConsoleColumns getConsoleColumns() {
|
||||
if (this.model != null) {
|
||||
return this.model.getColumns();
|
||||
}
|
||||
ConsoleColumns consoleColumns = new ConsoleColumns();
|
||||
BString[] bStringArray = (BString[])BAlarmConsoleOptions.getDefault().getAlarmDataCols().getChildren(class$javax$baja$sys$BString == null ? (class$javax$baja$sys$BString = BAlarmDbView.class$("javax.baja.sys.BString")) : class$javax$baja$sys$BString);
|
||||
for (int i = 0; i < bStringArray.length; ++i) {
|
||||
consoleColumns.addDataColumn(null, bStringArray[i].toString());
|
||||
}
|
||||
return consoleColumns;
|
||||
}
|
||||
|
||||
public int[] getDefaultColumns() {
|
||||
Object object;
|
||||
String string = BAlarmConsoleOptions.getDefault().getDisplayColumns();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, ",");
|
||||
Array array = new Array(class$java$lang$Integer == null ? (class$java$lang$Integer = BAlarmDbView.class$("java.lang.Integer")) : class$java$lang$Integer);
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
object = stringTokenizer.nextToken();
|
||||
array.add((Object)new Integer((String)object));
|
||||
}
|
||||
object = new int[array.size()];
|
||||
for (int i = 0; i < array.size(); ++i) {
|
||||
object[i] = (Integer)array.get(i);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public int getSortColumn() {
|
||||
return BAlarmConsoleOptions.getDefault().getSortColumn();
|
||||
}
|
||||
|
||||
public boolean getSortDirection() {
|
||||
return BAlarmConsoleOptions.getDefault().getSortAscending();
|
||||
}
|
||||
|
||||
public BTable getTable() {
|
||||
return this.table;
|
||||
}
|
||||
|
||||
public BAlarmService getAlarmService(BAlarmRecord bAlarmRecord) {
|
||||
return this.alarmService;
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) {
|
||||
this.filterSet = this.buildFilterSet();
|
||||
if (bObject instanceof BAlarmService) {
|
||||
this.alarmService = (BAlarmService)bObject;
|
||||
this.alarmDatabase = (BAlarmDatabase)BOrd.make((BOrd)this.alarmService.getAbsoluteOrd(), (BOrd)BOrd.make((String)"alarm:")).get();
|
||||
} else if (bObject instanceof BAlarmDatabase) {
|
||||
this.alarmDatabase = (BAlarmDatabase)bObject;
|
||||
this.alarmService = this.getAlarmService();
|
||||
}
|
||||
this.context = context;
|
||||
this.model = new AlarmDbTableModel(this.getConsoleColumns());
|
||||
this.model.init(this, context);
|
||||
this.table = new BTable((TableModel)new DynamicTableModel((TableModel)this.model, this.getDefaultColumns()), (TableController)new Controller());
|
||||
this.table.setMultipleSelection(false);
|
||||
this.model.options.setTimeZoneDisplay(this.getTimeZoneDisplay());
|
||||
this.filterCmd = new Command((BWidget)this, BAlarmDbView.lex.module, "commands.filter"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmDbView.this.configFilters();
|
||||
BAlarmDbView.this.query();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.notesCmd = new Command((BWidget)this, BAlarmDbView.lex.module, "commands.notes"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BAlarmDbView.this.table.getSelection().getRow();
|
||||
if (n != -1) {
|
||||
BAlarmRecord bAlarmRecord = BAlarmDbView.this.model.getRecord(n);
|
||||
BAlarmDbView.this.showNotes(bAlarmRecord);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.tzCmd = new Command((BWidget)this, BAlarmDbView.lex.module, "commands.timeZoneDisplay"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BFrozenEnumFE bFrozenEnumFE = new BFrozenEnumFE();
|
||||
bFrozenEnumFE.loadValue((BObject)BAlarmDbView.this.getTimeZoneDisplay());
|
||||
int n = BDialog.open((BWidget)BAlarmDbView.this, (String)lex.getText("commands.timeZoneDisplay.label"), (Object)bFrozenEnumFE, (int)3);
|
||||
if (n == 2) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
BTimeZoneDisplay bTimeZoneDisplay = (BTimeZoneDisplay)bFrozenEnumFE.saveValue();
|
||||
BAlarmDbView.this.setTimeZoneDisplay(bTimeZoneDisplay);
|
||||
BAlarmDbView.this.model.options.setTimeZoneDisplay(bTimeZoneDisplay);
|
||||
BAlarmDbView.this.model.options.save();
|
||||
BAlarmDbView.this.repaint();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BAlarmDbView.this, (String)"Cannot Save", (Object)exception.getMessage(), (Throwable)exception);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.addColumnCommand = new Command((BWidget)this, BAlarmDbView.lex.module, "commands.addColumn"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add("lbl", (BValue)new BLabel("AlarmData."));
|
||||
BTextField bTextField = new BTextField("");
|
||||
bGridPane.add("tf", (BValue)bTextField);
|
||||
int n = BDialog.open((BWidget)BAlarmDbView.this, (String)lex.getText("commands.addColumn.label"), (Object)bGridPane, (int)3, (BImage)null);
|
||||
if (n == 1) {
|
||||
try {
|
||||
BAlarmDbView.this.getConsoleColumns().addDataColumn(null, bTextField.getText());
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
DynamicTableModel dynamicTableModel = (DynamicTableModel)BAlarmDbView.this.table.getModel();
|
||||
dynamicTableModel.setColumnShowable(BAlarmDbView.this.getConsoleColumns().getColumnCount() - 1, true);
|
||||
dynamicTableModel.setShowColumn(BAlarmDbView.this.getConsoleColumns().getColumnCount() - 1, true);
|
||||
dynamicTableModel.updateTable();
|
||||
}
|
||||
BAlarmDbView.this.model.options.getAlarmDataCols().add(SlotPath.escape((String)bTextField.getText()), (BValue)BString.make((String)bTextField.getText()));
|
||||
BAlarmDbView.this.model.options.save();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.removeColumnCommand = new Command((BWidget)this, BAlarmDbView.lex.module, "commands.removeColumn"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add("lbl", (BValue)new BLabel("AlarmData."));
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
BString[] bStringArray = (BString[])BAlarmDbView.this.model.options.getAlarmDataCols().getChildren(class$javax$baja$sys$BString == null ? (class$javax$baja$sys$BString = BAlarmDbView.class$("javax.baja.sys.BString")) : class$javax$baja$sys$BString);
|
||||
for (int i = 0; i < bStringArray.length; ++i) {
|
||||
arrayList.add(bStringArray[i].toString());
|
||||
}
|
||||
BTextDropDown bTextDropDown = new BTextDropDown(arrayList, 20, false);
|
||||
bGridPane.add("tf", (BValue)bTextDropDown);
|
||||
int n = BDialog.open((BWidget)BAlarmDbView.this, (String)lex.getText("commands.removeColumn.label"), (Object)bGridPane, (int)3, (BImage)null);
|
||||
if (n == 1) {
|
||||
String string = bTextDropDown.getText();
|
||||
int n2 = BAlarmDbView.this.getConsoleColumns().dataColumnIndex(string);
|
||||
if (n2 == -1) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
int n3;
|
||||
DynamicTableModel dynamicTableModel = (DynamicTableModel)BAlarmDbView.this.table.getModel();
|
||||
boolean[] blArray = new boolean[BAlarmDbView.this.getConsoleColumns().getColumnCount()];
|
||||
for (n3 = 0; n3 < blArray.length; ++n3) {
|
||||
blArray[n3] = dynamicTableModel.showColumn(n3);
|
||||
}
|
||||
for (n3 = n2; n3 < blArray.length - 1; ++n3) {
|
||||
blArray[n3] = blArray[n3 + 1];
|
||||
}
|
||||
blArray[blArray.length - 1] = false;
|
||||
for (n3 = 0; n3 < blArray.length; ++n3) {
|
||||
dynamicTableModel.setShowColumn(n3, blArray[n3]);
|
||||
}
|
||||
}
|
||||
BAlarmDbView.this.getConsoleColumns().removeDataColumn(string);
|
||||
BAlarmDbView.this.model.options.getAlarmDataCols().remove(SlotPath.escape((String)bTextDropDown.getText()));
|
||||
BAlarmDbView.this.model.options.save();
|
||||
BAlarmDbView.this.model.updateTable();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BGridPane bGridPane = new BGridPane(3);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
this.timeRangeEd = new BDynamicTimeRangeFE();
|
||||
this.timeRangeEd.loadValue((BObject)BDynamicTimeRange.TODAY);
|
||||
bGridPane.add("timeRangeQuery", (BValue)this.timeRangeEd);
|
||||
BDynamicTimeRange bDynamicTimeRange = this.getDefaultTimeRange();
|
||||
if (!bDynamicTimeRange.equals((Object)BDynamicTimeRange.DEFAULT)) {
|
||||
this.timeRangeEd.loadValue((BObject)bDynamicTimeRange, context);
|
||||
}
|
||||
this.linkTo("rangeLink", (BComponent)this.timeRangeEd, (Slot)BWbFieldEditor.setModified, (Slot)query);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setTop((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
bEdgePane.setCenter((BWidget)BTitlePane.makePane((String)lex.getText("alarm.alarmHistory"), (BTable)this.table, (String)lex.getText("alarm.alarms")));
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
this.query();
|
||||
}
|
||||
|
||||
public BToolBar getViewToolBar() {
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add("filter", this.filterCmd);
|
||||
bToolBar.add("notes", this.notesCmd);
|
||||
bToolBar.add("timezone", this.tzCmd);
|
||||
return bToolBar;
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
super.stopped();
|
||||
DynamicTableModel dynamicTableModel = (DynamicTableModel)this.table.getModel();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < dynamicTableModel.getRootColumnCount(); ++i) {
|
||||
if (!dynamicTableModel.showColumn(i)) continue;
|
||||
stringBuffer.append(i + ",");
|
||||
}
|
||||
if (dynamicTableModel.getRootColumnCount() > 0) {
|
||||
this.model.options.setDisplayColumns(stringBuffer.toString());
|
||||
}
|
||||
this.model.options.setSortColumn(this.model.getLastSortColumn());
|
||||
this.model.options.setSortAscending(this.model.getLastSortAscending());
|
||||
if (this.model != null) {
|
||||
this.model.options.save();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void doQuery() {
|
||||
this.enterBusy();
|
||||
try {
|
||||
BAbsTimeFilter bAbsTimeFilter;
|
||||
BDynamicTimeRange bDynamicTimeRange;
|
||||
Object object;
|
||||
StringBuffer stringBuffer;
|
||||
StringBuffer stringBuffer2 = new StringBuffer("select * ");
|
||||
if (this.filterSet != null) {
|
||||
stringBuffer = new StringBuffer(64);
|
||||
object = this.filterSet.getPredicate();
|
||||
if (object != null && object.length() > 0) {
|
||||
if (stringBuffer.length() != 0) {
|
||||
stringBuffer.append(" and ");
|
||||
}
|
||||
stringBuffer.append((String)object);
|
||||
}
|
||||
if (!(bDynamicTimeRange = (BDynamicTimeRange)this.timeRangeEd.saveValue()).equals((Object)BDynamicTimeRange.DEFAULT)) {
|
||||
bAbsTimeFilter = new BAbsTimeFilter();
|
||||
bAbsTimeFilter.initFromDynamicTimeRange(bDynamicTimeRange);
|
||||
String string = bAbsTimeFilter.getPredicate(BAlarmRecord.timestamp.getName());
|
||||
if (stringBuffer.length() != 0) {
|
||||
stringBuffer.append(" and ");
|
||||
}
|
||||
stringBuffer.append(string.toString());
|
||||
}
|
||||
if (stringBuffer.length() != 0) {
|
||||
stringBuffer2.append(" where ").append(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
if (null == this.alarmDatabase) {
|
||||
this.alarmDatabase = (BAlarmDatabase)BOrd.make((BOrd)this.alarmService.getAbsoluteOrd(), (BOrd)BOrd.make((String)"alarm:")).get();
|
||||
}
|
||||
try {
|
||||
stringBuffer = this.alarmDatabase.doBqlQuery(BqlQuery.make((String)stringBuffer2.toString()));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
bDynamicTimeRange = BOrd.make((BOrd)((BWbShell)this.getShell()).getActiveOrd(), (BOrd)BOrd.make((String)("alarm:|bql:" + stringBuffer2.toString())));
|
||||
bAbsTimeFilter = (BICollection)bDynamicTimeRange.resolve(this.getCurrentValue()).get();
|
||||
stringBuffer = bAbsTimeFilter.cursor();
|
||||
}
|
||||
this.model.clear();
|
||||
while (stringBuffer.next()) {
|
||||
object = (BAlarmRecord)stringBuffer.get();
|
||||
if (!this.filterSet.accept((BComplex)object)) continue;
|
||||
this.model.add((BAlarmRecord)((Object)object));
|
||||
}
|
||||
this.model.sortByColumn(this.getSortColumn(), this.getSortDirection());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
this.exitBusy();
|
||||
this.table.sizeColumnsToFit();
|
||||
}
|
||||
this.table.fireTableModified(null);
|
||||
}
|
||||
|
||||
public BAlarmService getAlarmService() {
|
||||
if (this.alarmService == null) {
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
try {
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)"service:alarm:AlarmService");
|
||||
this.alarmService = (BAlarmService)bOrd2.resolve().get();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return this.alarmService;
|
||||
}
|
||||
|
||||
public void configFilters() {
|
||||
BFilterSetEditor bFilterSetEditor = new BFilterSetEditor();
|
||||
bFilterSetEditor.loadValue((BObject)this.filterSet);
|
||||
BBorderPane bBorderPane = new BBorderPane((BWidget)bFilterSetEditor);
|
||||
if (BDialog.open((BWidget)this, (String)"Filters", (Object)bBorderPane, (int)3) != 2) {
|
||||
try {
|
||||
if (bFilterSetEditor.isModified()) {
|
||||
this.filterSet = (BFilterSet)bFilterSetEditor.saveValue();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BFilterSet buildFilterSet() {
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
BFilterSet bFilterSet = new BFilterSet();
|
||||
Property[] propertyArray = bAlarmRecord.getPropertiesArray();
|
||||
for (int i = 0; i < propertyArray.length; ++i) {
|
||||
BValue bValue;
|
||||
AgentList agentList;
|
||||
if (propertyArray[i].equals(BAlarmRecord.timestamp) || (agentList = (bValue = bAlarmRecord.get(propertyArray[i])).getAgents().filter(AgentFilter.is((Type)BIBqlFilter.TYPE))).size() == 0) continue;
|
||||
BIBqlFilter bIBqlFilter = (BIBqlFilter)agentList.getDefault().getInstance();
|
||||
bIBqlFilter.init((BObject)bValue);
|
||||
BFilterEntry bFilterEntry = new BFilterEntry(false, propertyArray[i].getDefaultDisplayName(this.getCurrentContext()), bIBqlFilter);
|
||||
bFilterSet.add(propertyArray[i].getName(), (BValue)bFilterEntry, 0, bAlarmRecord.getSlotFacets((Slot)propertyArray[i]), null);
|
||||
}
|
||||
return bFilterSet;
|
||||
}
|
||||
|
||||
public void showDetailsDialog(BAlarmRecord bAlarmRecord) {
|
||||
BAlarmDetailsDialog bAlarmDetailsDialog = new BAlarmDetailsDialog(this.alarmService, this.getTimeZoneDisplay(), bAlarmRecord, (ConsoleTableModel)((DynamicTableModel)this.table.getModel()).getRootModel(), this.context, this.getAlarmDbChannel());
|
||||
bAlarmDetailsDialog.setBoundsCenteredOnOwner();
|
||||
bAlarmDetailsDialog.open();
|
||||
}
|
||||
|
||||
public void showNotes(BAlarmRecord bAlarmRecord) {
|
||||
String string = "";
|
||||
try {
|
||||
string = ((BString)bAlarmRecord.getAlarmData().getFacet("notes")).getString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
BNotesDialog bNotesDialog = new BNotesDialog((BWidget)this, string, this.getUsername(bAlarmRecord), true);
|
||||
bNotesDialog.setBoundsCenteredOnOwner();
|
||||
bNotesDialog.open();
|
||||
String string2 = bNotesDialog.getNewNotes();
|
||||
if (string2 != null) {
|
||||
string = string2 + string;
|
||||
BFacets bFacets = bAlarmRecord.getAlarmData();
|
||||
HashMap<String, Object> hashMap = new HashMap<String, Object>();
|
||||
String[] stringArray = bFacets.list();
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
if (stringArray[i].equals("notes")) continue;
|
||||
BObject bObject = bFacets.get(stringArray[i]);
|
||||
hashMap.put(stringArray[i], bObject);
|
||||
}
|
||||
hashMap.put("notes", BString.make((String)string));
|
||||
BFacets bFacets2 = BFacets.make(hashMap);
|
||||
bAlarmRecord.setAlarmData(bFacets2);
|
||||
try {
|
||||
this.getAlarmDbChannel().update(bAlarmRecord);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUsername(BAlarmRecord bAlarmRecord) {
|
||||
BFoxSession bFoxSession = (BFoxSession)this.getCurrentValueSession();
|
||||
BFoxClientConnection bFoxClientConnection = bFoxSession.getConnection();
|
||||
return bFoxClientConnection.getUsername();
|
||||
}
|
||||
|
||||
protected BAlarmDbChannel getAlarmDbChannel() {
|
||||
BFoxSession bFoxSession = (BFoxSession)this.getCurrentValueSession();
|
||||
BFoxClientConnection bFoxClientConnection = bFoxSession.getConnection();
|
||||
return (BAlarmDbChannel)bFoxClientConnection.getChannels().get("alarmdb", BAlarmDbChannel.TYPE);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
protected void cellReleased(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
super.cellReleased(bMouseEvent, n, n2);
|
||||
if (bMouseEvent.getClickCount() == 2) {
|
||||
BAlarmDbView.this.showDetailsDialog(BAlarmDbView.this.model.getRecord(n));
|
||||
}
|
||||
}
|
||||
|
||||
public BMenu makeOptionsMenu() {
|
||||
BMenu bMenu = super.makeOptionsMenu();
|
||||
bMenu.add("acSep", (BValue)new BSeparator());
|
||||
bMenu.add("addColumn", BAlarmDbView.this.addColumnCommand);
|
||||
bMenu.add("removeColumn", BAlarmDbView.this.removeColumnCommand);
|
||||
return bMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,622 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Flags
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.timezone.BTimeZone
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.event.BWindowEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.pane.BScrollPane
|
||||
* javax.baja.ui.text.BTextEditor
|
||||
* javax.baja.ui.text.TextRenderer
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.fox.BAlarmDbChannel;
|
||||
import com.tridium.alarm.ui.BAlarmClassDef;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.alarm.ui.BNotesDialog;
|
||||
import com.tridium.alarm.ui.BTimeZoneDisplay;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.alarm.AlarmException;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Flags;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.event.BWindowEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.pane.BScrollPane;
|
||||
import javax.baja.ui.text.BTextEditor;
|
||||
import javax.baja.ui.text.TextRenderer;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BAlarmDetailsDialog
|
||||
extends BDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmDetailsDialog == null ? (class$com$tridium$alarm$ui$BAlarmDetailsDialog = BAlarmDetailsDialog.class$("com.tridium.alarm.ui.BAlarmDetailsDialog")) : class$com$tridium$alarm$ui$BAlarmDetailsDialog));
|
||||
BAlarmConsole console;
|
||||
BAlarmService alarmService;
|
||||
BGridPane alarmPane = new BGridPane(2);
|
||||
protected BAlarmRecord alarm;
|
||||
BTimeZoneDisplay timeZoneDisplay;
|
||||
BAlarmDbChannel alarmDbChannel;
|
||||
ConsoleTableModel tm;
|
||||
Log logger = Log.getLog((String)"alarm");
|
||||
Command ackCmd;
|
||||
Command closeCmd;
|
||||
Command hyperlinkCmd;
|
||||
Command notesCmd;
|
||||
Command showVideoCmd;
|
||||
Command nextCmd;
|
||||
Command prevCmd;
|
||||
public static final BFacets TIME_FACETS = BFacets.make((String)"showSeconds", (boolean)true);
|
||||
public static final UiLexicon lex = new UiLexicon(class$com$tridium$alarm$ui$BAlarmDetailsDialog == null ? (class$com$tridium$alarm$ui$BAlarmDetailsDialog = BAlarmDetailsDialog.class$("com.tridium.alarm.ui.BAlarmDetailsDialog")) : class$com$tridium$alarm$ui$BAlarmDetailsDialog);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDetailsDialog;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmDetailsDialog() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public BAlarmDetailsDialog(BAlarmConsole bAlarmConsole, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel) {
|
||||
this(bAlarmConsole, bTimeZoneDisplay, bAlarmRecord, consoleTableModel, null);
|
||||
}
|
||||
|
||||
public BAlarmDetailsDialog(BAlarmService bAlarmService, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel, Context context) {
|
||||
this(bAlarmService, null, bTimeZoneDisplay, bAlarmRecord, consoleTableModel, context);
|
||||
}
|
||||
|
||||
public BAlarmDetailsDialog(BAlarmService bAlarmService, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel, Context context, BAlarmDbChannel bAlarmDbChannel) {
|
||||
this(bAlarmService, null, bTimeZoneDisplay, bAlarmRecord, consoleTableModel, context, bAlarmDbChannel);
|
||||
}
|
||||
|
||||
public BAlarmDetailsDialog(BAlarmConsole bAlarmConsole, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel, Context context) {
|
||||
this(null, bAlarmConsole, bTimeZoneDisplay, bAlarmRecord, consoleTableModel, context);
|
||||
}
|
||||
|
||||
protected BAlarmDetailsDialog(BAlarmService bAlarmService, BAlarmConsole bAlarmConsole, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel, Context context) {
|
||||
this(bAlarmService, bAlarmConsole, bTimeZoneDisplay, bAlarmRecord, consoleTableModel, context, null);
|
||||
}
|
||||
|
||||
protected BAlarmDetailsDialog(BAlarmService bAlarmService, BAlarmConsole bAlarmConsole, BTimeZoneDisplay bTimeZoneDisplay, BAlarmRecord bAlarmRecord, ConsoleTableModel consoleTableModel, Context context, BAlarmDbChannel bAlarmDbChannel) {
|
||||
super((BWidget)bAlarmConsole, "Alarm Record", true);
|
||||
BEdgePane bEdgePane;
|
||||
Object object;
|
||||
BAlarmClass bAlarmClass;
|
||||
this.console = bAlarmConsole;
|
||||
this.alarm = bAlarmRecord;
|
||||
this.tm = consoleTableModel;
|
||||
this.timeZoneDisplay = bTimeZoneDisplay;
|
||||
if (bAlarmConsole != null) {
|
||||
this.alarmService = bAlarmConsole.getAlarmService();
|
||||
}
|
||||
if (bAlarmService != null) {
|
||||
this.alarmService = bAlarmService;
|
||||
}
|
||||
this.alarmDbChannel = bAlarmDbChannel;
|
||||
this.hyperlinkCmd = new HyperlinkCommand((BWidget)this);
|
||||
BButton bButton = new BButton(this.hyperlinkCmd, true, true);
|
||||
this.ackCmd = new AckCommand((BWidget)this);
|
||||
BButton bButton2 = new BButton(this.ackCmd, true, true);
|
||||
this.notesCmd = new NotesCommand((BWidget)this);
|
||||
BButton bButton3 = new BButton(this.notesCmd, true, true);
|
||||
this.showVideoCmd = new ShowVideoCommand((BWidget)this);
|
||||
BButton bButton4 = new BButton(this.showVideoCmd, true, true);
|
||||
this.closeCmd = new CloseCommand((BWidget)this);
|
||||
BButton bButton5 = new BButton(this.closeCmd, true, true);
|
||||
this.nextCmd = new PrevCommand((BWidget)this, context);
|
||||
BButton bButton6 = new BButton(this.nextCmd, false, true);
|
||||
this.prevCmd = new NextCommand((BWidget)this, context);
|
||||
BButton bButton7 = new BButton(this.prevCmd, false, true);
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
boolean bl = false;
|
||||
int n = consoleTableModel.getAlarmCount(bOrdList);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (!consoleTableModel.getRecord(bOrdList, i).getUuid().equals((Object)bAlarmRecord.getUuid())) continue;
|
||||
this.prevCmd.setEnabled(i != 0);
|
||||
this.nextCmd.setEnabled(i + 1 < n);
|
||||
bl = true;
|
||||
break;
|
||||
}
|
||||
if (!bl) {
|
||||
this.prevCmd.setEnabled(false);
|
||||
this.nextCmd.setEnabled(false);
|
||||
}
|
||||
this.createAlarmPane(context);
|
||||
BGridPane bGridPane = new BGridPane();
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.setUniformColumnWidth(true);
|
||||
bGridPane.add("next", (BValue)bButton6);
|
||||
if (bAlarmConsole != null) {
|
||||
bAlarmClass = bAlarmConsole.getAlarmService().lookupAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
if (bAlarmClass.getPermissions(bAlarmConsole.ctx).hasOperatorWrite()) {
|
||||
bGridPane.add("ack", (BValue)bButton2);
|
||||
}
|
||||
bGridPane.add("url", (BValue)bButton);
|
||||
bGridPane.add("notes", (BValue)bButton3);
|
||||
if (BAlarmConsole.isVideoDriverAvailable() && (object = bAlarmRecord.getAlarmData().gets("cameraOrd", null)) != null && !(bEdgePane = BOrd.make((String)object)).equals((Object)BOrd.NULL)) {
|
||||
bGridPane.add("showVideo", (BValue)bButton4);
|
||||
}
|
||||
}
|
||||
bGridPane.add("close", (BValue)bButton5);
|
||||
bGridPane.add("prev", (BValue)bButton7);
|
||||
bGridPane.setColumnCount(bGridPane.getChildWidgets().length);
|
||||
bAlarmClass = new BScrollPane();
|
||||
object = new BBorderPane();
|
||||
bAlarmClass.setContent((BWidget)object);
|
||||
object.setContent((BWidget)this.alarmPane);
|
||||
bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bAlarmClass));
|
||||
bEdgePane.setBottom((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
}
|
||||
|
||||
public void windowClosing(BWindowEvent bWindowEvent) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
void createAlarmPane(Context context) {
|
||||
Object object;
|
||||
Object object2;
|
||||
BOrd bOrd;
|
||||
Property[] propertyArray = this.alarm.loadSlots().getPropertiesArray();
|
||||
int n = propertyArray.length;
|
||||
this.alarmPane.removeAll();
|
||||
this.alarmPane.setColorRows(true);
|
||||
this.alarmPane.setRowAlign(BValign.top);
|
||||
this.alarmPane.setColumnGap(9.0);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
BTextEditor bTextEditor;
|
||||
if (Flags.isHidden((BComplex)this.alarm, (Slot)propertyArray[i])) continue;
|
||||
bOrd = new BLabel(this.alarm.getDisplayName((Slot)propertyArray[i], this.console != null ? this.console.ctx : null), BHalign.left);
|
||||
bOrd.setFont(Theme.label().getBoldText());
|
||||
this.alarmPane.add(null, (BValue)bOrd, null);
|
||||
if (propertyArray[i].getName().equals("alarmData")) {
|
||||
object2 = (BFacets)this.alarm.get(propertyArray[i]);
|
||||
object = new BGridPane(2);
|
||||
object.setHalign(BHalign.fill);
|
||||
object.setColumnGap(5.0);
|
||||
object.setRowAlign(BValign.top);
|
||||
bTextEditor = object2.list();
|
||||
bTextEditor = this.addNotePropertyIfNotPresent((String[])bTextEditor);
|
||||
SortUtil.sort((Object[])bTextEditor, (Object[])bTextEditor, (Comparator)new Comparator(){
|
||||
|
||||
public int compare(Object object, Object object2) {
|
||||
return ((String)object).compareToIgnoreCase((String)object2);
|
||||
}
|
||||
});
|
||||
for (int j = 0; j < ((Object[])bTextEditor).length; ++j) {
|
||||
BFormat bFormat;
|
||||
Object object3;
|
||||
BLabel bLabel = new BLabel(lex.get("alarmData." + (String)bTextEditor[j], TextUtil.toFriendly((String)bTextEditor[j])), BHalign.left);
|
||||
bLabel.setFont(Theme.label().getBoldText());
|
||||
object.add(null, (BValue)bLabel, null);
|
||||
if (bTextEditor[j].equals("notes")) {
|
||||
object3 = new Command((BWidget)this, "", BImage.make((BIcon)BIcon.std((String)"doubleArrowRight.png")), null, ""){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BAlarmDetailsDialog.this.notesCmd.doInvoke();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
bFormat = new BToolBar();
|
||||
bFormat.add("eb", (BValue)new BButton(object3, false, true));
|
||||
object.add(null, (BValue)bFormat, null);
|
||||
continue;
|
||||
}
|
||||
if (bTextEditor[j].equals("msgText")) {
|
||||
bFormat = BFormat.make((String)object2.getFacet((String)bTextEditor[j]).toString());
|
||||
object3 = bFormat.format((Object)this.alarm);
|
||||
} else {
|
||||
object3 = bTextEditor[j].equals("instructions") ? BFormat.make((String)object2.getFacet((String)bTextEditor[j]).toString()).format((Object)this) : object2.getFacet((String)bTextEditor[j]).toString();
|
||||
}
|
||||
object3 = TextUtil.replace((String)object3, (String)"\\n", (String)"\n");
|
||||
bFormat = new BTextEditor((String)object3, false);
|
||||
bFormat.setRenderer(new TextRenderer(){
|
||||
|
||||
public BBrush getBackground() {
|
||||
return BBrush.NULL;
|
||||
}
|
||||
});
|
||||
object.add(null, (BValue)bFormat);
|
||||
}
|
||||
this.alarmPane.add(null, (BValue)object, null);
|
||||
continue;
|
||||
}
|
||||
if (propertyArray[i].getType().is(BOrdList.TYPE)) {
|
||||
try {
|
||||
BString bString;
|
||||
object2 = (BOrdList)this.alarm.get(propertyArray[i]);
|
||||
object = new StringBuffer();
|
||||
for (int j = object2.size() - 1; j >= 0; --j) {
|
||||
if (j < object2.size() - 1) {
|
||||
((StringBuffer)object).append("-> ");
|
||||
}
|
||||
((StringBuffer)object).append(SlotPath.unescape((String)object2.get(j).encodeToString()).toString());
|
||||
if (j - 1 < 0) continue;
|
||||
((StringBuffer)object).append("\n");
|
||||
}
|
||||
if (propertyArray[i].getName().equals("source") && (bString = (BString)this.alarm.getAlarmData().get("sourceName")) != null && bString != BString.DEFAULT) {
|
||||
((StringBuffer)object).insert(0, BFormat.make((String)bString.toString(context)).format((Object)this.alarm) + "\n");
|
||||
}
|
||||
bTextEditor = new BTextEditor(((StringBuffer)object).toString(), false);
|
||||
bTextEditor.setRenderer(new TextRenderer(){
|
||||
|
||||
public BBrush getBackground() {
|
||||
return BBrush.NULL;
|
||||
}
|
||||
});
|
||||
this.alarmPane.add(null, (BValue)bTextEditor, null);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.alarmPane.add(null, (BValue)new BLabel("unknown"), null);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (propertyArray[i].getType().is(BAbsTime.TYPE)) {
|
||||
object2 = (BAbsTime)this.alarm.get(propertyArray[i]);
|
||||
object = "";
|
||||
object = this.timeZoneDisplay == BTimeZoneDisplay.source ? object2.toString((Context)BFacets.make((BFacets)this.alarm.getAlarmData(), (BFacets)TIME_FACETS)) : object2.toString((Context)BFacets.make((BFacets)TIME_FACETS, (String)"TimeZone", (BIDataValue)BTimeZone.getLocal()));
|
||||
bTextEditor = new BTextEditor((String)object, false);
|
||||
bTextEditor.setRenderer(new TextRenderer(){
|
||||
|
||||
public BBrush getBackground() {
|
||||
return BBrush.NULL;
|
||||
}
|
||||
});
|
||||
this.alarmPane.add(null, (BValue)bTextEditor);
|
||||
continue;
|
||||
}
|
||||
object2 = SlotPath.unescape((String)this.alarm.get(propertyArray[i].getName()).toString());
|
||||
object2 = TextUtil.replace((String)object2, (String)"\\n", (String)"\n");
|
||||
if (propertyArray[i].getName().equals("alarmClass")) {
|
||||
object2 = this.alarmService.getAlarmClassDisplayName(BString.make((String)this.alarm.get(propertyArray[i].getName()).toString()), context).toString();
|
||||
}
|
||||
object = new BTextEditor((String)object2, false);
|
||||
object.setRenderer(new TextRenderer(){
|
||||
|
||||
public BBrush getBackground() {
|
||||
return BBrush.NULL;
|
||||
}
|
||||
});
|
||||
this.alarmPane.add(null, (BValue)object);
|
||||
}
|
||||
BString bString = (BString)this.alarm.getAlarmData().get("hyperlinkOrd");
|
||||
bOrd = BOrd.NULL;
|
||||
if (bString != null) {
|
||||
bOrd = BOrd.make((String)bString.toString());
|
||||
}
|
||||
if (bOrd == null || bOrd.isNull() && this.console != null) {
|
||||
object2 = this.console.options.getAlarmClassMapping();
|
||||
object = object2.getAlarmClassDefFor(this.alarm.getAlarmClass());
|
||||
bOrd = ((BAlarmClassDef)((Object)object)).getAlarmUrl();
|
||||
}
|
||||
if (bOrd != null && !bOrd.isNull()) {
|
||||
this.hyperlinkCmd.setEnabled(true);
|
||||
} else {
|
||||
this.hyperlinkCmd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] addNotePropertyIfNotPresent(String[] stringArray) {
|
||||
boolean bl = false;
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
if (!"notes".equals(stringArray[i])) continue;
|
||||
bl = true;
|
||||
break;
|
||||
}
|
||||
if (!bl) {
|
||||
String[] stringArray2 = new String[stringArray.length + 1];
|
||||
int n = 0;
|
||||
for (n = 0; n < stringArray.length; ++n) {
|
||||
stringArray2[n] = stringArray[n];
|
||||
}
|
||||
stringArray2[n] = "notes";
|
||||
stringArray = stringArray2;
|
||||
}
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
protected void alarmCleared() {
|
||||
this.notesCmd.setEnabled(false);
|
||||
this.ackCmd.setEnabled(false);
|
||||
this.hyperlinkCmd.setEnabled(false);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowVideoCommand
|
||||
extends Command {
|
||||
public ShowVideoCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.showVideo");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
block8: {
|
||||
try {
|
||||
Class clazz = Sys.loadClass((String)"videoDriver", (String)"com.tridium.videoDriver.alarm.AlarmConsoleExt");
|
||||
if (clazz != null) {
|
||||
Method method = clazz.getMethod("doShowVideo", class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmDetailsDialog.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole, class$javax$baja$alarm$BAlarmRecord == null ? (class$javax$baja$alarm$BAlarmRecord = BAlarmDetailsDialog.class$("javax.baja.alarm.BAlarmRecord")) : class$javax$baja$alarm$BAlarmRecord);
|
||||
if (method != null) {
|
||||
method.invoke((Object)clazz, new Object[]{BAlarmDetailsDialog.this.console, BAlarmDetailsDialog.this.alarm});
|
||||
} else {
|
||||
System.out.println("The 'doShowVideo' method was not found on class AlarmConsoleExt in videoDriver.jar. Please have my program fixed");
|
||||
}
|
||||
break block8;
|
||||
}
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound");
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)classNotFoundException);
|
||||
}
|
||||
catch (NoSuchMethodException noSuchMethodException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)noSuchMethodException);
|
||||
}
|
||||
catch (InvocationTargetException invocationTargetException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)invocationTargetException);
|
||||
}
|
||||
catch (IllegalAccessException illegalAccessException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)illegalAccessException);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class NextCommand
|
||||
extends Command {
|
||||
Context cx;
|
||||
|
||||
public NextCommand(BWidget bWidget, Context context) {
|
||||
super(bWidget, (Lexicon)UiLexicon.bajaui, "commands.forward");
|
||||
this.cx = context;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "Previous";
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BOrdList bOrdList = BAlarmDetailsDialog.this.alarm.getSource();
|
||||
int n = BAlarmDetailsDialog.this.tm.getAlarmCount(bOrdList);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (!BAlarmDetailsDialog.this.tm.getRecord(bOrdList, i).getUuid().equals((Object)BAlarmDetailsDialog.this.alarm.getUuid())) continue;
|
||||
if (i > 0) {
|
||||
BAlarmDetailsDialog.this.alarm = BAlarmDetailsDialog.this.tm.getRecord(bOrdList, i - 1);
|
||||
BAlarmDetailsDialog.this.createAlarmPane(this.cx);
|
||||
BAlarmDetailsDialog.this.alarmPane.relayout();
|
||||
--i;
|
||||
}
|
||||
BAlarmDetailsDialog.this.prevCmd.setEnabled(i != 0);
|
||||
BAlarmDetailsDialog.this.nextCmd.setEnabled(i + 1 < n);
|
||||
return null;
|
||||
}
|
||||
BAlarmDetailsDialog.this.prevCmd.setEnabled(false);
|
||||
BAlarmDetailsDialog.this.nextCmd.setEnabled(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class PrevCommand
|
||||
extends Command {
|
||||
Context cx;
|
||||
|
||||
public PrevCommand(BWidget bWidget, Context context) {
|
||||
super(bWidget, (Lexicon)UiLexicon.bajaui, "commands.back");
|
||||
this.cx = context;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return "Next";
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BOrdList bOrdList = BAlarmDetailsDialog.this.alarm.getSource();
|
||||
int n = BAlarmDetailsDialog.this.tm.getAlarmCount(bOrdList);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (!BAlarmDetailsDialog.this.tm.getRecord(bOrdList, i).getUuid().equals((Object)BAlarmDetailsDialog.this.alarm.getUuid())) continue;
|
||||
if (i + 1 < n) {
|
||||
BAlarmDetailsDialog.this.alarm = BAlarmDetailsDialog.this.tm.getRecord(bOrdList, i + 1);
|
||||
BAlarmDetailsDialog.this.createAlarmPane(this.cx);
|
||||
BAlarmDetailsDialog.this.alarmPane.relayout();
|
||||
++i;
|
||||
}
|
||||
BAlarmDetailsDialog.this.prevCmd.setEnabled(i != 0);
|
||||
BAlarmDetailsDialog.this.nextCmd.setEnabled(i + 1 < n);
|
||||
return null;
|
||||
}
|
||||
BAlarmDetailsDialog.this.prevCmd.setEnabled(false);
|
||||
BAlarmDetailsDialog.this.nextCmd.setEnabled(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseCommand
|
||||
extends Command {
|
||||
public CloseCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)UiLexicon.bajaui, "commands.close");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmDetailsDialog.this.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class HyperlinkCommand
|
||||
extends Command {
|
||||
public HyperlinkCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.hyperlink");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmDetailsDialog.this.console.hyperlink(BAlarmDetailsDialog.this.alarm);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class NotesCommand
|
||||
extends Command {
|
||||
public NotesCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.notes");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
if (BAlarmDetailsDialog.this.console != null) {
|
||||
BAlarmDetailsDialog.this.console.showNotes((BWidget)BAlarmDetailsDialog.this.alarmPane, new BAlarmRecord[]{BAlarmDetailsDialog.this.alarm});
|
||||
} else {
|
||||
if (BAlarmDetailsDialog.this.alarmDbChannel == null) {
|
||||
AlarmException alarmException = new AlarmException("Unable to find alarmDBChannel");
|
||||
BAlarmDetailsDialog.this.logger.error("Unable to find alarmDBChannel", (Throwable)((Object)alarmException));
|
||||
throw alarmException;
|
||||
}
|
||||
this.showAndAddNotes();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void showAndAddNotes() {
|
||||
String string = "";
|
||||
try {
|
||||
string = ((BString)BAlarmDetailsDialog.this.alarm.getAlarmData().getFacet("notes")).getString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BAlarmDetailsDialog.this.logger.error("Exception occurred while fetching the notes ", (Throwable)exception);
|
||||
}
|
||||
String string2 = BAlarmDetailsDialog.this.alarmDbChannel.getClientConnection().getUsername();
|
||||
BNotesDialog bNotesDialog = new BNotesDialog(null, string, string2, true);
|
||||
bNotesDialog.setBoundsCenteredOnOwner();
|
||||
bNotesDialog.open();
|
||||
String string3 = bNotesDialog.getNewNotes();
|
||||
if (string3 != null) {
|
||||
string = string3 + string;
|
||||
BFacets bFacets = BAlarmDetailsDialog.this.alarm.getAlarmData();
|
||||
HashMap<String, Object> hashMap = new HashMap<String, Object>();
|
||||
String[] stringArray = bFacets.list();
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
if (stringArray[i].equals("notes")) continue;
|
||||
BObject bObject = bFacets.get(stringArray[i]);
|
||||
hashMap.put(stringArray[i], bObject);
|
||||
}
|
||||
hashMap.put("notes", BString.make((String)string));
|
||||
BFacets bFacets2 = BFacets.make(hashMap);
|
||||
BAlarmDetailsDialog.this.alarm.setAlarmData(bFacets2);
|
||||
try {
|
||||
BAlarmDetailsDialog.this.alarmDbChannel.update(BAlarmDetailsDialog.this.alarm);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BAlarmDetailsDialog.this.logger.error("Exception while updating the notes for an alarm", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class AckCommand
|
||||
extends Command {
|
||||
public AckCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.acknowledge");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmDetailsDialog.this.console.acknowledgeAlarms(new BAlarmRecord[]{BAlarmDetailsDialog.this.alarm});
|
||||
BAlarmDetailsDialog.this.prevCmd.setEnabled(false);
|
||||
BAlarmDetailsDialog.this.nextCmd.setEnabled(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.gx.BPoint
|
||||
* javax.baja.gx.Point
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BFrame
|
||||
* javax.baja.ui.BHyperlinkLabel
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.event.BWindowEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmConsoleOptions;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalOptions;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalTool;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.gx.BPoint;
|
||||
import javax.baja.gx.Point;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BBorder;
|
||||
import javax.baja.ui.BFrame;
|
||||
import javax.baja.ui.BHyperlinkLabel;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.event.BWindowEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
public class BAlarmDialog
|
||||
extends BFrame {
|
||||
public static final Action update = BAlarmDialog.newAction((int)4, null);
|
||||
public static final Action handleHyperlink = BAlarmDialog.newAction((int)4, (BValue)new BMouseEvent(), null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmDialog == null ? (class$com$tridium$alarm$ui$BAlarmDialog = BAlarmDialog.class$("com.tridium.alarm.ui.BAlarmDialog")) : class$com$tridium$alarm$ui$BAlarmDialog));
|
||||
private BLabel lastAlarm;
|
||||
private BLabel lastAlarmSrc;
|
||||
private BLabel lastAlarmMsg;
|
||||
private BHyperlinkLabel lastAlarmHyperlink;
|
||||
private BLabel status;
|
||||
private BAlarmRecord lastAlarmRecord;
|
||||
private boolean lastAlarmRecordChanged;
|
||||
private BHyperlinkLabel imgLabel;
|
||||
private String title;
|
||||
private boolean fullyConnected = false;
|
||||
private int acked;
|
||||
private int unacked;
|
||||
private boolean sourcesInAlarm;
|
||||
private boolean alwaysOnTop;
|
||||
private boolean uncloseable;
|
||||
private boolean closed = true;
|
||||
private BAlarmPortalTool tool;
|
||||
static BImage alarmImg = BImage.make((String)"module://icons/x16/alarm.png");
|
||||
static BImage alarmRed = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmRed.png");
|
||||
static BImage alarmGreen = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmGreen.png");
|
||||
private static BImage ALARM_YELLOW = BImage.make((String)"module://alarm/com/tridium/alarm/ui/images/alarm.gif");
|
||||
private static BImage ALARM_GREEN = BImage.make((String)"module://alarm/com/tridium/alarm/ui/images/alarmGreen.gif");
|
||||
private static BImage ALARM_RED = BImage.make((String)"module://alarm/com/tridium/alarm/ui/images/alarmRed.gif");
|
||||
private static BImage ALARM_WHITE = BImage.make((String)"module://alarm/com/tridium/alarm/ui/images/alarmWhite.gif");
|
||||
private static BImage ALARM_GRAY = BImage.make((String)"module://alarm/com/tridium/alarm/ui/images/alarmGray.gif");
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmDialog == null ? (class$com$tridium$alarm$ui$BAlarmDialog = BAlarmDialog.class$("com.tridium.alarm.ui.BAlarmDialog")) : class$com$tridium$alarm$ui$BAlarmDialog);
|
||||
public BAlarmConsoleOptions options = BAlarmConsoleOptions.getDefault();
|
||||
public static final BFacets TIME_FACETS = BFacets.make((String)"showTimeZone", (BIDataValue)BBoolean.FALSE, (String)"showSeconds", (BIDataValue)BBoolean.TRUE);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDialog;
|
||||
|
||||
public void update() {
|
||||
this.invoke(update, null, null);
|
||||
}
|
||||
|
||||
public void handleHyperlink(BMouseEvent bMouseEvent) {
|
||||
this.invoke(handleHyperlink, (BValue)bMouseEvent, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmDialog() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public BAlarmDialog(BAlarmPortalTool bAlarmPortalTool, String string, BImage bImage, BAlarmRecord bAlarmRecord, int n, int n2, boolean bl, boolean bl2) {
|
||||
super(string);
|
||||
this.acked = n;
|
||||
this.unacked = n2;
|
||||
this.title = string;
|
||||
this.alwaysOnTop = bl;
|
||||
this.uncloseable = bl2;
|
||||
this.tool = bAlarmPortalTool;
|
||||
BAlarmPortalOptions bAlarmPortalOptions = BAlarmPortalOptions.getDefault();
|
||||
BPoint bPoint = bAlarmPortalOptions.getPopupPosition();
|
||||
this.setVisible(true);
|
||||
this.setIconImage(bImage);
|
||||
String string2 = lexicon.getText("portal.popup.lastAlarm") + ": ";
|
||||
String string3 = lexicon.getText("portal.popup.source") + ": ";
|
||||
String string4 = lexicon.getText("portal.popup.message") + ": ";
|
||||
String string5 = lexicon.getText("portal.popup.hyperlink") + ": ";
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setValign(BValign.top);
|
||||
bGridPane.setHalign(BHalign.center);
|
||||
bGridPane.setColumnAlign(BHalign.center);
|
||||
this.imgLabel = new BHyperlinkLabel();
|
||||
this.imgLabel.setImage(ALARM_GRAY);
|
||||
this.imgLabel.setBackground(BColor.white.toBrush());
|
||||
BBorderPane bBorderPane = new BBorderPane((BWidget)this.imgLabel);
|
||||
bBorderPane.setBorder(BBorder.make((double)1.0, (int)1, (BBrush)BColor.black.toBrush()));
|
||||
bBorderPane.setMargin(BInsets.make((double)15.0, (double)20.0, (double)10.0, (double)20.0));
|
||||
bBorderPane.setPadding(BInsets.NULL);
|
||||
bGridPane.add(null, (BValue)bBorderPane);
|
||||
this.linkTo((BComponent)this.imgLabel, (Slot)BWidget.mouseEvent, (Slot)handleHyperlink);
|
||||
this.status = new BLabel();
|
||||
this.status.setHalign(BHalign.center);
|
||||
this.status.setPadding(BInsets.make((double)0.0, (double)10.0, (double)0.0, (double)10.0));
|
||||
bGridPane.add(null, (BValue)this.status);
|
||||
BGridPane bGridPane2 = new BGridPane(2);
|
||||
bGridPane2.setRowAlign(BValign.top);
|
||||
bGridPane2.setColumnAlign(BHalign.left);
|
||||
BLabel bLabel = new BLabel(string2);
|
||||
bLabel.setPadding(BInsets.make((double)10.0, (double)0.0, (double)0.0, (double)0.0));
|
||||
bLabel.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)bLabel);
|
||||
this.lastAlarm = new BLabel();
|
||||
this.lastAlarm.setPadding(BInsets.make((double)10.0, (double)0.0, (double)0.0, (double)0.0));
|
||||
this.lastAlarm.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)this.lastAlarm);
|
||||
BLabel bLabel2 = new BLabel(string3);
|
||||
bLabel2.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)bLabel2);
|
||||
this.lastAlarmSrc = new BLabel();
|
||||
this.lastAlarmSrc.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)this.lastAlarmSrc);
|
||||
BLabel bLabel3 = new BLabel(string4);
|
||||
bLabel3.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)bLabel3);
|
||||
this.lastAlarmMsg = new BLabel();
|
||||
this.lastAlarmMsg.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)this.lastAlarmMsg);
|
||||
BLabel bLabel4 = new BLabel(string5);
|
||||
bLabel4.setHalign(BHalign.left);
|
||||
bLabel4.setPadding(BInsets.make((double)0.0, (double)0.0, (double)10.0, (double)0.0));
|
||||
bGridPane2.add(null, (BValue)bLabel4);
|
||||
this.lastAlarmHyperlink = new BHyperlinkLabel();
|
||||
this.lastAlarmHyperlink.setHalign(BHalign.left);
|
||||
this.lastAlarmHyperlink.setPadding(BInsets.make((double)0.0, (double)0.0, (double)10.0, (double)0.0));
|
||||
bGridPane2.add(null, (BValue)this.lastAlarmHyperlink);
|
||||
this.linkTo((BComponent)this.lastAlarmHyperlink, (Slot)BWidget.mouseEvent, (Slot)handleHyperlink);
|
||||
bEdgePane.setLeft((BWidget)bGridPane);
|
||||
bEdgePane.setCenter((BWidget)bGridPane2);
|
||||
bEdgePane.computePreferredSize();
|
||||
this.setScreenBounds(bPoint.x(), bPoint.y(), bEdgePane.getPreferredWidth() + 50.0, bEdgePane.getPreferredHeight() + 50.0);
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
if (bAlarmRecord != null) {
|
||||
this.updateLastAlarm(bAlarmRecord);
|
||||
}
|
||||
try {
|
||||
this.doLoad();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
this.setAlwaysOnTop(string, bl);
|
||||
Thread thread = new Thread(){
|
||||
|
||||
public void run() {
|
||||
while (!BAlarmDialog.this.closed) {
|
||||
BAlarmDialog.this.update();
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
}
|
||||
catch (InterruptedException interruptedException) {}
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
|
||||
protected void doLoad() throws Exception {
|
||||
System.loadLibrary("alarmDialog");
|
||||
}
|
||||
|
||||
public void windowClosing(BWindowEvent bWindowEvent) {
|
||||
if (!this.uncloseable) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void open() {
|
||||
if (this.closed) {
|
||||
this.closed = false;
|
||||
super.open();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.tool.onAlarmDialogClosed(this);
|
||||
this.closed = true;
|
||||
this.releaseNativeResources(this.title);
|
||||
this.setVisible(false);
|
||||
super.close();
|
||||
}
|
||||
|
||||
public void windowDeactivated(BWindowEvent bWindowEvent) {
|
||||
if (!this.closed) {
|
||||
this.setAlwaysOnTop(this.title, this.alwaysOnTop);
|
||||
}
|
||||
}
|
||||
|
||||
public void windowActivated(BWindowEvent bWindowEvent) {
|
||||
if (!this.closed) {
|
||||
this.setAlwaysOnTop(this.title, this.alwaysOnTop);
|
||||
}
|
||||
}
|
||||
|
||||
public void windowDeiconified(BWindowEvent bWindowEvent) {
|
||||
if (!this.closed) {
|
||||
this.setAlwaysOnTop(this.title, this.alwaysOnTop);
|
||||
}
|
||||
}
|
||||
|
||||
public void windowIconified(BWindowEvent bWindowEvent) {
|
||||
if (!this.closed) {
|
||||
this.setAlwaysOnTop(this.title, this.alwaysOnTop);
|
||||
if (this.alwaysOnTop) {
|
||||
this.toTop(this.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getPixel(BWidget bWidget, int n, int n2) {
|
||||
bWidget = (BWidget)bWidget.getParent();
|
||||
while (bWidget.getParent() != null) {
|
||||
Point point = new Point(bWidget.getX(), bWidget.getY());
|
||||
n = (int)((double)n + point.x);
|
||||
n2 = (int)((double)n2 + point.y);
|
||||
bWidget = (BWidget)bWidget.getParent();
|
||||
}
|
||||
return this.getPixel(n -= 3, n2 -= 22);
|
||||
}
|
||||
|
||||
public void doUpdate() {
|
||||
BObject bObject;
|
||||
Object object;
|
||||
if (this.lastAlarmRecord != null && this.lastAlarmRecordChanged) {
|
||||
this.lastAlarmRecordChanged = false;
|
||||
object = this.lastAlarmRecord.getSource().toString();
|
||||
bObject = this.lastAlarmRecord.getAlarmData().get("sourceName");
|
||||
if (bObject != null && !bObject.toString().equals("")) {
|
||||
object = BFormat.make((String)this.lastAlarmRecord.getAlarmData().get("sourceName").toString()).format((Object)this.lastAlarmRecord);
|
||||
}
|
||||
this.lastAlarmSrc.setText((String)object);
|
||||
this.lastAlarm.setText(this.lastAlarmRecord.getTimestamp().toString());
|
||||
this.lastAlarm.setImage(alarmImg);
|
||||
String string = "";
|
||||
if (this.lastAlarmRecord.getAlarmData().get("msgText") != null) {
|
||||
string = this.lastAlarmRecord.getAlarmData().get("msgText").toString();
|
||||
}
|
||||
this.lastAlarmMsg.setText(lexicon.getText(BFormat.make((String)string).format((Object)this.lastAlarmRecord)));
|
||||
String string2 = "";
|
||||
if (this.lastAlarmRecord.getAlarmData().get("hyperlinkOrd") != null) {
|
||||
string2 = this.lastAlarmRecord.getAlarmData().get("hyperlinkOrd").toString();
|
||||
this.lastAlarmHyperlink.setText(BFormat.make((String)string2).format((Object)this.lastAlarmRecord));
|
||||
this.lastAlarmHyperlink.setOrd(BOrd.make((String)string2));
|
||||
this.lastAlarmHyperlink.setVisible(true);
|
||||
this.imgLabel.setOrd(BOrd.make((String)string2));
|
||||
} else {
|
||||
this.lastAlarmHyperlink.setVisible(false);
|
||||
this.lastAlarmHyperlink.setOrd(BOrd.NULL);
|
||||
this.imgLabel.setOrd(BOrd.NULL);
|
||||
}
|
||||
}
|
||||
object = new Object[]{new Integer(this.acked), new Integer(this.unacked)};
|
||||
this.status.setText(lexicon.getText("portal.popup.unackedAlarms", object));
|
||||
this.updateImage(this.sourcesInAlarm);
|
||||
bObject = this.getContent();
|
||||
bObject.computePreferredSize();
|
||||
this.setScreenBounds(this.getScreenBounds().x(), this.getScreenBounds().y(), bObject.getPreferredWidth() + 50.0, bObject.getPreferredHeight() + 50.0);
|
||||
this.repaint();
|
||||
this.toTop(this.title);
|
||||
}
|
||||
|
||||
public void updateLastAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.lastAlarmRecord = bAlarmRecord;
|
||||
this.lastAlarmRecordChanged = true;
|
||||
}
|
||||
|
||||
public void updateAlarmCounts(int n, int n2, boolean bl) {
|
||||
boolean bl2 = n != this.acked;
|
||||
bl2 |= n2 != this.unacked;
|
||||
bl2 |= bl != this.sourcesInAlarm;
|
||||
this.unacked = n2;
|
||||
this.acked = n;
|
||||
this.sourcesInAlarm = bl;
|
||||
}
|
||||
|
||||
private void updateImage(BImage bImage) {
|
||||
if (!this.imgLabel.getImage().equals((Object)bImage)) {
|
||||
this.imgLabel.setImage(bImage);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateImage(boolean bl) {
|
||||
if (!this.fullyConnected) {
|
||||
this.updateImage(ALARM_GRAY);
|
||||
} else if (this.unacked > 0) {
|
||||
if (bl) {
|
||||
this.updateImage(ALARM_RED);
|
||||
} else {
|
||||
this.updateImage(ALARM_GREEN);
|
||||
}
|
||||
} else if (this.unacked == 0 && this.acked > 0) {
|
||||
this.updateImage(ALARM_YELLOW);
|
||||
} else if (this.acked == 0 && this.unacked == 0) {
|
||||
this.updateImage(ALARM_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
public void doHandleHyperlink(BMouseEvent bMouseEvent) {
|
||||
switch (bMouseEvent.getId()) {
|
||||
case 501: {
|
||||
this.fireHyperlink(this.lastAlarmHyperlink.getOrd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fireHyperlink(BOrd bOrd) {
|
||||
if (bOrd.isNull()) {
|
||||
return;
|
||||
}
|
||||
this.tool.onAlarmDialogHyperlink(this, bOrd);
|
||||
}
|
||||
|
||||
public void setUncloseable(boolean bl) {
|
||||
this.uncloseable = bl;
|
||||
}
|
||||
|
||||
public void setAlwaysOnTop(boolean bl) {
|
||||
this.alwaysOnTop = bl;
|
||||
this.setAlwaysOnTop(this.title, bl);
|
||||
if (bl) {
|
||||
this.toTop(this.title);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFullyConnected(boolean bl) {
|
||||
this.fullyConnected = bl;
|
||||
}
|
||||
|
||||
public native void setAlwaysOnTop(String var1, boolean var2);
|
||||
|
||||
public native void toTop(String var1);
|
||||
|
||||
public native int getPixel(int var1, int var2);
|
||||
|
||||
public native void releaseNativeResources(String var1);
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,654 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* com.tridium.workbench.bql.filter.ColumnNameTableModel
|
||||
* com.tridium.workbench.job.BJobBar
|
||||
* com.tridium.workbench.util.CollectionTableModel
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.collection.ColumnList
|
||||
* javax.baja.data.BIDataTable
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.job.BJob
|
||||
* javax.baja.job.BJobService
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.IntHashMap
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BSubMenuItem
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.BWidgetShell
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableCellRenderer
|
||||
* javax.baja.ui.table.TableCellRenderer$Cell
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.WrapperTableModel
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.nav.menu.NavMenuUtil
|
||||
* javax.baja.workbench.view.BWbComponentView
|
||||
* javax.baja.workbench.view.BWbComponentView$Attachable
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BAlarmExtStatusJob;
|
||||
import com.tridium.alarm.ui.BAlarmClassFE;
|
||||
import com.tridium.alarm.ui.BInstructionsFE;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import com.tridium.workbench.bql.filter.ColumnNameTableModel;
|
||||
import com.tridium.workbench.job.BJobBar;
|
||||
import com.tridium.workbench.util.CollectionTableModel;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.alarm.ext.BAlarmState;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.collection.ColumnList;
|
||||
import javax.baja.data.BIDataTable;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.job.BJob;
|
||||
import javax.baja.job.BJobService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.IntHashMap;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BBorder;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BSubMenuItem;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.BWidgetShell;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableCellRenderer;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.WrapperTableModel;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.nav.menu.NavMenuUtil;
|
||||
import javax.baja.workbench.view.BWbComponentView;
|
||||
|
||||
public class BAlarmExtManager
|
||||
extends BWbComponentView {
|
||||
public static final Action updateCommands = BAlarmExtManager.newAction((int)4, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager));
|
||||
private static final String[] ATTRS = new String[]{"parent.toPathString", "toPathString", "name", "alarmState", "alarmEnable.isToOffnormal", "alarmEnable.isToFault", "alarmState.ordinal", "alarmClass", "alarmInstructions", "status"};
|
||||
private static final int[] DISPLAY = new int[]{0, 2, 3, 4, 5, 7, 8};
|
||||
private static Lexicon lex = Lexicon.make((String)"alarm");
|
||||
private BAlarmService alarmService;
|
||||
private BTable table;
|
||||
private BITable itable;
|
||||
private CollectionTableModel collectionModel;
|
||||
private ToggleCommand enableToOffnormal;
|
||||
private ToggleCommand enableToFault;
|
||||
private Command editAlarmClass;
|
||||
private Command editInstructions;
|
||||
private IntHashMap nameMap;
|
||||
private BBorderPane topPane;
|
||||
private BJobBar jobBar;
|
||||
private BJob job;
|
||||
private boolean jobComplete;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmExtManager;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$BAlarmExtStatusJob;
|
||||
|
||||
public void updateCommands() {
|
||||
this.invoke(updateCommands, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmExtManager() {
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
this.jobBar = new BJobBar();
|
||||
this.attach((BWbComponentView.Attachable)this.jobBar);
|
||||
BBorderPane bBorderPane = new BBorderPane((BWidget)this.jobBar, BBorder.solid, BInsets.make((double)0.0, (double)5.0, (double)0.0, (double)5.0));
|
||||
bBorderPane.setFill(Theme.widget().getWindowBackground());
|
||||
bBorderPane = new BBorderPane((BWidget)bBorderPane, BBorder.inset, BInsets.DEFAULT);
|
||||
this.topPane = new BBorderPane((BWidget)bBorderPane, BInsets.make((double)0.0, (double)0.0, (double)5.0, (double)0.0));
|
||||
bEdgePane.setTop((BWidget)this.topPane);
|
||||
this.topPane.setVisible(false);
|
||||
this.table = new BTable();
|
||||
this.table.setController((TableController)new Controller());
|
||||
this.table.setCellRenderer((TableCellRenderer)new CellRenderer());
|
||||
bEdgePane.setCenter((BWidget)BTitlePane.makePane((String)lex.getText("alarm.alarmSourceExts"), (BTable)this.table, (String)lex.getText("alarm.exts")));
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
this.enableToOffnormal = new EnableToOffnormal();
|
||||
this.enableToFault = new EnableToFault();
|
||||
this.editAlarmClass = new EditAlarmClass();
|
||||
this.editInstructions = new EditInstructions();
|
||||
this.add("selectionLink", (BValue)new BLink((BComponent)this.table, (Slot)BTable.selectionModified, (Slot)updateCommands));
|
||||
this.nameMap = new IntHashMap();
|
||||
this.nameMap.put(0, (Object)"alarm.point");
|
||||
this.nameMap.put(2, (Object)"alarm.extension");
|
||||
this.nameMap.put(3, (Object)"alarm.alarmState");
|
||||
this.nameMap.put(4, (Object)"alarm.toOffnormalEnabled.label");
|
||||
this.nameMap.put(5, (Object)"alarm.toFaultEnabled.label");
|
||||
this.nameMap.put(7, (Object)"alarm.alarmClass");
|
||||
this.nameMap.put(8, (Object)"alarm.instructions");
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) throws Exception {
|
||||
this.alarmService = (BAlarmService)bObject;
|
||||
this.updateTable();
|
||||
this.table.fireTableModified(null);
|
||||
}
|
||||
|
||||
private void updateTable() {
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)this.query()).normalize();
|
||||
this.itable = ((BICollection)bOrd2.resolve().get()).toTable();
|
||||
boolean bl = false;
|
||||
int n = -1;
|
||||
boolean bl2 = true;
|
||||
if (this.table.getModel() instanceof AlarmExtTableModel) {
|
||||
bl = true;
|
||||
n = ((AlarmExtTableModel)this.table.getModel()).sortCol;
|
||||
bl2 = ((AlarmExtTableModel)this.table.getModel()).sortAsc;
|
||||
}
|
||||
this.collectionModel = new CollectionTableModel(this.itable, this.getCurrentContext());
|
||||
ColumnNameTableModel columnNameTableModel = new ColumnNameTableModel((TableModel)this.collectionModel, this.nameMap, lex);
|
||||
AlarmExtTableModel alarmExtTableModel = new AlarmExtTableModel((TableModel)columnNameTableModel, DISPLAY);
|
||||
alarmExtTableModel.setColumnShowable(1, false);
|
||||
alarmExtTableModel.setColumnShowable(6, false);
|
||||
if (bl && n != -1) {
|
||||
alarmExtTableModel.sortByColumn(n, bl2);
|
||||
}
|
||||
this.table.setModel((TableModel)alarmExtTableModel);
|
||||
this.table.relayout();
|
||||
}
|
||||
|
||||
private String query() {
|
||||
StringBuffer stringBuffer = new StringBuffer(128);
|
||||
stringBuffer.append("station:|slot:/|bql:select ");
|
||||
for (int i = 0; i < ATTRS.length; ++i) {
|
||||
if (i != 0) {
|
||||
stringBuffer.append(", ");
|
||||
}
|
||||
stringBuffer.append(ATTRS[i]);
|
||||
}
|
||||
stringBuffer.append(" from alarm:AlarmSourceExt");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public void doUpdateCommands() {
|
||||
}
|
||||
|
||||
public BOrd[] getSelectedOrds() {
|
||||
int[] nArray = this.table.getSelection().getRows();
|
||||
int n = nArray.length;
|
||||
BOrd[] bOrdArray = new BOrd[n];
|
||||
for (int i = 0; i < n; ++i) {
|
||||
String string = this.itable.getString(nArray[i], this.itable.getColumns().get("toPathString"));
|
||||
bOrdArray[i] = BOrd.make((String)("station:|slot:" + string)).normalize();
|
||||
}
|
||||
return bOrdArray;
|
||||
}
|
||||
|
||||
public BAlarmSourceExt getExtensionForRow(int n) {
|
||||
String string = this.collectionModel.getValueAt(n, 1).toString();
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)("slot:" + string)).normalize();
|
||||
return (BAlarmSourceExt)bOrd2.resolve().get();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void enableToOffnormal() {
|
||||
BWidgetShell bWidgetShell;
|
||||
BOrd[] bOrdArray = this.getSelectedOrds();
|
||||
if (bOrdArray.length == 0) {
|
||||
return;
|
||||
}
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)"service:baja:JobService");
|
||||
BJobService bJobService = (BJobService)bOrd2.resolve().get();
|
||||
bJobService.lease();
|
||||
BAlarmExtStatusJob[] bAlarmExtStatusJobArray = (BAlarmExtStatusJob[])bJobService.getChildren(class$com$tridium$alarm$BAlarmExtStatusJob == null ? (class$com$tridium$alarm$BAlarmExtStatusJob = BAlarmExtManager.class$("com.tridium.alarm.BAlarmExtStatusJob")) : class$com$tridium$alarm$BAlarmExtStatusJob);
|
||||
if (bAlarmExtStatusJobArray != null) {
|
||||
for (int i = 0; i < bAlarmExtStatusJobArray.length; ++i) {
|
||||
if (bAlarmExtStatusJobArray[i] == null) continue;
|
||||
bAlarmExtStatusJobArray[i].lease();
|
||||
if (!bAlarmExtStatusJobArray[i].isAlive()) continue;
|
||||
BDialog.error((BWidget)this, (String)lex.getText("alarmExtManager.commandFail"), (Object)lex.getText("alarmExtManager.statusJobExists"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.topPane.isVisible()) {
|
||||
this.topPane.setVisible(true);
|
||||
this.topPane.getParentWidget().relayout();
|
||||
}
|
||||
if ((bWidgetShell = this.getShell()) != null) {
|
||||
bWidgetShell.enterBusy();
|
||||
}
|
||||
try {
|
||||
BOrd bOrd3 = BOrd.make((BOrd)bOrd, (String)"service:alarm:AlarmService");
|
||||
BAlarmService bAlarmService = (BAlarmService)bOrd3.resolve().get();
|
||||
BVector bVector = new BVector();
|
||||
for (int i = 0; i < bOrdArray.length; ++i) {
|
||||
bVector.add("o" + i, (BValue)bOrdArray[i]);
|
||||
}
|
||||
if (this.enableToOffnormal.isSelected()) {
|
||||
this.setJob(bAlarmService.enableToOffnormal(bVector), bAlarmService);
|
||||
} else {
|
||||
this.setJob(bAlarmService.disableToOffnormal(bVector), bAlarmService);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (bWidgetShell != null) {
|
||||
bWidgetShell.exitBusy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void enableToFault() {
|
||||
BWidgetShell bWidgetShell;
|
||||
BOrd[] bOrdArray = this.getSelectedOrds();
|
||||
if (bOrdArray.length == 0) {
|
||||
return;
|
||||
}
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)"service:baja:JobService");
|
||||
BJobService bJobService = (BJobService)bOrd2.resolve().get();
|
||||
bJobService.lease();
|
||||
BAlarmExtStatusJob[] bAlarmExtStatusJobArray = (BAlarmExtStatusJob[])bJobService.getChildren(class$com$tridium$alarm$BAlarmExtStatusJob == null ? (class$com$tridium$alarm$BAlarmExtStatusJob = BAlarmExtManager.class$("com.tridium.alarm.BAlarmExtStatusJob")) : class$com$tridium$alarm$BAlarmExtStatusJob);
|
||||
if (bAlarmExtStatusJobArray != null) {
|
||||
for (int i = 0; i < bAlarmExtStatusJobArray.length; ++i) {
|
||||
if (bAlarmExtStatusJobArray[i] == null) continue;
|
||||
bAlarmExtStatusJobArray[i].lease();
|
||||
if (!bAlarmExtStatusJobArray[i].isAlive()) continue;
|
||||
BDialog.error((BWidget)this, (String)lex.getText("alarmExtManager.commandFail"), (Object)lex.getText("alarmExtManager.statusJobExists"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.topPane.isVisible()) {
|
||||
this.topPane.setVisible(true);
|
||||
this.topPane.getParentWidget().relayout();
|
||||
}
|
||||
if ((bWidgetShell = this.getShell()) != null) {
|
||||
bWidgetShell.enterBusy();
|
||||
}
|
||||
try {
|
||||
BOrd bOrd3 = BOrd.make((BOrd)bOrd, (String)"service:alarm:AlarmService");
|
||||
BAlarmService bAlarmService = (BAlarmService)bOrd3.resolve().get();
|
||||
BVector bVector = new BVector();
|
||||
for (int i = 0; i < bOrdArray.length; ++i) {
|
||||
bVector.add("o" + i, (BValue)bOrdArray[i]);
|
||||
}
|
||||
if (this.enableToOffnormal.isSelected()) {
|
||||
this.setJob(bAlarmService.enableToFault(bVector), bAlarmService);
|
||||
} else {
|
||||
this.setJob(bAlarmService.disableToFault(bVector), bAlarmService);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (bWidgetShell != null) {
|
||||
bWidgetShell.exitBusy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BJob getJob() {
|
||||
return this.job;
|
||||
}
|
||||
|
||||
private void setJob(BJob bJob) {
|
||||
this.job = bJob;
|
||||
this.jobComplete = false;
|
||||
this.registerForComponentEvents((BComponent)bJob);
|
||||
this.jobBar.load(bJob);
|
||||
if (bJob != null && bJob.getJobState().isComplete() && !this.jobComplete) {
|
||||
this.jobComplete = true;
|
||||
this.jobComplete(bJob);
|
||||
}
|
||||
}
|
||||
|
||||
private void setJob(BOrd bOrd, BAlarmService bAlarmService) throws Exception {
|
||||
bAlarmService.getComponentSpace().sync();
|
||||
BJob bJob = (BJob)bOrd.get((BObject)bAlarmService);
|
||||
this.setJob(bJob);
|
||||
}
|
||||
|
||||
private void jobComplete(BJob bJob) {
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class AlarmExtTableModel
|
||||
extends DynamicTableModel {
|
||||
public int sortCol = -1;
|
||||
public boolean sortAsc = true;
|
||||
|
||||
public AlarmExtTableModel(TableModel tableModel, int[] nArray) {
|
||||
super(tableModel, nArray);
|
||||
}
|
||||
|
||||
public AlarmExtTableModel(TableModel tableModel) {
|
||||
super(tableModel);
|
||||
}
|
||||
|
||||
public void sortByColumn(int n, boolean bl) {
|
||||
this.sortCol = n;
|
||||
this.sortAsc = bl;
|
||||
super.sortByColumn(n, bl);
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
Object object = super.getValueAt(n, n2);
|
||||
if (this.toRootColumnIndex(n2) == 7) {
|
||||
try {
|
||||
return BAlarmExtManager.this.alarmService.getAlarmClassDisplayName(BString.make((String)object.toString()), null).toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return object.toString();
|
||||
}
|
||||
}
|
||||
if (object instanceof String) {
|
||||
object = SlotPath.unescape((String)((String)object));
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
public class GotoPoint
|
||||
extends Goto {
|
||||
public GotoPoint(int n, BITable bITable) {
|
||||
super("alarmExtManager.goto.point", n, bITable);
|
||||
}
|
||||
|
||||
public BOrd getTargetOrd() {
|
||||
return BOrd.make((String)("slot:" + BAlarmExtManager.this.collectionModel.getValueAt(this.row, 0)));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Goto
|
||||
extends Command {
|
||||
int row;
|
||||
BITable itable;
|
||||
|
||||
public Goto(String string, int n, BITable bITable) {
|
||||
super((BWidget)BAlarmExtManager.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager)), string);
|
||||
this.row = n;
|
||||
this.itable = bITable;
|
||||
}
|
||||
|
||||
public abstract BOrd getTargetOrd();
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BOrd bOrd = this.getTargetOrd();
|
||||
if (bOrd == null) {
|
||||
return null;
|
||||
}
|
||||
BOrd bOrd2 = ((BWbShell)BAlarmExtManager.this.getShell()).getActiveOrd();
|
||||
BOrd bOrd3 = BOrd.make((BOrd)bOrd2, (BOrd)bOrd).normalize();
|
||||
((BWbShell)this.getShell()).hyperlink(bOrd3);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class CellRenderer
|
||||
extends TableCellRenderer {
|
||||
BIDataTable lastTable = null;
|
||||
int stateOrdCol = -1;
|
||||
|
||||
private CellRenderer() {
|
||||
}
|
||||
|
||||
protected void paintCellBackground(Graphics graphics, TableCellRenderer.Cell cell) {
|
||||
if (cell.selected) {
|
||||
super.paintCellBackground(graphics, cell);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ColumnList columnList = BAlarmExtManager.this.itable.getColumns();
|
||||
if (BAlarmExtManager.this.itable != this.lastTable || this.stateOrdCol == -1) {
|
||||
this.stateOrdCol = columnList.indexOf("alarmState.ordinal");
|
||||
}
|
||||
BColor bColor = null;
|
||||
BColor bColor2 = null;
|
||||
TableModel tableModel = BAlarmExtManager.this.table.getModel();
|
||||
if (!(tableModel instanceof WrapperTableModel)) {
|
||||
super.paintCellBackground(graphics, cell);
|
||||
return;
|
||||
}
|
||||
int n = Integer.parseInt(((WrapperTableModel)tableModel).getRootModel().getValueAt(cell.row, this.stateOrdCol).toString());
|
||||
if (n != BAlarmState.normal.getOrdinal()) {
|
||||
if (n == BAlarmState.fault.getOrdinal()) {
|
||||
bColor = (BColor)BStatus.faultBg;
|
||||
bColor2 = (BColor)BStatus.faultFg;
|
||||
} else {
|
||||
bColor = (BColor)BStatus.alarmBg;
|
||||
bColor2 = (BColor)BStatus.alarmFg;
|
||||
}
|
||||
}
|
||||
if (bColor != null) {
|
||||
graphics.setBrush(bColor);
|
||||
graphics.fillRect(0.0, 0.0, cell.width, cell.height);
|
||||
graphics.setBrush(bColor2);
|
||||
} else {
|
||||
graphics.setBrush(Theme.table().getTextBrush());
|
||||
}
|
||||
graphics.setFont(Theme.table().getCellFont());
|
||||
}
|
||||
catch (ClassCastException classCastException) {
|
||||
super.paintCellBackground(graphics, cell);
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
super.paintCellBackground(graphics, cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Controller
|
||||
extends TableController {
|
||||
private Controller() {
|
||||
}
|
||||
|
||||
protected void cellDoubleClicked(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
ColumnList columnList = BAlarmExtManager.this.itable.getColumns();
|
||||
BOrd bOrd = null;
|
||||
String string = BAlarmExtManager.this.collectionModel.getValueAt(n, 1).toString();
|
||||
BOrd bOrd2 = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
bOrd = BOrd.make((BOrd)bOrd2, (String)("slot:" + string)).normalize();
|
||||
if (bOrd != null) {
|
||||
((BWbShell)this.getShell()).hyperlink(bOrd);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
ColumnList columnList = BAlarmExtManager.this.itable.getColumns();
|
||||
String string = BAlarmExtManager.this.collectionModel.getValueAt(n, 1).toString();
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)("slot:" + string)).normalize();
|
||||
BComponent bComponent = (BComponent)bOrd2.get();
|
||||
BMenu bMenu = new BMenu();
|
||||
bMenu.add(null, (BValue)new BSubMenuItem(NavMenuUtil.makeViewsMenu((BWidget)this.getTable(), (BObject)bComponent)));
|
||||
bMenu.add(null, (BValue)new BSubMenuItem(NavMenuUtil.makeActionsMenu((BWidget)this.getTable(), (BComponent)bComponent)));
|
||||
bMenu.add(null, (BValue)new BSeparator());
|
||||
bMenu.add(null, (Command)new GotoPoint(n, BAlarmExtManager.this.itable));
|
||||
bMenu.add(null, (BValue)new BSeparator());
|
||||
if (BAlarmExtManager.this.table.getModel().getSelection().getRows().length == 1) {
|
||||
BAlarmExtManager.this.enableToOffnormal.setSelected(BAlarmExtManager.this.itable.getBoolean(n, columnList.get("alarmEnable.isToOffnormal")));
|
||||
BAlarmExtManager.this.enableToFault.setSelected(BAlarmExtManager.this.itable.getBoolean(n, columnList.get("alarmEnable.isToFault")));
|
||||
}
|
||||
bMenu.add("toOffnormal", (Command)BAlarmExtManager.this.enableToOffnormal);
|
||||
bMenu.add("toFault", (Command)BAlarmExtManager.this.enableToFault);
|
||||
bMenu.add("editAlarmClass", BAlarmExtManager.this.editAlarmClass);
|
||||
bMenu.add("editInstructions", BAlarmExtManager.this.editInstructions);
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
}
|
||||
|
||||
public class EditInstructions
|
||||
extends Command {
|
||||
public EditInstructions() {
|
||||
super((BWidget)BAlarmExtManager.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager)), "alarm.editInstructions");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
Object object;
|
||||
int[] nArray = BAlarmExtManager.this.table.getSelection().getRows();
|
||||
BAlarmInstructions bAlarmInstructions = BAlarmInstructions.NULL;
|
||||
if (nArray.length == 1) {
|
||||
object = BAlarmExtManager.this.getExtensionForRow(nArray[0]);
|
||||
object.lease();
|
||||
bAlarmInstructions = ((BAlarmSourceExt)object).getAlarmInstructions();
|
||||
}
|
||||
object = new BInstructionsFE();
|
||||
BAlarmExtManager.this.add("temp", (BValue)object);
|
||||
object.loadValue((BObject)bAlarmInstructions, null);
|
||||
BAlarmExtManager.this.remove("temp");
|
||||
int n = BDialog.open((BWidget)BAlarmExtManager.this, (String)lex.get("alarm.editAlarmClass.label"), (Object)object, (int)3, (BImage)null);
|
||||
if (n == 1) {
|
||||
try {
|
||||
bAlarmInstructions = (BAlarmInstructions)object.saveValue((BObject)bAlarmInstructions, null);
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
BAlarmSourceExt bAlarmSourceExt = BAlarmExtManager.this.getExtensionForRow(nArray[i]);
|
||||
bAlarmSourceExt.lease();
|
||||
bAlarmSourceExt.setAlarmInstructions(bAlarmInstructions);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
BAlarmExtManager.this.updateTable();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class EditAlarmClass
|
||||
extends Command {
|
||||
public EditAlarmClass() {
|
||||
super((BWidget)BAlarmExtManager.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager)), "alarm.editAlarmClass");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
Object object;
|
||||
int[] nArray = BAlarmExtManager.this.table.getSelection().getRows();
|
||||
String string = "";
|
||||
if (nArray.length == 1) {
|
||||
object = BAlarmExtManager.this.getExtensionForRow(nArray[0]);
|
||||
object.lease();
|
||||
string = ((BAlarmSourceExt)object).getAlarmClass();
|
||||
}
|
||||
object = new BAlarmClassFE();
|
||||
BAlarmExtManager.this.add("temp", (BValue)object);
|
||||
object.loadValue((BObject)BString.make((String)string), null);
|
||||
BAlarmExtManager.this.remove("temp");
|
||||
int n = BDialog.open((BWidget)BAlarmExtManager.this, (String)lex.get("alarm.editAlarmClass.label"), (Object)object, (int)3, (BImage)null);
|
||||
if (n == 1) {
|
||||
try {
|
||||
string = object.saveValue((BObject)BString.make((String)string), null).toString();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
BAlarmSourceExt bAlarmSourceExt = BAlarmExtManager.this.getExtensionForRow(nArray[i]);
|
||||
bAlarmSourceExt.lease();
|
||||
bAlarmSourceExt.setAlarmClass(string);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
BAlarmExtManager.this.updateTable();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class EnableToFault
|
||||
extends ToggleCommand {
|
||||
public EnableToFault() {
|
||||
super((BWidget)BAlarmExtManager.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager)), "alarm.toFaultEnabled");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmExtManager.this.enableToFault();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class EnableToOffnormal
|
||||
extends ToggleCommand {
|
||||
public EnableToOffnormal() {
|
||||
super((BWidget)BAlarmExtManager.this, Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BAlarmExtManager == null ? (class$com$tridium$alarm$ui$BAlarmExtManager = BAlarmExtManager.class$("com.tridium.alarm.ui.BAlarmExtManager")) : class$com$tridium$alarm$ui$BAlarmExtManager)), "alarm.toOffnormalEnabled");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmExtManager.this.enableToOffnormal();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,592 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.collection.Column
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BOrientation
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.event.BKeyEvent
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.list.BList
|
||||
* javax.baja.ui.list.ListController
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.pane.BSplitPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DefaultTableModel
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.view.BWbComponentView
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.alarm.BAlarmSourceInfo;
|
||||
import javax.baja.alarm.ext.BAlarmSourceExt;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.collection.Column;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BOrientation;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.event.BKeyEvent;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.list.BList;
|
||||
import javax.baja.ui.list.ListController;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.pane.BSplitPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DefaultTableModel;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.view.BWbComponentView;
|
||||
|
||||
public class BAlarmInstructionsManager
|
||||
extends BWbComponentView {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmInstructionsManager == null ? (class$com$tridium$alarm$ui$BAlarmInstructionsManager = BAlarmInstructionsManager.class$("com.tridium.alarm.ui.BAlarmInstructionsManager")) : class$com$tridium$alarm$ui$BAlarmInstructionsManager));
|
||||
protected BAlarmService alarmService;
|
||||
protected Context cx;
|
||||
protected Model model;
|
||||
protected BTable table;
|
||||
protected BList instructionList;
|
||||
protected BList masterList;
|
||||
Command mAddCmd;
|
||||
Command mRemoveCmd;
|
||||
Command mEditCmd;
|
||||
Command mSaveCmd;
|
||||
Command saveCmd;
|
||||
Command addFromMasterCmd;
|
||||
Command addCmd;
|
||||
Command removeCmd;
|
||||
Command moveUpCmd;
|
||||
Command moveDownCmd;
|
||||
Command editCmd;
|
||||
Hashtable instructions = new Hashtable();
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmInstructionsManager == null ? (class$com$tridium$alarm$ui$BAlarmInstructionsManager = BAlarmInstructionsManager.class$("com.tridium.alarm.ui.BAlarmInstructionsManager")) : class$com$tridium$alarm$ui$BAlarmInstructionsManager);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmInstructionsManager;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmSourceInfo;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmInstructionsManager() {
|
||||
this.addCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.addMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BDialog.prompt((BWidget)BAlarmInstructionsManager.this, (String)"Add", (String)"", (int)40);
|
||||
if (string != null) {
|
||||
BAlarmInstructionsManager.this.instructionList.addItem((Object)BString.make((String)string));
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.removeCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.removeMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmInstructionsManager.this.instructionList.removeSelectedItems();
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.removeCmd.setEnabled(false);
|
||||
this.editCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.editMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
if (BAlarmInstructionsManager.this.instructionList.getSelectedItem() == null) {
|
||||
return null;
|
||||
}
|
||||
String string = BDialog.prompt((BWidget)BAlarmInstructionsManager.this, (String)"Edit", (String)BAlarmInstructionsManager.this.instructionList.getSelectedItem().toString(), (int)40);
|
||||
if (string != null) {
|
||||
BAlarmInstructionsManager.this.instructionList.setItem(BAlarmInstructionsManager.this.instructionList.getSelectedIndex(), (Object)BString.make((String)string));
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.editCmd.setEnabled(false);
|
||||
this.moveUpCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.moveUp"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BAlarmInstructionsManager.this.instructionList.getSelectedIndex();
|
||||
if (n > 0) {
|
||||
Object object = BAlarmInstructionsManager.this.instructionList.getItem(n);
|
||||
Object object2 = BAlarmInstructionsManager.this.instructionList.getItem(n - 1);
|
||||
BAlarmInstructionsManager.this.instructionList.setItem(n, object2);
|
||||
BAlarmInstructionsManager.this.instructionList.setItem(n - 1, object);
|
||||
BAlarmInstructionsManager.this.instructionList.getSelection().deselectAll();
|
||||
BAlarmInstructionsManager.this.instructionList.getSelection().select(n - 1);
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.moveUpCmd.setEnabled(false);
|
||||
this.moveDownCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.moveDown"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BAlarmInstructionsManager.this.instructionList.getSelectedIndex();
|
||||
if (n < BAlarmInstructionsManager.this.instructionList.getItemCount() - 1) {
|
||||
Object object = BAlarmInstructionsManager.this.instructionList.getItem(n);
|
||||
Object object2 = BAlarmInstructionsManager.this.instructionList.getItem(n + 1);
|
||||
BAlarmInstructionsManager.this.instructionList.setItem(n, object2);
|
||||
BAlarmInstructionsManager.this.instructionList.setItem(n + 1, object);
|
||||
BAlarmInstructionsManager.this.instructionList.getSelection().deselectAll();
|
||||
BAlarmInstructionsManager.this.instructionList.getSelection().select(n + 1);
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.moveDownCmd.setEnabled(false);
|
||||
this.saveCmd = new Command((BWidget)this, UiLexicon.bajaui.module, "commands.save"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int[] nArray = BAlarmInstructionsManager.this.table.getSelection().getRows();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
BAlarmInstructions bAlarmInstructions = ((Controller)BAlarmInstructionsManager.this.table.getController()).getInstructions(nArray[i]);
|
||||
BFormat[] bFormatArray = new BFormat[BAlarmInstructionsManager.this.instructionList.getItemCount()];
|
||||
for (int j = 0; j < BAlarmInstructionsManager.this.instructionList.getItemCount(); ++j) {
|
||||
bFormatArray[j] = BFormat.make((String)BAlarmInstructionsManager.this.instructionList.getItem(j).toString());
|
||||
}
|
||||
bAlarmInstructions = BAlarmInstructions.make(bFormatArray);
|
||||
((Controller)BAlarmInstructionsManager.this.table.getController()).setInstructions(nArray[i], bAlarmInstructions);
|
||||
}
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(false);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.saveCmd.setEnabled(false);
|
||||
this.addFromMasterCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.addFromMaster"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
Object[] objectArray = BAlarmInstructionsManager.this.masterList.getSelectedItems();
|
||||
for (int i = 0; i < objectArray.length; ++i) {
|
||||
BAlarmInstructionsManager.this.instructionList.addItem((Object)((BFormat)objectArray[i]));
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.addFromMasterCmd.setEnabled(false);
|
||||
this.mAddCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.addMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BDialog.prompt((BWidget)BAlarmInstructionsManager.this, (String)"Add", (String)"", (int)40);
|
||||
if (string != null) {
|
||||
BAlarmInstructionsManager.this.masterList.addItem((Object)BFormat.make((String)string));
|
||||
BAlarmInstructionsManager.this.setModified();
|
||||
BAlarmInstructionsManager.this.mSaveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.mRemoveCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.removeMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmInstructionsManager.this.masterList.removeSelectedItems();
|
||||
BAlarmInstructionsManager.this.setModified();
|
||||
BAlarmInstructionsManager.this.mSaveCmd.setEnabled(true);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.mRemoveCmd.setEnabled(false);
|
||||
this.mEditCmd = new Command((BWidget)this, BAlarmInstructionsManager.lexicon.module, "commands.editMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
if (BAlarmInstructionsManager.this.masterList.getSelectedItem() == null) {
|
||||
return null;
|
||||
}
|
||||
String string = BDialog.prompt((BWidget)BAlarmInstructionsManager.this, (String)"Edit", (String)BAlarmInstructionsManager.this.masterList.getSelectedItem().toString(), (int)40);
|
||||
if (string != null) {
|
||||
BAlarmInstructionsManager.this.masterList.setItem(BAlarmInstructionsManager.this.masterList.getSelectedIndex(), (Object)BFormat.make((String)string));
|
||||
BAlarmInstructionsManager.this.setModified();
|
||||
BAlarmInstructionsManager.this.mSaveCmd.setEnabled(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.mEditCmd.setEnabled(false);
|
||||
this.mSaveCmd = new Command((BWidget)this, UiLexicon.bajaui.module, "commands.save"){
|
||||
|
||||
public CommandArtifact doInvoke() throws Exception {
|
||||
BAlarmInstructionsManager.this.saveValue();
|
||||
BAlarmInstructionsManager.this.mSaveCmd.setEnabled(false);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.mSaveCmd.setEnabled(false);
|
||||
BSplitPane bSplitPane = new BSplitPane(BOrientation.vertical, 50.0);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
this.instructionList = new BList();
|
||||
this.instructionList.setController((ListController)new InstListController());
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.setValign(BValign.top);
|
||||
bGridPane.add(null, (BValue)new BButton(this.addCmd));
|
||||
bGridPane.add(null, (BValue)new BButton(this.removeCmd));
|
||||
bGridPane.add(null, (BValue)new BButton(this.editCmd));
|
||||
bGridPane.add(null, (BValue)new BButton(this.saveCmd));
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
bGridPane.add(null, (BValue)new BButton(this.moveUpCmd));
|
||||
bGridPane.add(null, (BValue)new BButton(this.moveDownCmd));
|
||||
bEdgePane.setCenter((BWidget)this.instructionList);
|
||||
bEdgePane.setRight((BWidget)bGridPane);
|
||||
BGridPane bGridPane2 = new BGridPane(1);
|
||||
bGridPane2.add(null, (BValue)new BButton(this.addFromMasterCmd));
|
||||
bEdgePane.setBottom((BWidget)bGridPane2);
|
||||
bSplitPane.setWidget1((BWidget)new BTitlePane("Point Instructions", (BWidget)bEdgePane));
|
||||
BEdgePane bEdgePane2 = new BEdgePane();
|
||||
this.masterList = new BList();
|
||||
this.masterList.setController((ListController)new MasterListController());
|
||||
BGridPane bGridPane3 = new BGridPane(1);
|
||||
bGridPane3.setColumnAlign(BHalign.fill);
|
||||
bGridPane3.setValign(BValign.top);
|
||||
bGridPane3.add(null, (BValue)new BButton(this.mAddCmd));
|
||||
bGridPane3.add(null, (BValue)new BButton(this.mRemoveCmd));
|
||||
bGridPane3.add(null, (BValue)new BButton(this.mEditCmd));
|
||||
bGridPane3.add(null, (BValue)new BButton(this.mSaveCmd));
|
||||
bEdgePane2.setCenter((BWidget)this.masterList);
|
||||
bEdgePane2.setRight((BWidget)bGridPane3);
|
||||
bSplitPane.setWidget2((BWidget)new BTitlePane("Master Instructions List", (BWidget)bEdgePane2));
|
||||
this.table = new BTable();
|
||||
this.table.setController((TableController)new Controller());
|
||||
BSplitPane bSplitPane2 = new BSplitPane(BOrientation.horizontal, 35.0);
|
||||
bSplitPane2.setWidget1((BWidget)new BTitlePane("Points", (BWidget)this.table));
|
||||
bSplitPane2.setWidget2((BWidget)bSplitPane);
|
||||
this.setContent((BWidget)new BBorderPane((BWidget)bSplitPane2));
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) {
|
||||
System.out.println("start");
|
||||
this.alarmService = (BAlarmService)bObject;
|
||||
this.cx = context;
|
||||
this.model = new Model();
|
||||
this.table.setModel((TableModel)new DynamicTableModel((TableModel)this.model, new int[]{0, 1}));
|
||||
this.table.setController((TableController)new Controller());
|
||||
new Thread(){
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void run() {
|
||||
BAlarmInstructionsManager.this.enterBusy();
|
||||
try {
|
||||
BAlarmInstructionsManager.this.alarmService.lease();
|
||||
BAlarmInstructions bAlarmInstructions = BAlarmInstructionsManager.this.alarmService.getMasterAlarmInstructions();
|
||||
for (int i = 0; i < bAlarmInstructions.size(); ++i) {
|
||||
BAlarmInstructionsManager.this.masterList.addItem((Object)bAlarmInstructions.get(i));
|
||||
}
|
||||
BObject[] bObjectArray = BAlarmInstructionsManager.this.queryPoints();
|
||||
for (int i = 0; i < bObjectArray.length; ++i) {
|
||||
try {
|
||||
BComponent bComponent = (BComponent)bObjectArray[i];
|
||||
bComponent.lease();
|
||||
Property[] propertyArray = bComponent.getPropertiesArray();
|
||||
for (int j = 0; j < propertyArray.length; ++j) {
|
||||
Property property = propertyArray[j];
|
||||
if (property.getType().equals(BAlarmInstructions.TYPE)) {
|
||||
BAlarmInstructionsManager.this.model.addRow(bComponent, property);
|
||||
continue;
|
||||
}
|
||||
if (!property.getType().equals(BAlarmSourceInfo.TYPE)) continue;
|
||||
BAlarmInstructionsManager.this.model.addRow(bComponent, property);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
BAlarmInstructionsManager.this.exitBusy();
|
||||
BAlarmInstructionsManager.this.table.sizeColumnsToFit();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
protected BObject[] queryPoints() {
|
||||
BOrd bOrd = ((BWbShell)this.getShell()).getActiveOrd();
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bOrd, (String)"station:|slot:/|bql:select slotPath from alarm:IAlarmSource").normalize();
|
||||
BITable bITable = ((BICollection)bOrd2.resolve().get()).toTable();
|
||||
Column column = bITable.getColumns().get(0);
|
||||
BObject[] bObjectArray = new BObject[bITable.size()];
|
||||
for (int i = 0; i < bITable.size(); ++i) {
|
||||
BOrd bOrd3 = BOrd.make((String)bITable.getString(i, column));
|
||||
bObjectArray[i] = bOrd3.resolve((BObject)this.alarmService).get();
|
||||
}
|
||||
return bObjectArray;
|
||||
}
|
||||
|
||||
public BObject doSaveValue(BObject bObject, Context context) {
|
||||
BAlarmService bAlarmService = (BAlarmService)bObject;
|
||||
BFormat[] bFormatArray = new BFormat[this.masterList.getItemCount()];
|
||||
for (int i = 0; i < this.masterList.getItemCount(); ++i) {
|
||||
bFormatArray[i] = BFormat.make((String)this.masterList.getItem(i).toString());
|
||||
}
|
||||
bAlarmService.setMasterAlarmInstructions(BAlarmInstructions.make(bFormatArray));
|
||||
return bAlarmService;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class MasterListController
|
||||
extends ListController {
|
||||
MasterListController() {
|
||||
}
|
||||
|
||||
public void keyReleased(BKeyEvent bKeyEvent) {
|
||||
super.keyReleased(bKeyEvent);
|
||||
this.enabledCommands();
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
this.enabledCommands();
|
||||
}
|
||||
|
||||
protected void enabledCommands() {
|
||||
int n = this.getList().getSelection().getItemCount();
|
||||
if (n > 0) {
|
||||
BAlarmInstructionsManager.this.addFromMasterCmd.setEnabled(true);
|
||||
BAlarmInstructionsManager.this.mRemoveCmd.setEnabled(true);
|
||||
BAlarmInstructionsManager.this.mEditCmd.setEnabled(true);
|
||||
} else {
|
||||
BAlarmInstructionsManager.this.addFromMasterCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.mRemoveCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.mEditCmd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class InstListController
|
||||
extends ListController {
|
||||
InstListController() {
|
||||
}
|
||||
|
||||
public void keyReleased(BKeyEvent bKeyEvent) {
|
||||
super.keyReleased(bKeyEvent);
|
||||
this.enabledCommands();
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
this.enabledCommands();
|
||||
}
|
||||
|
||||
protected void enabledCommands() {
|
||||
int n = BAlarmInstructionsManager.this.instructionList.getSelection().getItemCount();
|
||||
if (n > 0) {
|
||||
BAlarmInstructionsManager.this.removeCmd.setEnabled(true);
|
||||
BAlarmInstructionsManager.this.editCmd.setEnabled(true);
|
||||
if (this.getList().getItemCount() > 1) {
|
||||
BAlarmInstructionsManager.this.moveUpCmd.setEnabled(true);
|
||||
BAlarmInstructionsManager.this.moveDownCmd.setEnabled(true);
|
||||
} else {
|
||||
BAlarmInstructionsManager.this.moveUpCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.moveDownCmd.setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
BAlarmInstructionsManager.this.removeCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.moveUpCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.moveDownCmd.setEnabled(false);
|
||||
BAlarmInstructionsManager.this.editCmd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected class Controller
|
||||
extends TableController {
|
||||
Hashtable components = new Hashtable();
|
||||
|
||||
protected Controller() {
|
||||
}
|
||||
|
||||
public void keyReleased(BKeyEvent bKeyEvent) {
|
||||
super.keyReleased(bKeyEvent);
|
||||
this.showInstructions();
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
this.showInstructions();
|
||||
}
|
||||
|
||||
protected void setInstructions(int n, BAlarmInstructions bAlarmInstructions) {
|
||||
BComponent bComponent = BAlarmInstructionsManager.this.model.getComponent(n);
|
||||
bComponent.lease();
|
||||
Property property = BAlarmInstructionsManager.this.model.getProperty(n);
|
||||
if (property.getType() == BAlarmInstructions.TYPE) {
|
||||
bComponent.set(BAlarmInstructionsManager.this.model.getProperty(n), (BValue)bAlarmInstructions);
|
||||
} else {
|
||||
BAlarmSourceInfo bAlarmSourceInfo = (BAlarmSourceInfo)bComponent.get(BAlarmInstructionsManager.this.model.getProperty(n));
|
||||
bAlarmSourceInfo.lease();
|
||||
bAlarmSourceInfo.setAlarmInstructions(bAlarmInstructions);
|
||||
}
|
||||
}
|
||||
|
||||
protected BAlarmInstructions getInstructions(int n) {
|
||||
BComponent bComponent = BAlarmInstructionsManager.this.model.getComponent(n);
|
||||
bComponent.lease();
|
||||
Property property = BAlarmInstructionsManager.this.model.getProperty(n);
|
||||
if (property.getType() == BAlarmInstructions.TYPE) {
|
||||
return (BAlarmInstructions)bComponent.get(property);
|
||||
}
|
||||
BAlarmSourceInfo bAlarmSourceInfo = (BAlarmSourceInfo)bComponent.get(BAlarmInstructionsManager.this.model.getProperty(n));
|
||||
bAlarmSourceInfo.lease();
|
||||
return bAlarmSourceInfo.getAlarmInstructions();
|
||||
}
|
||||
|
||||
protected void showInstructions() {
|
||||
TableSelection tableSelection = this.getTable().getSelection();
|
||||
BAlarmInstructionsManager.this.instructionList.getSelection().deselectAll();
|
||||
if (tableSelection.getRowCount() == 1) {
|
||||
BAlarmInstructions bAlarmInstructions = this.getInstructions(tableSelection.getRow());
|
||||
BAlarmInstructionsManager.this.instructionList.removeAllItems();
|
||||
for (int i = 0; i < bAlarmInstructions.size(); ++i) {
|
||||
BAlarmInstructionsManager.this.instructionList.addItem((Object)bAlarmInstructions.get(i));
|
||||
}
|
||||
} else if (tableSelection.getRowCount() > 1) {
|
||||
int n;
|
||||
BAlarmInstructionsManager.this.instructionList.removeAllItems();
|
||||
int[] nArray = tableSelection.getRows();
|
||||
BAlarmInstructions bAlarmInstructions = null;
|
||||
boolean bl = true;
|
||||
for (n = 0; n < nArray.length; ++n) {
|
||||
BAlarmInstructions bAlarmInstructions2 = this.getInstructions(nArray[n]);
|
||||
if (bAlarmInstructions == null) {
|
||||
bAlarmInstructions = (BAlarmInstructions)bAlarmInstructions2.newCopy();
|
||||
continue;
|
||||
}
|
||||
if (bAlarmInstructions.equivalent((Object)bAlarmInstructions2)) continue;
|
||||
bl = false;
|
||||
break;
|
||||
}
|
||||
if (bl) {
|
||||
for (n = 0; n < bAlarmInstructions.size(); ++n) {
|
||||
BAlarmInstructionsManager.this.instructionList.addItem((Object)bAlarmInstructions.get(n));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
((InstListController)BAlarmInstructionsManager.this.instructionList.getController()).enabledCommands();
|
||||
BAlarmInstructionsManager.this.saveCmd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected class Model
|
||||
extends DefaultTableModel {
|
||||
Hashtable controllers = new Hashtable();
|
||||
|
||||
public Model() {
|
||||
super(new String[]{"Point", "Condition", "Path"});
|
||||
}
|
||||
|
||||
public BComponent getComponent(int n) {
|
||||
return (BComponent)super.getValueAt(n, 0);
|
||||
}
|
||||
|
||||
public Property getProperty(int n) {
|
||||
return (Property)super.getValueAt(n, 1);
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
if (n2 == 2) {
|
||||
try {
|
||||
BComponent bComponent = this.getComponent(n);
|
||||
return bComponent.toPathString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (n2 == 1) {
|
||||
return ((Property)super.getValueAt(n, n2)).getDefaultDisplayName(BAlarmInstructionsManager.this.cx);
|
||||
}
|
||||
if (n2 == 0) {
|
||||
BComponent bComponent = this.getComponent(n);
|
||||
bComponent.lease();
|
||||
String string = bComponent.getDisplayName(BAlarmInstructionsManager.this.cx);
|
||||
if (bComponent instanceof BAlarmSourceExt) {
|
||||
string = ((BAlarmSourceExt)bComponent).getSourceName().format((Object)bComponent);
|
||||
} else {
|
||||
BAlarmSourceInfo[] bAlarmSourceInfoArray = (BAlarmSourceInfo[])bComponent.getChildren(class$javax$baja$alarm$BAlarmSourceInfo == null ? (class$javax$baja$alarm$BAlarmSourceInfo = BAlarmInstructionsManager.class$("javax.baja.alarm.BAlarmSourceInfo")) : class$javax$baja$alarm$BAlarmSourceInfo);
|
||||
if (bAlarmSourceInfoArray.length > 0) {
|
||||
bAlarmSourceInfoArray[0].lease();
|
||||
string = bAlarmSourceInfoArray[0].getSourceName().format((Object)bAlarmSourceInfoArray[0]);
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
|
||||
public void addRow(BComponent bComponent, Property property) {
|
||||
BComponent bComponent2 = bComponent;
|
||||
this.addRow(new Object[]{bComponent2, property, null});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.workbench.CannotSaveException
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.alarm.BAlarmPriorities;
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.workbench.CannotSaveException;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BAlarmPrioritiesFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmPrioritiesFE == null ? (class$com$tridium$alarm$ui$BAlarmPrioritiesFE = BAlarmPrioritiesFE.class$("com.tridium.alarm.ui.BAlarmPrioritiesFE")) : class$com$tridium$alarm$ui$BAlarmPrioritiesFE));
|
||||
static final String offnormalText = BAlarmTransitionBits.DEFAULT.getTag(1);
|
||||
static final String faultText = BAlarmTransitionBits.DEFAULT.getTag(2);
|
||||
static final String normalText = BAlarmTransitionBits.DEFAULT.getTag(4);
|
||||
static final String alertText = BAlarmTransitionBits.DEFAULT.getTag(8);
|
||||
private boolean init = false;
|
||||
private BTextField offnormal;
|
||||
private BTextField fault;
|
||||
private BTextField normal;
|
||||
private BTextField alert;
|
||||
private BAlarmPriorities priorities;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmPrioritiesFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.init = false;
|
||||
if (bl) {
|
||||
this.setContent((BWidget)new BTextField("", 40, false));
|
||||
}
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BAlarmPriorities bAlarmPriorities = (BAlarmPriorities)bObject;
|
||||
if (this.isReadonly()) {
|
||||
((BTextField)this.getContent()).setText(bObject.toString());
|
||||
} else {
|
||||
if (!this.init) {
|
||||
this.initUi();
|
||||
}
|
||||
this.offnormal.setText(Integer.toString(bAlarmPriorities.getToOffnormal()));
|
||||
this.fault.setText(Integer.toString(bAlarmPriorities.getToFault()));
|
||||
this.normal.setText(Integer.toString(bAlarmPriorities.getToNormal()));
|
||||
this.alert.setText(Integer.toString(bAlarmPriorities.getToAlert()));
|
||||
this.linkTo((BComponent)this.offnormal, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.fault, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.normal, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.alert, (Slot)BTextField.actionPerformed, (Slot)actionPerformed);
|
||||
}
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) throws CannotSaveException {
|
||||
int n = Integer.parseInt(this.offnormal.getText());
|
||||
int n2 = Integer.parseInt(this.fault.getText());
|
||||
int n3 = Integer.parseInt(this.normal.getText());
|
||||
int n4 = Integer.parseInt(this.alert.getText());
|
||||
try {
|
||||
return BAlarmPriorities.make(n, n2, n3, n4);
|
||||
}
|
||||
catch (IllegalStateException illegalStateException) {
|
||||
throw new CannotSaveException(illegalStateException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void initUi() {
|
||||
this.init = true;
|
||||
BGridPane bGridPane = new BGridPane(8);
|
||||
bGridPane.add(null, (BValue)new BLabel(offnormalText), null);
|
||||
this.offnormal = new BTextField("", 5);
|
||||
bGridPane.add("offNormal", (BValue)this.offnormal, null);
|
||||
bGridPane.add(null, (BValue)new BLabel(faultText), null);
|
||||
this.fault = new BTextField("", 5);
|
||||
bGridPane.add("fault", (BValue)this.fault, null);
|
||||
bGridPane.add(null, (BValue)new BLabel(normalText), null);
|
||||
this.normal = new BTextField("", 5);
|
||||
bGridPane.add("normal", (BValue)this.normal, null);
|
||||
bGridPane.add(null, (BValue)new BLabel(alertText), null);
|
||||
this.alert = new BTextField("", 5);
|
||||
bGridPane.add("alert", (BValue)this.alert, null);
|
||||
this.setContent((BWidget)bGridPane);
|
||||
this.linkTo("lk0", (BComponent)this.offnormal, (Slot)BTextField.textModified, (Slot)setModified);
|
||||
this.linkTo("lk1", (BComponent)this.fault, (Slot)BTextField.textModified, (Slot)setModified);
|
||||
this.linkTo("lk2", (BComponent)this.normal, (Slot)BTextField.textModified, (Slot)setModified);
|
||||
this.linkTo("lk3", (BComponent)this.alert, (Slot)BTextField.textModified, (Slot)setModified);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.security.BPermissions
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.LocalizableRuntimeException
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BNullWidget
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BKeyEvent
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.event.BWindowEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmClassDef;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.alarm.ui.BAlarmTitlePane;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.security.BPermissions;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.LocalizableRuntimeException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BNullWidget;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BKeyEvent;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.event.BWindowEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BAlarmReportDialog
|
||||
extends BDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmReportDialog == null ? (class$com$tridium$alarm$ui$BAlarmReportDialog = BAlarmReportDialog.class$("com.tridium.alarm.ui.BAlarmReportDialog")) : class$com$tridium$alarm$ui$BAlarmReportDialog));
|
||||
BAlarmConsole console;
|
||||
BTable table;
|
||||
String title;
|
||||
private Command ackCmd;
|
||||
private Command closeCmd;
|
||||
private Command hyperlinkCmd;
|
||||
private Command notesCmd;
|
||||
private Command detailsCmd;
|
||||
private Command showVideoCmd;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmReportDialog;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmReportDialog() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public BAlarmReportDialog(BAlarmConsole bAlarmConsole, String string, BTable bTable) {
|
||||
super((BWidget)bAlarmConsole, string, true);
|
||||
Object object;
|
||||
BAlarmRecord bAlarmRecord;
|
||||
this.console = bAlarmConsole;
|
||||
this.table = bTable;
|
||||
this.hyperlinkCmd = new HyperlinkCommand((BWidget)this);
|
||||
BButton bButton = new BButton(this.hyperlinkCmd, true, true);
|
||||
this.ackCmd = new AckCommand((BWidget)this);
|
||||
BButton bButton2 = new BButton(this.ackCmd, true, true);
|
||||
this.notesCmd = new NotesCommand((BWidget)this);
|
||||
BButton bButton3 = new BButton(this.notesCmd, true, true);
|
||||
this.showVideoCmd = new ShowVideoCommand((BWidget)this);
|
||||
BButton bButton4 = new BButton(this.showVideoCmd, true, true);
|
||||
this.closeCmd = new CloseCommand((BWidget)this);
|
||||
BButton bButton5 = new BButton(this.closeCmd, true, true);
|
||||
this.detailsCmd = new DetailsCommand((BWidget)this);
|
||||
BGridPane bGridPane = new BGridPane(BAlarmConsole.isVideoDriverAvailable() ? 5 : 4);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.setUniformColumnWidth(true);
|
||||
ConsoleTableModel consoleTableModel = (ConsoleTableModel)((DynamicTableModel)bTable.getModel()).getRootModel();
|
||||
if (consoleTableModel.getRowCount() > 0) {
|
||||
bAlarmRecord = consoleTableModel.getRecord(0);
|
||||
object = bAlarmConsole.getAlarmService();
|
||||
BAlarmClass bAlarmClass = ((BAlarmService)object).lookupAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
BPermissions bPermissions = bAlarmClass.getPermissions(bAlarmConsole.ctx);
|
||||
if (bPermissions.hasOperatorWrite()) {
|
||||
bGridPane.add("ack", (BValue)bButton2);
|
||||
}
|
||||
} else {
|
||||
bGridPane.add("ack", (BValue)bButton2);
|
||||
}
|
||||
bGridPane.add("url", (BValue)bButton);
|
||||
bGridPane.add("notes", (BValue)bButton3);
|
||||
if (BAlarmConsole.isVideoDriverAvailable()) {
|
||||
bGridPane.add("showVideo", (BValue)bButton4);
|
||||
}
|
||||
bGridPane.add("close", (BValue)bButton5);
|
||||
bAlarmRecord = new BEdgePane();
|
||||
bAlarmRecord.setBottom((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
object = new Controller();
|
||||
bTable.setController((TableController)object);
|
||||
bAlarmRecord.setCenter((BWidget)BAlarmTitlePane.makePane(bAlarmConsole.getTitle(), bTable));
|
||||
bTable.getSelection().select(0);
|
||||
((Controller)((Object)object)).enableCommands();
|
||||
this.setContent((BWidget)bAlarmRecord);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
((BEdgePane)this.getContent()).setCenter((BWidget)new BNullWidget());
|
||||
super.close();
|
||||
}
|
||||
|
||||
public void windowClosing(BWindowEvent bWindowEvent) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
public void keyReleased(BKeyEvent bKeyEvent) {
|
||||
super.keyReleased(bKeyEvent);
|
||||
this.enableCommands();
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
this.enableCommands();
|
||||
}
|
||||
|
||||
void enableCommands() {
|
||||
TableSelection tableSelection = this.getTable().getSelection();
|
||||
if (tableSelection.getRows().length == 1) {
|
||||
BAlarmClassDef bAlarmClassDef;
|
||||
Object object;
|
||||
ConsoleTableModel consoleTableModel = (ConsoleTableModel)((DynamicTableModel)this.getTable().getModel()).getRootModel();
|
||||
BAlarmRecord bAlarmRecord = consoleTableModel.getRecord(tableSelection.getRow());
|
||||
BString bString = (BString)bAlarmRecord.getAlarmData().get("hyperlinkOrd");
|
||||
BOrd bOrd = BOrd.NULL;
|
||||
if (bString != null) {
|
||||
bOrd = BOrd.make((String)bString.toString());
|
||||
}
|
||||
if (bOrd == null || bOrd.isNull()) {
|
||||
object = BAlarmReportDialog.this.console.options.getAlarmClassMapping();
|
||||
bAlarmClassDef = object.getAlarmClassDefFor(bAlarmRecord.getAlarmClass());
|
||||
bOrd = bAlarmClassDef.getAlarmUrl();
|
||||
}
|
||||
if (bOrd != null && !bOrd.isNull()) {
|
||||
BAlarmReportDialog.this.hyperlinkCmd.setEnabled(true);
|
||||
} else {
|
||||
BAlarmReportDialog.this.hyperlinkCmd.setEnabled(false);
|
||||
}
|
||||
object = bAlarmRecord.getAlarmData().gets("cameraOrd", null);
|
||||
if (object != null) {
|
||||
bAlarmClassDef = BOrd.make((String)object);
|
||||
if (!bAlarmClassDef.equals(BOrd.NULL)) {
|
||||
BAlarmReportDialog.this.showVideoCmd.setEnabled(true);
|
||||
} else {
|
||||
BAlarmReportDialog.this.showVideoCmd.setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
BAlarmReportDialog.this.showVideoCmd.setEnabled(false);
|
||||
}
|
||||
BAlarmReportDialog.this.notesCmd.setEnabled(true);
|
||||
} else {
|
||||
BAlarmReportDialog.this.hyperlinkCmd.setEnabled(false);
|
||||
BAlarmReportDialog.this.notesCmd.setEnabled(false);
|
||||
BAlarmReportDialog.this.detailsCmd.setEnabled(false);
|
||||
BAlarmReportDialog.this.showVideoCmd.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellReleased(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
super.cellReleased(bMouseEvent, n, n2);
|
||||
if (bMouseEvent.getClickCount() == 2) {
|
||||
BAlarmReportDialog.this.console.showDetailsDialog(BAlarmReportDialog.this.table, n);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
BMenu bMenu = new BMenu();
|
||||
bMenu.add("ack", BAlarmReportDialog.this.ackCmd);
|
||||
bMenu.add("url", BAlarmReportDialog.this.hyperlinkCmd);
|
||||
bMenu.add("notes", BAlarmReportDialog.this.notesCmd);
|
||||
bMenu.add("details", BAlarmReportDialog.this.detailsCmd);
|
||||
if (BAlarmConsole.isVideoDriverAvailable()) {
|
||||
bMenu.add("showVideo", BAlarmReportDialog.this.showVideoCmd);
|
||||
}
|
||||
bMenu.open((BWidget)BAlarmReportDialog.this.table, bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
public BMenu makeOptionsMenu() {
|
||||
BMenu bMenu = super.makeOptionsMenu();
|
||||
bMenu.add("acSep", (BValue)new BSeparator());
|
||||
bMenu.add("addColumn", BAlarmReportDialog.this.console.addColumnCommand);
|
||||
bMenu.add("removeColumn", BAlarmReportDialog.this.console.removeColumnCommand);
|
||||
return bMenu;
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowVideoCommand
|
||||
extends Command {
|
||||
public ShowVideoCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.showVideo");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
block9: {
|
||||
try {
|
||||
Class clazz = Sys.loadClass((String)"videoDriver", (String)"com.tridium.videoDriver.alarm.AlarmConsoleExt");
|
||||
if (clazz != null) {
|
||||
Method method = clazz.getMethod("doShowVideo", class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmReportDialog.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole, class$javax$baja$alarm$BAlarmRecord == null ? (class$javax$baja$alarm$BAlarmRecord = BAlarmReportDialog.class$("javax.baja.alarm.BAlarmRecord")) : class$javax$baja$alarm$BAlarmRecord);
|
||||
if (method != null) {
|
||||
BAlarmRecord[] bAlarmRecordArray = BAlarmReportDialog.this.console.getSelectedAlarms(BAlarmReportDialog.this.table);
|
||||
if (bAlarmRecordArray != null && bAlarmRecordArray.length > 0) {
|
||||
method.invoke((Object)clazz, new Object[]{BAlarmReportDialog.this.console, bAlarmRecordArray[0]});
|
||||
}
|
||||
} else {
|
||||
System.out.println("The 'doShowVideo' method was not found on class AlarmConsoleExt in videoDriver.jar. Please have my program fixed");
|
||||
}
|
||||
break block9;
|
||||
}
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound");
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)classNotFoundException);
|
||||
}
|
||||
catch (NoSuchMethodException noSuchMethodException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)noSuchMethodException);
|
||||
}
|
||||
catch (InvocationTargetException invocationTargetException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)invocationTargetException);
|
||||
}
|
||||
catch (IllegalAccessException illegalAccessException) {
|
||||
throw new LocalizableRuntimeException("alarm", "VideoDriverModuleNotFound", (Throwable)illegalAccessException);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class DetailsCommand
|
||||
extends Command {
|
||||
public DetailsCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.details");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int[] nArray = BAlarmReportDialog.this.table.getSelection().getRows();
|
||||
if (nArray.length != 1) {
|
||||
return null;
|
||||
}
|
||||
BAlarmReportDialog.this.console.showDetailsDialog(BAlarmReportDialog.this.table, nArray[0]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseCommand
|
||||
extends Command {
|
||||
public CloseCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)UiLexicon.bajaui, "commands.close");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmReportDialog.this.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class NotesCommand
|
||||
extends Command {
|
||||
public NotesCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.notes");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmRecord[] bAlarmRecordArray = BAlarmReportDialog.this.console.getSelectedAlarms(BAlarmReportDialog.this.table);
|
||||
if (bAlarmRecordArray.length == 0) {
|
||||
return null;
|
||||
}
|
||||
BAlarmReportDialog.this.console.showNotes((BWidget)BAlarmReportDialog.this.table, bAlarmRecordArray);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class HyperlinkCommand
|
||||
extends Command {
|
||||
public HyperlinkCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.hyperlink");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmRecord[] bAlarmRecordArray = BAlarmReportDialog.this.console.getSelectedAlarms(BAlarmReportDialog.this.table);
|
||||
if (bAlarmRecordArray.length == 0) {
|
||||
return null;
|
||||
}
|
||||
BAlarmReportDialog.this.console.hyperlink(bAlarmRecordArray[0]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class AckCommand
|
||||
extends Command {
|
||||
public AckCommand(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)BAlarmConsole.lexicon, "commands.acknowledge");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmRecord[] bAlarmRecordArray = BAlarmReportDialog.this.console.getSelectedAlarms(BAlarmReportDialog.this.table);
|
||||
if (bAlarmRecordArray.length == 0) {
|
||||
return null;
|
||||
}
|
||||
BAlarmReportDialog.this.console.acknowledgeAlarms(bAlarmRecordArray);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.gx.BSize
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.util.BAuxWidget$Support
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.gx.BSize;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BBorder;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.util.BAuxWidget;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
|
||||
public class BAlarmTitlePane
|
||||
extends BEdgePane {
|
||||
public static final Action tableModified = BAlarmTitlePane.newAction((int)0, null, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmTitlePane == null ? (class$com$tridium$alarm$ui$BAlarmTitlePane = BAlarmTitlePane.class$("com.tridium.alarm.ui.BAlarmTitlePane")) : class$com$tridium$alarm$ui$BAlarmTitlePane));
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = BAlarmTitlePane.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
static String sourceText = lexicon.getText("alarm.sources");
|
||||
static String alarmText = lexicon.getText("alarm.alarms");
|
||||
static BInsets withIcon = BInsets.make((double)1.0, (double)4.0, (double)1.0, (double)2.0);
|
||||
static BInsets withoutIcon = BInsets.make((double)2.0, (double)4.0, (double)2.0, (double)4.0);
|
||||
BWidget content;
|
||||
BLabel label;
|
||||
BLabel info;
|
||||
BEdgePane top;
|
||||
BTable table;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmTitlePane;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
|
||||
public void tableModified() {
|
||||
this.invoke(tableModified, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BAlarmTitlePane makePane(String string, BTable bTable) {
|
||||
BAlarmTitlePane bAlarmTitlePane = new BAlarmTitlePane(string, (BWidget)bTable);
|
||||
bAlarmTitlePane.setTable(bTable);
|
||||
return bAlarmTitlePane;
|
||||
}
|
||||
|
||||
public BAlarmTitlePane(String string, BWidget bWidget) {
|
||||
this.content = bWidget;
|
||||
this.label = new BLabel(string);
|
||||
this.label.setFont(Theme.widget().getBoldText());
|
||||
this.label.setForeground(BColor.white.toBrush());
|
||||
this.top = new BEdgePane();
|
||||
this.top.setLeft((BWidget)this.label);
|
||||
BBorderPane bBorderPane = new BBorderPane((BWidget)this.top, BBorder.make((String)"top(1) left(1) right(1)"), withoutIcon);
|
||||
bBorderPane.setFill(Theme.widget().getControlShadow());
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setTop((BWidget)bBorderPane);
|
||||
bEdgePane.setCenter(bWidget);
|
||||
this.setCenter((BWidget)new BBorderPane((BWidget)bEdgePane, BBorder.inset, BInsets.DEFAULT));
|
||||
}
|
||||
|
||||
public BAlarmTitlePane() {
|
||||
}
|
||||
|
||||
public void setTitleVisible(boolean bl) {
|
||||
this.top.getParentWidget().setVisible(bl);
|
||||
}
|
||||
|
||||
public void setTitle(String string) {
|
||||
this.label.setText(string);
|
||||
}
|
||||
|
||||
public void setTable(BTable bTable) {
|
||||
this.table = bTable;
|
||||
if (this.info == null) {
|
||||
this.info = new BLabel("");
|
||||
this.info.setFont(Theme.widget().getBoldText());
|
||||
this.info.setForeground(BColor.white.toBrush());
|
||||
this.top.setRight((BWidget)this.info);
|
||||
}
|
||||
if (this.get("tableLink") != null) {
|
||||
this.remove("tableLink");
|
||||
}
|
||||
this.linkTo("tableLink", (BComponent)bTable, (Slot)BTable.tableModified, (Slot)tableModified);
|
||||
this.doTableModified();
|
||||
}
|
||||
|
||||
public void doTableModified() {
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
try {
|
||||
DynamicTableModel dynamicTableModel = (DynamicTableModel)this.table.getModel();
|
||||
ConsoleTableModel consoleTableModel = (ConsoleTableModel)dynamicTableModel.getRootModel();
|
||||
n = consoleTableModel.getSourceCount();
|
||||
n2 = consoleTableModel.getAlarmCount();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
this.info.setText(n + " " + sourceText + " / " + n2 + " " + alarmText);
|
||||
this.relayout();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class AuxSupport
|
||||
extends BAuxWidget.Support {
|
||||
final BSize size = BSize.make((double)10.0, (double)16.0);
|
||||
|
||||
AuxSupport() {
|
||||
}
|
||||
|
||||
public BSize getPreferredSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics, double d, double d2) {
|
||||
graphics.setBrush(BColor.white);
|
||||
double d3 = 2.0;
|
||||
double d4 = 5.0;
|
||||
if (BAlarmTitlePane.this.content.isVisible()) {
|
||||
graphics.strokeLine(d3, d4 + 2.0, d3 + 2.0, d4);
|
||||
graphics.strokeLine(d3 + 2.0, d4, d3 + 4.0, d4 + 2.0);
|
||||
graphics.strokeLine(d3 + 1.0, d4 + 2.0, d3 + 2.0, d4 + 1.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 1.0, d3 + 3.0, d4 + 2.0);
|
||||
graphics.strokeLine(d3, d4 + 6.0, d3 + 2.0, d4 + 4.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 4.0, d3 + 4.0, d4 + 6.0);
|
||||
graphics.strokeLine(d3 + 1.0, d4 + 6.0, d3 + 2.0, d4 + 5.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 5.0, d3 + 3.0, d4 + 6.0);
|
||||
} else {
|
||||
graphics.strokeLine(d3, d4, d3 + 2.0, d4 + 2.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 2.0, d3 + 4.0, d4);
|
||||
graphics.strokeLine(d3 + 1.0, d4, d3 + 2.0, d4 + 1.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 1.0, d3 + 3.0, d4);
|
||||
graphics.strokeLine(d3, d4 + 4.0, d3 + 2.0, d4 + 6.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 6.0, d3 + 4.0, d4 + 4.0);
|
||||
graphics.strokeLine(d3 + 1.0, d4 + 4.0, d3 + 2.0, d4 + 5.0);
|
||||
graphics.strokeLine(d3 + 2.0, d4 + 5.0, d3 + 3.0, d4 + 4.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(BMouseEvent bMouseEvent) {
|
||||
BAlarmTitlePane.this.content.setVisible(!BAlarmTitlePane.this.content.getVisible());
|
||||
BAlarmTitlePane.this.relayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BCheckBox
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.alarm.BAlarmTransitionBits;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BCheckBox;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BAlarmTransitionBitsFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmTransitionBitsFE == null ? (class$com$tridium$alarm$ui$BAlarmTransitionBitsFE = BAlarmTransitionBitsFE.class$("com.tridium.alarm.ui.BAlarmTransitionBitsFE")) : class$com$tridium$alarm$ui$BAlarmTransitionBitsFE));
|
||||
static final String offnormalText = BAlarmTransitionBits.ALL.getTag(1);
|
||||
static final String faultText = BAlarmTransitionBits.ALL.getTag(2);
|
||||
static final String normalText = BAlarmTransitionBits.ALL.getTag(4);
|
||||
static final String alertText = BAlarmTransitionBits.ALL.getTag(8);
|
||||
public static final String SHOW_OFF_NORMAL = "showOffNormal";
|
||||
public static final String SHOW_NORMAL = "showNormal";
|
||||
public static final String SHOW_FAULT = "showFault";
|
||||
public static final String SHOW_ALERT = "showAlert";
|
||||
public static final String OFF_NORMAL_LABEL = "offNormalLabel";
|
||||
public static final String NORMAL_LABEL = "normalLabel";
|
||||
public static final String FAULT_LABEL = "faultLabel";
|
||||
public static final String ALERT_LABEL = "alertLabel";
|
||||
private boolean init = false;
|
||||
private BCheckBox offnormal;
|
||||
private BCheckBox fault;
|
||||
private BCheckBox normal;
|
||||
private BCheckBox alert;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmTransitionBitsFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.init = false;
|
||||
if (bl) {
|
||||
this.setContent((BWidget)new BTextField("", 45, false));
|
||||
}
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BAlarmTransitionBits bAlarmTransitionBits = (BAlarmTransitionBits)bObject;
|
||||
if (this.isReadonly()) {
|
||||
((BTextField)this.getContent()).setText(bObject.toString(context));
|
||||
} else {
|
||||
if (!this.init) {
|
||||
this.initCheckBoxes(context);
|
||||
}
|
||||
this.offnormal.setSelected(bAlarmTransitionBits.isToOffnormal());
|
||||
this.fault.setSelected(bAlarmTransitionBits.isToFault());
|
||||
this.normal.setSelected(bAlarmTransitionBits.isToNormal());
|
||||
this.alert.setSelected(bAlarmTransitionBits.isToAlert());
|
||||
}
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) {
|
||||
int n = 0;
|
||||
if (this.offnormal.isSelected()) {
|
||||
n |= 1;
|
||||
}
|
||||
if (this.fault.isSelected()) {
|
||||
n |= 2;
|
||||
}
|
||||
if (this.normal.isSelected()) {
|
||||
n |= 4;
|
||||
}
|
||||
if (this.alert.isSelected()) {
|
||||
n |= 8;
|
||||
}
|
||||
return BAlarmTransitionBits.make(n);
|
||||
}
|
||||
|
||||
private void initCheckBoxes(Context context) {
|
||||
this.init = true;
|
||||
int n = 4;
|
||||
if (this.getBooleanFacetValue(context, "multiLine", false)) {
|
||||
n = 1;
|
||||
}
|
||||
BGridPane bGridPane = new BGridPane(n);
|
||||
this.offnormal = new BCheckBox(this.getStringFacetValue(context, OFF_NORMAL_LABEL, offnormalText));
|
||||
this.fault = new BCheckBox(this.getStringFacetValue(context, FAULT_LABEL, faultText));
|
||||
this.normal = new BCheckBox(this.getStringFacetValue(context, NORMAL_LABEL, normalText));
|
||||
this.alert = new BCheckBox(this.getStringFacetValue(context, ALERT_LABEL, alertText));
|
||||
if (this.getBooleanFacetValue(context, SHOW_OFF_NORMAL, true)) {
|
||||
bGridPane.add("offNormal", (BValue)this.offnormal, null);
|
||||
}
|
||||
if (this.getBooleanFacetValue(context, SHOW_FAULT, true)) {
|
||||
bGridPane.add("fault", (BValue)this.fault, null);
|
||||
}
|
||||
if (this.getBooleanFacetValue(context, SHOW_NORMAL, true)) {
|
||||
bGridPane.add("normal", (BValue)this.normal, null);
|
||||
}
|
||||
if (this.getBooleanFacetValue(context, SHOW_ALERT, true)) {
|
||||
bGridPane.add("alert", (BValue)this.alert, null);
|
||||
}
|
||||
this.setContent((BWidget)bGridPane);
|
||||
this.linkTo("l0", (BComponent)this.offnormal, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
this.linkTo("l1", (BComponent)this.fault, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
this.linkTo("l2", (BComponent)this.normal, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
this.linkTo("l3", (BComponent)this.alert, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
}
|
||||
|
||||
private boolean getBooleanFacetValue(Context context, String string, boolean bl) {
|
||||
if (context == null) {
|
||||
return bl;
|
||||
}
|
||||
BBoolean bBoolean = (BBoolean)context.getFacet(string);
|
||||
return bBoolean == null ? bl : bBoolean.getBoolean();
|
||||
}
|
||||
|
||||
private String getStringFacetValue(Context context, String string, String string2) {
|
||||
if (context == null) {
|
||||
return string2;
|
||||
}
|
||||
BString bString = (BString)context.getFacet(string);
|
||||
return bString == null ? string2 : bString.toString();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BFrozenEnumFE
|
||||
* com.tridium.workbench.fieldeditors.BStringFE
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BTextOp;
|
||||
import com.tridium.alarm.ui.BAlarmClassFE;
|
||||
import com.tridium.workbench.fieldeditors.BFrozenEnumFE;
|
||||
import com.tridium.workbench.fieldeditors.BStringFE;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BDeviceExtAlarmClassFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Action textOpChanged = BDeviceExtAlarmClassFE.newAction((int)4, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE == null ? (class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE = BDeviceExtAlarmClassFE.class$("com.tridium.alarm.ui.BDeviceExtAlarmClassFE")) : class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE));
|
||||
BFrozenEnumFE opFE;
|
||||
BWbFieldEditor formatFE;
|
||||
Context cx;
|
||||
BGridPane pane = new BGridPane(2);
|
||||
protected BAlarmClassFE alarmClassFE;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE == null ? (class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE = BDeviceExtAlarmClassFE.class$("com.tridium.alarm.ui.BDeviceExtAlarmClassFE")) : class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BDeviceExtAlarmClassFE;
|
||||
|
||||
public void textOpChanged() {
|
||||
this.invoke(textOpChanged, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDeviceExtAlarmClassFE() {
|
||||
this.opFE = new BFrozenEnumFE();
|
||||
this.formatFE = new BStringFE();
|
||||
this.pane.add(null, (BValue)this.opFE);
|
||||
this.pane.add("formatFE", (BValue)this.formatFE);
|
||||
this.setContent((BWidget)this.pane);
|
||||
this.linkTo("l1", (BComponent)this.formatFE, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
|
||||
this.linkTo("l2", (BComponent)this.opFE, (Slot)BFrozenEnumFE.pluginModified, (Slot)textOpChanged);
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.opFE.setReadonly(bl);
|
||||
this.formatFE.setReadonly(bl);
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
String string;
|
||||
BTextOp bTextOp;
|
||||
this.cx = context;
|
||||
this.formatFE = new BStringFE();
|
||||
String string2 = bObject.toString();
|
||||
if (string2.equals("%alarmClass%")) {
|
||||
bTextOp = BTextOp.useExisting;
|
||||
string = "";
|
||||
} else if (string2.startsWith("%alarmClass%")) {
|
||||
bTextOp = BTextOp.append;
|
||||
string = string2.substring(12);
|
||||
} else if (string2.endsWith("%alarmClass%")) {
|
||||
bTextOp = BTextOp.prepend;
|
||||
string = string2.substring(0, string2.indexOf("%alarmClass%"));
|
||||
} else {
|
||||
bTextOp = BTextOp.replace;
|
||||
string = string2;
|
||||
this.formatFE = new BAlarmClassFE();
|
||||
}
|
||||
if (bTextOp == BTextOp.useExisting) {
|
||||
this.pane.set("formatFE", (BValue)new BLabel(""));
|
||||
} else {
|
||||
this.pane.set("formatFE", (BValue)this.formatFE);
|
||||
this.remove("l1", context);
|
||||
this.linkTo("l1", (BComponent)this.formatFE, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
|
||||
}
|
||||
this.doSetReadonly(this.isReadonly());
|
||||
this.opFE.loadValue((BObject)bTextOp, context);
|
||||
this.formatFE.loadValue((BObject)BString.make((String)string), context);
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
|
||||
BTextOp bTextOp = (BTextOp)this.opFE.saveValue(context);
|
||||
String string = this.formatFE.saveValue(bObject, context).toString();
|
||||
string = string.replace("%alarmClass%", "");
|
||||
if (bTextOp == BTextOp.useExisting) {
|
||||
return BString.make((String)"%alarmClass%");
|
||||
}
|
||||
if (bTextOp == BTextOp.replace) {
|
||||
return BString.make((String)string);
|
||||
}
|
||||
if (bTextOp == BTextOp.prepend) {
|
||||
return BString.make((String)(string + "%alarmClass%"));
|
||||
}
|
||||
if (bTextOp == BTextOp.append) {
|
||||
return BString.make((String)("%alarmClass%" + string));
|
||||
}
|
||||
return BString.make((String)"");
|
||||
}
|
||||
|
||||
public void doTextOpChanged() throws Exception {
|
||||
BTextOp bTextOp = (BTextOp)this.opFE.saveValue(this.cx);
|
||||
String string = "";
|
||||
if (this.formatFE != null && this.formatFE.saveValue(this.cx) != null) {
|
||||
string = this.formatFE.saveValue(this.cx).toString();
|
||||
}
|
||||
this.formatFE = bTextOp == BTextOp.replace ? new BAlarmClassFE() : new BStringFE();
|
||||
string = string.replace("%alarmClass%", "");
|
||||
if (bTextOp == BTextOp.useExisting) {
|
||||
this.pane.set("formatFE", (BValue)new BLabel(""));
|
||||
} else {
|
||||
this.pane.set("formatFE", (BValue)this.formatFE);
|
||||
this.remove("l1", this.cx);
|
||||
this.linkTo("l1", (BComponent)this.formatFE, (Slot)BWbFieldEditor.pluginModified, (Slot)setModified);
|
||||
}
|
||||
if (bTextOp == BTextOp.replace) {
|
||||
this.formatFE.loadValue((BObject)BString.make((String)"defaultAlarmClass"), this.cx);
|
||||
} else {
|
||||
this.formatFE.loadValue((BObject)BString.make((String)""), this.cx);
|
||||
}
|
||||
this.setModified();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void doToggleUseExisting() {
|
||||
this.setModified();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BDialogFE
|
||||
* com.tridium.workbench.fieldeditors.BIntegerFE
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.list.BCheckList
|
||||
* javax.baja.ui.list.DefaultListModel
|
||||
* javax.baja.ui.list.ListModel
|
||||
* javax.baja.ui.list.ListSelection
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.workbench.CannotSaveException
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.workbench.fieldeditors.BDialogFE;
|
||||
import com.tridium.workbench.fieldeditors.BIntegerFE;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.list.BCheckList;
|
||||
import javax.baja.ui.list.DefaultListModel;
|
||||
import javax.baja.ui.list.ListModel;
|
||||
import javax.baja.ui.list.ListSelection;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.workbench.CannotSaveException;
|
||||
|
||||
public class BEnumAlarmRangeFE
|
||||
extends BDialogFE {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BEnumAlarmRangeFE == null ? (class$com$tridium$alarm$ui$BEnumAlarmRangeFE = BEnumAlarmRangeFE.class$("com.tridium.alarm.ui.BEnumAlarmRangeFE")) : class$com$tridium$alarm$ui$BEnumAlarmRangeFE));
|
||||
boolean init = false;
|
||||
BEnumRange range;
|
||||
Context ctx;
|
||||
BCheckList checkList;
|
||||
BLabel config;
|
||||
BWidget editor;
|
||||
DefaultListModel listModel;
|
||||
BLabel label;
|
||||
boolean readonly;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BEnumAlarmRangeFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BEnumAlarmRangeFE() {
|
||||
BFlowPane bFlowPane = new BFlowPane();
|
||||
this.label = new BLabel();
|
||||
bFlowPane.add(null, (BValue)this.label);
|
||||
bFlowPane.add(null, (BValue)this.getEditButton());
|
||||
this.setContent((BWidget)bFlowPane);
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.readonly = bl;
|
||||
this.setEditorReadonly(bl);
|
||||
}
|
||||
|
||||
public void doEditPressed() {
|
||||
this.initUi();
|
||||
BEnumRange bEnumRange = this.range;
|
||||
int n = BDialog.open((BWidget)this, (String)"", (Object)this.editor, (int)3);
|
||||
if (n == 1) {
|
||||
this.loadValue((BObject)this.getRange(this.ctx));
|
||||
if (!this.range.equals((Object)bEnumRange)) {
|
||||
this.setModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
this.range = (BEnumRange)bObject;
|
||||
this.label.setText(this.makeDisplayString(this.range, context));
|
||||
if (context != null) {
|
||||
this.ctx = context;
|
||||
}
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) throws CannotSaveException {
|
||||
bObject = this.getRange(context);
|
||||
if (context != null) {
|
||||
this.ctx = context;
|
||||
}
|
||||
return bObject;
|
||||
}
|
||||
|
||||
private BEnumRange getRange(Context context) {
|
||||
BEnumRange bEnumRange = (BEnumRange)this.ctx.getFacet("range");
|
||||
if (bEnumRange == null || bEnumRange.isNull()) {
|
||||
int[] nArray = this.checkList.getSelection().getItems();
|
||||
int[] nArray2 = new int[nArray.length];
|
||||
String[] stringArray = new String[nArray.length];
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
int n;
|
||||
Object object = this.checkList.getItem(nArray[i]);
|
||||
nArray2[i] = n = Integer.parseInt(object.toString());
|
||||
stringArray[i] = SlotPath.escape((String)("" + n));
|
||||
}
|
||||
return BEnumRange.make((int[])nArray2, (String[])stringArray);
|
||||
}
|
||||
int[] nArray = this.checkList.getSelection().getItems();
|
||||
int[] nArray3 = new int[nArray.length];
|
||||
String[] stringArray = new String[nArray.length];
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
String string = (String)this.checkList.getItem(nArray[i]);
|
||||
int n = -1;
|
||||
int[] nArray4 = bEnumRange.getOrdinals();
|
||||
for (int j = 0; j < nArray4.length; ++j) {
|
||||
int n2 = nArray4[j];
|
||||
String string2 = bEnumRange.getDisplayTag(n2, context);
|
||||
if (!string2.equals(string)) continue;
|
||||
n = n2;
|
||||
break;
|
||||
}
|
||||
nArray3[i] = n;
|
||||
stringArray[i] = bEnumRange.getTag(n);
|
||||
}
|
||||
return BEnumRange.make((int[])nArray3, (String[])stringArray);
|
||||
}
|
||||
|
||||
private void initUi() {
|
||||
BEnumRange bEnumRange = (BEnumRange)this.ctx.getFacet("range");
|
||||
if (bEnumRange == null || bEnumRange.isNull()) {
|
||||
this.checkList = new BCheckList();
|
||||
this.listModel = new DefaultListModel();
|
||||
ListSelection listSelection = this.checkList.getSelection();
|
||||
int[] nArray = this.range.getOrdinals();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
this.listModel.addItem((Object)("" + nArray[i]));
|
||||
listSelection.select(i);
|
||||
}
|
||||
Command command = new Command((BWidget)this.getWbShell(), Sys.getModuleForClass((Class)(class$com$tridium$alarm$ui$BEnumAlarmRangeFE == null ? (class$com$tridium$alarm$ui$BEnumAlarmRangeFE = BEnumAlarmRangeFE.class$("com.tridium.alarm.ui.BEnumAlarmRangeFE")) : class$com$tridium$alarm$ui$BEnumAlarmRangeFE)), "alarm.enumRangeFE.add"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BInteger bInteger;
|
||||
BIntegerFE bIntegerFE = new BIntegerFE();
|
||||
bIntegerFE.loadValue((BObject)BInteger.make((int)BEnumAlarmRangeFE.this.listModel.getItemCount()));
|
||||
int n = BDialog.open((BWidget)BEnumAlarmRangeFE.this, (String)"", (Object)bIntegerFE, (int)3);
|
||||
if (n == 1 && BEnumAlarmRangeFE.this.listModel.indexOfItem((Object)(bInteger = (BInteger)bIntegerFE.saveValue())) == -1 && BEnumAlarmRangeFE.this.listModel.indexOfItem((Object)bInteger.toString()) == -1) {
|
||||
BEnumAlarmRangeFE.this.listModel.addItem((Object)bInteger);
|
||||
ListSelection listSelection = BEnumAlarmRangeFE.this.checkList.getSelection();
|
||||
listSelection.select(BEnumAlarmRangeFE.this.listModel.getItemCount() - 1);
|
||||
BEnumAlarmRangeFE.this.checkList.setSelection(listSelection);
|
||||
BEnumAlarmRangeFE.this.checkList.setModel((ListModel)BEnumAlarmRangeFE.this.listModel);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BButton bButton = new BButton(command, true, true);
|
||||
this.checkList.setSelection(listSelection);
|
||||
this.checkList.setModel((ListModel)this.listModel);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)this.checkList);
|
||||
bEdgePane.setBottom((BWidget)bButton);
|
||||
this.editor = bEdgePane;
|
||||
} else {
|
||||
this.checkList = new BCheckList();
|
||||
this.listModel = new DefaultListModel();
|
||||
ListSelection listSelection = this.checkList.getSelection();
|
||||
int[] nArray = bEnumRange.getOrdinals();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
this.listModel.addItem((Object)bEnumRange.getDisplayTag(nArray[i], this.ctx));
|
||||
if (!this.range.isOrdinal(nArray[i])) continue;
|
||||
listSelection.select(i);
|
||||
}
|
||||
this.checkList.setSelection(listSelection);
|
||||
this.checkList.setModel((ListModel)this.listModel);
|
||||
this.editor = this.checkList;
|
||||
}
|
||||
this.setEditorReadonly(this.readonly);
|
||||
}
|
||||
|
||||
private String makeDisplayString(BEnumRange bEnumRange, Context context) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int[] nArray = bEnumRange.getOrdinals();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
if (i > 0) {
|
||||
stringBuffer.append(", ");
|
||||
}
|
||||
stringBuffer.append(bEnumRange.getDisplayTag(nArray[i], this.ctx));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
private void setEditorReadonly(boolean bl) {
|
||||
if (this.editor != null) {
|
||||
this.editor.setEnabled(!bl);
|
||||
BWidget[] bWidgetArray = this.editor.getChildWidgets();
|
||||
for (int i = 0; i < bWidgetArray.length; ++i) {
|
||||
bWidgetArray[i].setEnabled(!bl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BInterface
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.sys.BInterface;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIAlarmServiceView
|
||||
extends BInterface {
|
||||
public static final Type TYPE = Sys.loadType((Class)(1.class$com$tridium$alarm$ui$BIAlarmServiceView == null ? (1.class$com$tridium$alarm$ui$BIAlarmServiceView = 1.class$("com.tridium.alarm.ui.BIAlarmServiceView")) : 1.class$com$tridium$alarm$ui$BIAlarmServiceView));
|
||||
|
||||
public BAlarmService getAlarmService(BAlarmRecord var1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BDialogFE
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.list.BList
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BConstrainedPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DefaultTableModel
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.workbench.fieldeditors.BDialogFE;
|
||||
import javax.baja.alarm.BAlarmInstructions;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.list.BList;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BConstrainedPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DefaultTableModel;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public class BInstructionsFE
|
||||
extends BDialogFE {
|
||||
public static final Action setEnabledStates = BInstructionsFE.newAction((int)0, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BInstructionsFE == null ? (class$com$tridium$alarm$ui$BInstructionsFE = BInstructionsFE.class$("com.tridium.alarm.ui.BInstructionsFE")) : class$com$tridium$alarm$ui$BInstructionsFE));
|
||||
BLabel label = new BLabel();
|
||||
BList list;
|
||||
BTable table;
|
||||
BAlarmInstructions instructions;
|
||||
Context ctx;
|
||||
BEdgePane mainPane = null;
|
||||
MoveDownCommand moveDownCommand = null;
|
||||
MoveUpCommand moveUpCommand = null;
|
||||
RemoveCommand removeCommand = null;
|
||||
EditCommand editCommand = null;
|
||||
AddCommand addCommand = null;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BInstructionsFE == null ? (class$com$tridium$alarm$ui$BInstructionsFE = BInstructionsFE.class$("com.tridium.alarm.ui.BInstructionsFE")) : class$com$tridium$alarm$ui$BInstructionsFE);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BInstructionsFE;
|
||||
|
||||
public void setEnabledStates() {
|
||||
this.invoke(setEnabledStates, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BInstructionsFE() {
|
||||
BFlowPane bFlowPane = new BFlowPane();
|
||||
bFlowPane.add(null, (BValue)this.label);
|
||||
bFlowPane.add(null, (BValue)this.getEditButton());
|
||||
this.setContent((BWidget)bFlowPane);
|
||||
this.addCommand = new AddCommand();
|
||||
this.editCommand = new EditCommand();
|
||||
this.removeCommand = new RemoveCommand();
|
||||
this.moveUpCommand = new MoveUpCommand();
|
||||
this.moveDownCommand = new MoveDownCommand();
|
||||
this.table = new BTable((TableModel)new NumberedTableModel());
|
||||
this.table.setHeaderVisible(false);
|
||||
this.table.setVgridVisible(false);
|
||||
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)this.table);
|
||||
bConstrainedPane.setMinSize(400.0, 200.0);
|
||||
this.mainPane = new BEdgePane();
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.addCommand));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.editCommand));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.removeCommand));
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.moveUpCommand));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.moveDownCommand));
|
||||
this.linkTo(null, (BComponent)this.table, (Slot)BTable.tableModified, (Slot)setEnabledStates);
|
||||
this.linkTo(null, (BComponent)this.table, (Slot)BTable.actionPerformed, (Slot)setEnabledStates);
|
||||
this.linkTo(null, (BComponent)this.table, (Slot)BTable.selectionModified, (Slot)setEnabledStates);
|
||||
this.doSetEnabledStates();
|
||||
this.mainPane.setCenter((BWidget)new BBorderPane((BWidget)bConstrainedPane));
|
||||
this.mainPane.setRight((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) {
|
||||
this.instructions = (BAlarmInstructions)bObject;
|
||||
this.ctx = context;
|
||||
this.label.setText(this.instructions.size() + " " + lexicon.getText("alarm.instructions"));
|
||||
}
|
||||
|
||||
public BObject doSaveValue(BObject bObject, Context context) {
|
||||
return this.instructions;
|
||||
}
|
||||
|
||||
public void doSetReadonly(boolean bl) {
|
||||
if (bl) {
|
||||
this.moveDownCommand.setEnabled(!bl);
|
||||
this.moveUpCommand.setEnabled(!bl);
|
||||
this.removeCommand.setEnabled(!bl);
|
||||
this.editCommand.setEnabled(!bl);
|
||||
this.addCommand.setEnabled(!bl);
|
||||
} else {
|
||||
this.addCommand.setEnabled(true);
|
||||
}
|
||||
this.table.setEnabled(!bl);
|
||||
this.mainPane.setEnabled(!bl);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean bl) {
|
||||
this.setReadonly(!bl);
|
||||
}
|
||||
|
||||
public void doEditPressed() {
|
||||
int n;
|
||||
((NumberedTableModel)this.table.getModel()).removeAllRows();
|
||||
for (n = 0; n < this.instructions.size(); ++n) {
|
||||
((NumberedTableModel)this.table.getModel()).addRow(this.instructions.get(n));
|
||||
}
|
||||
n = BDialog.open((BWidget)this, (String)"Edit", (Object)this.mainPane, (int)3);
|
||||
if (n == 2) {
|
||||
return;
|
||||
}
|
||||
BAlarmInstructions bAlarmInstructions = this.instructions;
|
||||
BFormat[] bFormatArray = new BFormat[this.table.getModel().getRowCount()];
|
||||
for (int i = 0; i < this.table.getModel().getRowCount(); ++i) {
|
||||
bFormatArray[i] = ((NumberedTableModel)this.table.getModel()).getFormat(i);
|
||||
}
|
||||
this.instructions = BAlarmInstructions.make(bFormatArray);
|
||||
if (!this.instructions.equivalent((Object)bAlarmInstructions)) {
|
||||
this.label.setText(this.instructions.size() + " " + lexicon.getText("alarm.instructions"));
|
||||
this.setModified();
|
||||
}
|
||||
}
|
||||
|
||||
public void doSetEnabledStates() {
|
||||
boolean bl = this.isReadonly();
|
||||
if (bl) {
|
||||
this.moveDownCommand.setEnabled(false);
|
||||
this.moveUpCommand.setEnabled(false);
|
||||
this.removeCommand.setEnabled(false);
|
||||
this.editCommand.setEnabled(false);
|
||||
this.addCommand.setEnabled(false);
|
||||
} else {
|
||||
this.addCommand.setEnabled(true);
|
||||
boolean bl2 = !this.table.getSelection().isEmpty();
|
||||
this.removeCommand.setEnabled(bl2);
|
||||
boolean bl3 = this.table.getSelection().getRows().length == 1;
|
||||
this.moveDownCommand.setEnabled(bl3);
|
||||
this.moveUpCommand.setEnabled(bl3);
|
||||
this.editCommand.setEnabled(bl3);
|
||||
}
|
||||
}
|
||||
|
||||
public final BComponent loadService(Type type) {
|
||||
BWbShell bWbShell = this.getWbShell();
|
||||
BOrd bOrd = BOrd.make((BOrd)bWbShell.getActiveOrd(), (String)("service:" + type.toString()));
|
||||
return (BComponent)bOrd.get();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class NumberedTableModel
|
||||
extends DefaultTableModel {
|
||||
public NumberedTableModel() {
|
||||
super(new String[]{"", ""});
|
||||
}
|
||||
|
||||
public void addRow(BFormat bFormat) {
|
||||
super.addRow(new Object[]{null, bFormat});
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public BFormat getFormat(int n) {
|
||||
return BFormat.make((String)super.getValueAt(n, 1).toString());
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
if (n2 == 0) {
|
||||
return new String(n + 1 + ".");
|
||||
}
|
||||
return this.getFormat(n);
|
||||
}
|
||||
}
|
||||
|
||||
private class MoveDownCommand
|
||||
extends Command {
|
||||
public MoveDownCommand() {
|
||||
super((BWidget)BInstructionsFE.this, TYPE.getModule(), "commands.moveDown");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BInstructionsFE.this.table.getSelection().getRow();
|
||||
if (n < BInstructionsFE.this.table.getModel().getRowCount() - 1) {
|
||||
Object object = BInstructionsFE.this.table.getModel().getValueAt(n, 1);
|
||||
Object object2 = BInstructionsFE.this.table.getModel().getValueAt(n + 1, 1);
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).set(n, 1, object2);
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).set(n + 1, 1, object);
|
||||
BInstructionsFE.this.table.getSelection().deselectAll();
|
||||
BInstructionsFE.this.table.getSelection().select(n + 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class MoveUpCommand
|
||||
extends Command {
|
||||
public MoveUpCommand() {
|
||||
super((BWidget)BInstructionsFE.this, TYPE.getModule(), "commands.moveUp");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BInstructionsFE.this.table.getSelection().getRow();
|
||||
if (n > 0) {
|
||||
Object object = BInstructionsFE.this.table.getModel().getValueAt(n, 1);
|
||||
Object object2 = BInstructionsFE.this.table.getModel().getValueAt(n - 1, 1);
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).set(n, 1, object2);
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).set(n - 1, 1, object);
|
||||
BInstructionsFE.this.table.getSelection().deselectAll();
|
||||
BInstructionsFE.this.table.getSelection().select(n - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveCommand
|
||||
extends Command {
|
||||
public RemoveCommand() {
|
||||
super((BWidget)BInstructionsFE.this, TYPE.getModule(), "commands.removeMsg");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int[] nArray = BInstructionsFE.this.table.getSelection().getRows();
|
||||
for (int i = nArray.length - 1; i >= 0; --i) {
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).removeRow(nArray[i]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class EditCommand
|
||||
extends Command {
|
||||
public EditCommand() {
|
||||
super((BWidget)BInstructionsFE.this, TYPE.getModule(), "commands.editMsg");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BInstructionsFE.this.table.getSelection().getRow();
|
||||
String string = BDialog.prompt((BWidget)BInstructionsFE.this, (String)"Edit", (String)BInstructionsFE.this.table.getModel().getValueAt(n, 1).toString(), (int)40);
|
||||
if (string != null) {
|
||||
if ((string = string.trim()).equals("")) {
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).removeRow(n);
|
||||
} else {
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).set(n, 1, string);
|
||||
BInstructionsFE.this.table.sizeColumnsToFit();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class AddCommand
|
||||
extends Command {
|
||||
public AddCommand() {
|
||||
super((BWidget)BInstructionsFE.this, TYPE.getModule(), "commands.addMsg");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n;
|
||||
BTextDropDown bTextDropDown = new BTextDropDown();
|
||||
BAlarmService bAlarmService = (BAlarmService)BInstructionsFE.this.loadService(BAlarmService.TYPE);
|
||||
bAlarmService.lease();
|
||||
BAlarmInstructions bAlarmInstructions = bAlarmService.getMasterAlarmInstructions();
|
||||
if (!BInstructionsFE.this.instructions.equals((Object)bAlarmInstructions)) {
|
||||
for (n = 0; n < bAlarmInstructions.size(); ++n) {
|
||||
bTextDropDown.getList().addItem((Object)bAlarmInstructions.get(n));
|
||||
}
|
||||
}
|
||||
if ((n = BDialog.open((BWidget)BInstructionsFE.this, (String)"Add", (Object)new BBorderPane((BWidget)bTextDropDown), (int)3)) == 1) {
|
||||
String string = bTextDropDown.getText().trim();
|
||||
if (string == null || string.equals("")) {
|
||||
return null;
|
||||
}
|
||||
((NumberedTableModel)BInstructionsFE.this.table.getModel()).addRow(BFormat.make((String)string));
|
||||
BInstructionsFE.this.table.sizeColumnsToFit();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BCheckBox
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.BWbPlugin
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.alarm.ext.BLimitEnable;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BCheckBox;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.BWbPlugin;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BLimitEnableFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BLimitEnableFE == null ? (class$com$tridium$alarm$ui$BLimitEnableFE = BLimitEnableFE.class$("com.tridium.alarm.ui.BLimitEnableFE")) : class$com$tridium$alarm$ui$BLimitEnableFE));
|
||||
private static Log log = Log.getLog((String)"control");
|
||||
private static Lexicon lex = Lexicon.make((String)"alarm");
|
||||
private boolean init = false;
|
||||
private BCheckBox low;
|
||||
private BCheckBox high;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BLimitEnableFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.init = false;
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BLimitEnable bLimitEnable = (BLimitEnable)bObject;
|
||||
if (!this.init) {
|
||||
this.initUi(bLimitEnable);
|
||||
}
|
||||
this.low.setSelected(bLimitEnable.getLowLimitEnable());
|
||||
this.high.setSelected(bLimitEnable.getHighLimitEnable());
|
||||
this.low.setEnabled(!this.isReadonly());
|
||||
this.high.setEnabled(!this.isReadonly());
|
||||
this.linkTo((BComponent)this.low, (Slot)BWbPlugin.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.high, (Slot)BWbPlugin.actionPerformed, (Slot)actionPerformed);
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) {
|
||||
BLimitEnable bLimitEnable = (BLimitEnable)bObject;
|
||||
try {
|
||||
boolean bl = this.low.getSelected();
|
||||
bLimitEnable.set(BLimitEnable.lowLimitEnable, (BValue)BBoolean.make((boolean)bl), context);
|
||||
boolean bl2 = this.high.getSelected();
|
||||
bLimitEnable.set(BLimitEnable.highLimitEnable, (BValue)BBoolean.make((boolean)bl2), context);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("BLimitEnable SaveValue Failed: ", (Throwable)exception);
|
||||
}
|
||||
return bLimitEnable;
|
||||
}
|
||||
|
||||
private void initUi(BLimitEnable bLimitEnable) {
|
||||
this.init = true;
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.setColumnGap(6.0);
|
||||
this.low = new BCheckBox(lex.getText("lowLimit.enable"));
|
||||
bGridPane.add("low", (BValue)this.low);
|
||||
this.high = new BCheckBox(lex.getText("highLimit.enable"));
|
||||
bGridPane.add("high", (BValue)this.high);
|
||||
this.setContent((BWidget)bGridPane);
|
||||
this.linkTo("lk0", (BComponent)this.low, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
this.linkTo("lk1", (BComponent)this.high, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BDynamicEnumFE
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BDynamicEnum
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.workbench.BWbEditor
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.print.BLinePrinterRecipient;
|
||||
import com.tridium.workbench.fieldeditors.BDynamicEnumFE;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BDynamicEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.workbench.BWbEditor;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BLinePrinterFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BLinePrinterFE == null ? (class$com$tridium$alarm$ui$BLinePrinterFE = BLinePrinterFE.class$("com.tridium.alarm.ui.BLinePrinterFE")) : class$com$tridium$alarm$ui$BLinePrinterFE));
|
||||
private BDynamicEnumFE printerFE = new BDynamicEnumFE();
|
||||
private BDynamicEnum printersEnum;
|
||||
private boolean loaded = false;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BLinePrinterFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BLinePrinterFE() {
|
||||
this.setContent((BWidget)this.printerFE);
|
||||
this.linkTo("l1", (BComponent)this.printerFE, (Slot)BDynamicEnumFE.pluginModified, (Slot)setModified);
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BComplex bComplex;
|
||||
this.printersEnum = (BDynamicEnum)bObject;
|
||||
BLinePrinterRecipient bLinePrinterRecipient = null;
|
||||
for (bComplex = this.getParent(); bComplex != null && !(bComplex instanceof BWbEditor); bComplex = bComplex.getParent()) {
|
||||
}
|
||||
if (bComplex != null) {
|
||||
bLinePrinterRecipient = (BLinePrinterRecipient)((BWbEditor)bComplex).getCurrentValue();
|
||||
}
|
||||
if (!this.loaded) {
|
||||
bLinePrinterRecipient.loadPrinters();
|
||||
this.loaded = true;
|
||||
}
|
||||
this.printerFE.loadValue(bObject, context);
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
|
||||
try {
|
||||
return this.printerFE.saveValue(bObject, context);
|
||||
}
|
||||
catch (NumberFormatException numberFormatException) {
|
||||
String string = ((BTextDropDown)this.printerFE.getContent()).getText();
|
||||
int[] nArray = this.printersEnum.getRange().getOrdinals();
|
||||
String[] stringArray = new String[nArray.length + 1];
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
stringArray[i] = this.printersEnum.getRange().getTag(nArray[i]);
|
||||
}
|
||||
stringArray[nArray.length] = SlotPath.escape((String)string);
|
||||
BEnumRange bEnumRange = BEnumRange.make((String[])stringArray);
|
||||
return BDynamicEnum.make((int)nArray.length, (BEnumRange)bEnumRange);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BWindowEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.pane.BTextEditorPane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BWindowEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.pane.BTextEditorPane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BNotesDialog
|
||||
extends BDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BNotesDialog == null ? (class$com$tridium$alarm$ui$BNotesDialog = BNotesDialog.class$("com.tridium.alarm.ui.BNotesDialog")) : class$com$tridium$alarm$ui$BNotesDialog));
|
||||
BWidget widget;
|
||||
String username;
|
||||
BTextEditorPane historyPane;
|
||||
BTextEditorPane addPane;
|
||||
Command addCmd;
|
||||
Command closeCmd;
|
||||
boolean newNotes = false;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BNotesDialog == null ? (class$com$tridium$alarm$ui$BNotesDialog = BNotesDialog.class$("com.tridium.alarm.ui.BNotesDialog")) : class$com$tridium$alarm$ui$BNotesDialog);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BNotesDialog;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BNotesDialog() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public BNotesDialog(BWidget bWidget, String string, String string2, boolean bl) {
|
||||
super(bWidget, lexicon.getText("alarm.notes"), true);
|
||||
this.widget = bWidget;
|
||||
this.username = string2;
|
||||
this.historyPane = new BTextEditorPane(string, 12, 80, false);
|
||||
this.addPane = new BTextEditorPane("", 6, 80, true);
|
||||
this.addCmd = new AddCmd((BWidget)this);
|
||||
if (!bl) {
|
||||
this.addCmd.setEnabled(false);
|
||||
}
|
||||
this.closeCmd = new CloseCmd((BWidget)this);
|
||||
BButton bButton = new BButton(this.addCmd, true, true);
|
||||
BButton bButton2 = new BButton(this.closeCmd, true, true);
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.setUniformColumnWidth(true);
|
||||
bGridPane.add("add", (BValue)bButton);
|
||||
bGridPane.add("close", (BValue)bButton2);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setTop((BWidget)new BBorderPane((BWidget)this.historyPane));
|
||||
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)this.addPane));
|
||||
bEdgePane.setBottom((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
}
|
||||
|
||||
public void open() {
|
||||
this.newNotes = false;
|
||||
this.addPane.getEditor().requestFocus();
|
||||
super.open();
|
||||
}
|
||||
|
||||
public void windowClosing(BWindowEvent bWindowEvent) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
public String getNewNotes() {
|
||||
if (!this.newNotes) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("## " + BAbsTime.now() + " - " + this.username + " ##\n");
|
||||
stringBuffer.append(this.addPane.getText());
|
||||
stringBuffer.append("\n\n");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class CloseCmd
|
||||
extends Command {
|
||||
CloseCmd(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)UiLexicon.bajaui, "commands.close");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BNotesDialog.this.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class AddCmd
|
||||
extends Command {
|
||||
AddCmd(BWidget bWidget) {
|
||||
super(bWidget, (Lexicon)lexicon, "commands.addNote");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BNotesDialog.this.newNotes = true;
|
||||
BNotesDialog.this.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.workbench.BWbEditor
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.print.BPrinterRecipient;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.workbench.BWbEditor;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BPrinterFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BPrinterFE == null ? (class$com$tridium$alarm$ui$BPrinterFE = BPrinterFE.class$("com.tridium.alarm.ui.BPrinterFE")) : class$com$tridium$alarm$ui$BPrinterFE));
|
||||
BTextDropDown field = new BTextDropDown("", 20, true);
|
||||
String[] options;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BPrinterFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BPrinterFE() {
|
||||
this.setContent((BWidget)this.field);
|
||||
this.linkTo("la", (BComponent)this.field, (Slot)BTextDropDown.valueModified, (Slot)setModified);
|
||||
this.linkTo("lb", (BComponent)this.field, (Slot)BTextDropDown.actionPerformed, (Slot)actionPerformed);
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.field.getEditor().setEditable(!bl);
|
||||
this.field.setDropDownEnabled(!bl);
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
this.loadName(bObject.toString());
|
||||
}
|
||||
|
||||
protected String[] list() {
|
||||
BComplex bComplex;
|
||||
BPrinterRecipient bPrinterRecipient = null;
|
||||
for (bComplex = this.getParent(); bComplex != null && !(bComplex instanceof BWbEditor); bComplex = bComplex.getParent()) {
|
||||
}
|
||||
if (bComplex != null) {
|
||||
bPrinterRecipient = (BPrinterRecipient)((BWbEditor)bComplex).getCurrentValue();
|
||||
}
|
||||
if (bPrinterRecipient != null) {
|
||||
BVector bVector = bPrinterRecipient.getPrinters();
|
||||
Slot[] slotArray = bVector.getSlotsArray();
|
||||
String[] stringArray = new String[slotArray.length];
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
stringArray[i] = bVector.get(slotArray[i].asProperty()).toString();
|
||||
}
|
||||
return stringArray;
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
public void loadName(String string) {
|
||||
this.field.setText(string);
|
||||
this.field.getList().removeAllItems();
|
||||
this.options = this.list();
|
||||
String string2 = null;
|
||||
if (this.options != null) {
|
||||
for (int i = 0; i < this.options.length; ++i) {
|
||||
if (this.options[i].equals(string)) {
|
||||
string2 = this.options[i];
|
||||
}
|
||||
this.field.getList().addItem(BImage.make((BIcon)BIcon.std((String)"print.png")), (Object)this.options[i]);
|
||||
}
|
||||
}
|
||||
if (string2 != null) {
|
||||
this.field.setText(string2);
|
||||
}
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) {
|
||||
return BString.make((String)this.saveName());
|
||||
}
|
||||
|
||||
public String saveName() {
|
||||
String string = this.field.getText();
|
||||
for (int i = 0; i < this.options.length; ++i) {
|
||||
if (!this.options[i].equals(string)) continue;
|
||||
string = this.options[i];
|
||||
break;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.fox.sys.NiagaraStation
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.OrdTarget
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.list.BList
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFolder
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.NiagaraStation;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdTarget;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.list.BList;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFolder;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BRemoteStationFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BRemoteStationFE == null ? (class$com$tridium$alarm$ui$BRemoteStationFE = BRemoteStationFE.class$("com.tridium.alarm.ui.BRemoteStationFE")) : class$com$tridium$alarm$ui$BRemoteStationFE));
|
||||
private static UiLexicon lex = new UiLexicon(class$com$tridium$alarm$ui$BAlarmDbView == null ? (class$com$tridium$alarm$ui$BAlarmDbView = BRemoteStationFE.class$("com.tridium.alarm.ui.BAlarmDbView")) : class$com$tridium$alarm$ui$BAlarmDbView);
|
||||
private BTextDropDown remoteStation;
|
||||
private boolean loaded = false;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BRemoteStationFE;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmDbView;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
if (bl) {
|
||||
this.setContent((BWidget)new BTextField("", 45, false));
|
||||
}
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
if (this.loaded) {
|
||||
return;
|
||||
}
|
||||
this.init();
|
||||
BString bString = (BString)bObject;
|
||||
if (bString == null || bString.isNull() || bString.toString().equals("")) {
|
||||
((BTextDropDown)this.getContent()).setText(lex.getText("stationRecipient.selectStation"));
|
||||
} else {
|
||||
((BTextDropDown)this.getContent()).setText(bString.toString());
|
||||
}
|
||||
try {
|
||||
BWbShell bWbShell = this.getWbShell();
|
||||
OrdTarget ordTarget = bWbShell.getActiveOrdTarget();
|
||||
BFoxSession bFoxSession = (BFoxSession)BOrd.toSession((BObject)ordTarget.get());
|
||||
BOrd bOrd = BOrd.make((BOrd)bWbShell.getActiveOrd(), (String)"service:niagaraDriver:NiagaraNetwork");
|
||||
BComponent bComponent = (BComponent)bOrd.get();
|
||||
BList bList = this.remoteStation.getList();
|
||||
this.loadStations(bComponent, bList);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
private void loadStations(BComponent bComponent, BList bList) {
|
||||
bComponent.lease();
|
||||
BComponent[] bComponentArray = bComponent.getChildComponents();
|
||||
for (int i = 0; i < bComponentArray.length; ++i) {
|
||||
BComponent bComponent2 = bComponentArray[i];
|
||||
if (bComponent2 instanceof NiagaraStation) {
|
||||
bList.addItem((Object)bComponent2.getName());
|
||||
continue;
|
||||
}
|
||||
if (!(bComponent2 instanceof BFolder)) continue;
|
||||
this.loadStations(bComponent2, bList);
|
||||
}
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) {
|
||||
if (this.remoteStation.getText().equals(lex.getText("stationRecipient.selectStation"))) {
|
||||
return BString.make((String)"");
|
||||
}
|
||||
return BString.make((String)this.remoteStation.getText());
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.remoteStation = new BTextDropDown();
|
||||
this.setContent((BWidget)this.remoteStation);
|
||||
this.linkTo("l0", (BComponent)this.remoteStation, (Slot)BTextDropDown.valueModified, (Slot)setModified);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BDialogFE
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BVector
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.list.BList
|
||||
* javax.baja.ui.list.DefaultListModel
|
||||
* javax.baja.ui.list.ListModel
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.workbench.fieldeditors.BDialogFE;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.list.BList;
|
||||
import javax.baja.ui.list.DefaultListModel;
|
||||
import javax.baja.ui.list.ListModel;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
|
||||
public class BStringListFE
|
||||
extends BDialogFE {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BStringListFE == null ? (class$com$tridium$alarm$ui$BStringListFE = BStringListFE.class$("com.tridium.alarm.ui.BStringListFE")) : class$com$tridium$alarm$ui$BStringListFE));
|
||||
BList list;
|
||||
DefaultListModel listModel;
|
||||
BVector vector;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BStringListFE == null ? (class$com$tridium$alarm$ui$BStringListFE = BStringListFE.class$("com.tridium.alarm.ui.BStringListFE")) : class$com$tridium$alarm$ui$BStringListFE);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BStringListFE;
|
||||
static /* synthetic */ Class class$javax$baja$sys$BString;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BStringListFE() {
|
||||
BFlowPane bFlowPane = new BFlowPane();
|
||||
bFlowPane.add(null, (BValue)this.getEditButton());
|
||||
this.setContent((BWidget)bFlowPane);
|
||||
}
|
||||
|
||||
public void doEditPressed() {
|
||||
int n;
|
||||
Command command = new Command((BWidget)this, BStringListFE.lexicon.module, "commands.addMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BDialog.prompt((BWidget)BStringListFE.this, (String)"Add", (String)"", (int)40);
|
||||
if (string != null) {
|
||||
BStringListFE.this.listModel.addItem((Object)string);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command2 = new Command((BWidget)this, BStringListFE.lexicon.module, "commands.removeMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = BStringListFE.this.list.getSelection().getItem();
|
||||
if (n > -1) {
|
||||
BStringListFE.this.listModel.removeItem(n);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command3 = new Command((BWidget)this, BStringListFE.lexicon.module, "commands.editMsg"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string;
|
||||
String string2;
|
||||
int n = BStringListFE.this.list.getSelection().getItem();
|
||||
if (n > -1 && (string2 = BDialog.prompt((BWidget)BStringListFE.this, (String)"Edit", (String)(string = BStringListFE.this.listModel.getItem(n).toString()), (int)40)) != null) {
|
||||
BStringListFE.this.listModel.setItem(n, null, (Object)string2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
this.listModel = new DefaultListModel();
|
||||
this.list = new BList((ListModel)this.listModel);
|
||||
this.list.setMultipleSelection(false);
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setValign(BValign.top);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.add(null, (BValue)new BButton(command));
|
||||
bGridPane.add(null, (BValue)new BButton(command2));
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
bGridPane.add(null, (BValue)new BButton(command3));
|
||||
bEdgePane.setCenter((BWidget)this.list);
|
||||
bEdgePane.setRight((BWidget)new BBorderPane((BWidget)bGridPane));
|
||||
BString[] bStringArray = (BString[])this.vector.getChildren(class$javax$baja$sys$BString == null ? (class$javax$baja$sys$BString = BStringListFE.class$("javax.baja.sys.BString")) : class$javax$baja$sys$BString);
|
||||
for (n = 0; n < bStringArray.length; ++n) {
|
||||
this.listModel.addItem((Object)bStringArray[n].toString());
|
||||
}
|
||||
n = BDialog.open((BWidget)this, (String)"Edit", (Object)bEdgePane, (int)3);
|
||||
if (n == 1) {
|
||||
this.vector.removeAll();
|
||||
for (int i = 0; i < this.listModel.getItemCount(); ++i) {
|
||||
this.vector.add(null, (BValue)BString.make((String)this.listModel.getItem(i).toString()));
|
||||
}
|
||||
this.setModified();
|
||||
}
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) {
|
||||
this.vector = (BVector)bObject;
|
||||
}
|
||||
|
||||
public BObject doSaveValue(BObject bObject, Context context) {
|
||||
return this.vector;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.fieldeditors.BFrozenEnumFE
|
||||
* com.tridium.workbench.fieldeditors.BStringFE
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Flags
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.BFormat
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BTextCustomizer;
|
||||
import com.tridium.alarm.BTextOp;
|
||||
import com.tridium.workbench.fieldeditors.BFrozenEnumFE;
|
||||
import com.tridium.workbench.fieldeditors.BStringFE;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Flags;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.BFormat;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BTextCustomizerFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BTextCustomizerFE == null ? (class$com$tridium$alarm$ui$BTextCustomizerFE = BTextCustomizerFE.class$("com.tridium.alarm.ui.BTextCustomizerFE")) : class$com$tridium$alarm$ui$BTextCustomizerFE));
|
||||
BFrozenEnumFE opFE = new BFrozenEnumFE();
|
||||
BStringFE formatFE = new BStringFE();
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BTextCustomizerFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.opFE.setReadonly(bl);
|
||||
this.formatFE.setReadonly(bl);
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BTextCustomizer bTextCustomizer = (BTextCustomizer)bObject;
|
||||
this.opFE.loadValue((BObject)bTextCustomizer.getOp(), context);
|
||||
this.formatFE.loadValue((BObject)BString.make((String)bTextCustomizer.getText().getFormat()), context);
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add("c0", (BValue)this.opFE);
|
||||
bGridPane.add("c1", (BValue)this.formatFE);
|
||||
this.setContent((BWidget)bGridPane);
|
||||
this.opFE.setReadonly(Flags.isReadonly((BComplex)bTextCustomizer, (Slot)BTextCustomizer.op));
|
||||
this.formatFE.setReadonly(Flags.isReadonly((BComplex)bTextCustomizer, (Slot)BTextCustomizer.text));
|
||||
this.linkTo((BComponent)this.opFE, (Slot)BFrozenEnumFE.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.formatFE, (Slot)BStringFE.actionPerformed, (Slot)actionPerformed);
|
||||
this.linkTo((BComponent)this.opFE, (Slot)BFrozenEnumFE.pluginModified, (Slot)setModified);
|
||||
this.linkTo((BComponent)this.formatFE, (Slot)BStringFE.pluginModified, (Slot)setModified);
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) throws Exception {
|
||||
BTextCustomizer bTextCustomizer = (BTextCustomizer)bObject;
|
||||
BTextOp bTextOp = (BTextOp)this.opFE.saveValue();
|
||||
BString bString = (BString)this.formatFE.saveValue();
|
||||
bTextCustomizer.setOp(bTextOp);
|
||||
bTextCustomizer.setText(BFormat.make((String)bString.toString()));
|
||||
return bTextCustomizer;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public final class BTimeZoneDisplay
|
||||
extends BFrozenEnum {
|
||||
public static final int CONSOLE = 0;
|
||||
public static final int SOURCE = 1;
|
||||
public static final BTimeZoneDisplay console = new BTimeZoneDisplay(0);
|
||||
public static final BTimeZoneDisplay source = new BTimeZoneDisplay(1);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BTimeZoneDisplay == null ? (class$com$tridium$alarm$ui$BTimeZoneDisplay = BTimeZoneDisplay.class$("com.tridium.alarm.ui.BTimeZoneDisplay")) : class$com$tridium$alarm$ui$BTimeZoneDisplay));
|
||||
public static final BTimeZoneDisplay DEFAULT = console;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BTimeZoneDisplay;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BTimeZoneDisplay make(int n) {
|
||||
return (BTimeZoneDisplay)console.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static BTimeZoneDisplay make(String string) {
|
||||
return (BTimeZoneDisplay)console.getRange().get(string);
|
||||
}
|
||||
|
||||
private BTimeZoneDisplay(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.TrayIconListener;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BTrayIcon
|
||||
extends BComponent {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BTrayIcon == null ? (class$com$tridium$alarm$ui$BTrayIcon = BTrayIcon.class$("com.tridium.alarm.ui.BTrayIcon")) : class$com$tridium$alarm$ui$BTrayIcon));
|
||||
private boolean isShowing = false;
|
||||
private int nativePeer;
|
||||
private int nativeImage;
|
||||
private String toolTip;
|
||||
private Vector listeners = new Vector();
|
||||
private Thread thread;
|
||||
public static int YELLOW_ICON;
|
||||
public static int GRAY_ICON;
|
||||
public static int GREEN_ICON;
|
||||
public static int RED_ICON;
|
||||
public static int WHITE_ICON;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BTrayIcon;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BTrayIcon make() {
|
||||
return new BTrayIcon();
|
||||
}
|
||||
|
||||
public BTrayIcon() {
|
||||
this.nativeImage = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"));
|
||||
this.toolTip = "Niagara Alarms";
|
||||
}
|
||||
|
||||
public BTrayIcon(int n, String string) {
|
||||
this.nativeImage = n;
|
||||
this.toolTip = string;
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return this.isShowing;
|
||||
}
|
||||
|
||||
public int getImage() {
|
||||
return this.nativeImage;
|
||||
}
|
||||
|
||||
public String getToolTip() {
|
||||
return this.toolTip;
|
||||
}
|
||||
|
||||
public void setImage(int n) {
|
||||
this.nativeImage = n;
|
||||
}
|
||||
|
||||
public void setToolTip(String string) {
|
||||
this.toolTip = string;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
this.isShowing = true;
|
||||
this.doShow();
|
||||
}
|
||||
|
||||
public void updateTrayIcon() {
|
||||
this.updateTrayIcon(this.nativeImage, this.toolTip);
|
||||
}
|
||||
|
||||
public void updateTrayIcon(String string) {
|
||||
this.updateTrayIcon(this.nativeImage, string);
|
||||
}
|
||||
|
||||
public void updateTrayIcon(int n) {
|
||||
this.updateTrayIcon(n, this.toolTip);
|
||||
}
|
||||
|
||||
public void updateTrayIcon(int n, String string) {
|
||||
this.nativeImage = n;
|
||||
this.toolTip = string;
|
||||
if (this.isShowing) {
|
||||
this.nativePeer = this.nativeUpdate(this.nativeImage, string, this.nativePeer);
|
||||
}
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
if (this.isShowing) {
|
||||
this.isShowing = false;
|
||||
this.nativeHide(this.nativePeer);
|
||||
this.thread = null;
|
||||
}
|
||||
this.nativePeer = 0;
|
||||
}
|
||||
|
||||
private void doShow() {
|
||||
if (this.thread != null) {
|
||||
this.hide();
|
||||
}
|
||||
this.thread = new Thread(){
|
||||
|
||||
public void run() {
|
||||
BTrayIcon.this.nativePeer = BTrayIcon.this.nativeShow(BTrayIcon.this.nativeImage, BTrayIcon.this.toolTip, BTrayIcon.this.nativePeer);
|
||||
}
|
||||
};
|
||||
this.thread.start();
|
||||
}
|
||||
|
||||
public void fireClicked() {
|
||||
Vector vector = (Vector)this.listeners.clone();
|
||||
Enumeration enumeration = vector.elements();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
TrayIconListener trayIconListener = (TrayIconListener)enumeration.nextElement();
|
||||
trayIconListener.onTrayIconClicked(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void fireDoubleClicked() {
|
||||
Vector vector = (Vector)this.listeners.clone();
|
||||
Enumeration enumeration = vector.elements();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
TrayIconListener trayIconListener = (TrayIconListener)enumeration.nextElement();
|
||||
trayIconListener.onTrayIconDoubleClicked(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void addTrayIconListener(TrayIconListener trayIconListener) {
|
||||
this.listeners.addElement(trayIconListener);
|
||||
}
|
||||
|
||||
public void removeTrayIconListener(TrayIconListener trayIconListener) {
|
||||
this.listeners.removeElement(trayIconListener);
|
||||
}
|
||||
|
||||
private native int nativeShow(int var1, String var2, int var3);
|
||||
|
||||
private synchronized native int nativeUpdate(int var1, String var2, int var3);
|
||||
|
||||
private native void nativeHide(int var1);
|
||||
|
||||
private static synchronized native int nativeLoadImage(String var0, int var1) throws UnsatisfiedLinkError;
|
||||
|
||||
private static synchronized native int nativeFreeImage(int var0) throws UnsatisfiedLinkError;
|
||||
|
||||
public static int loadImage(String string) {
|
||||
return BTrayIcon.loadImage(string, 0);
|
||||
}
|
||||
|
||||
public static int loadImage(String string, int n) {
|
||||
try {
|
||||
return BTrayIcon.nativeLoadImage(string, n);
|
||||
}
|
||||
catch (UnsatisfiedLinkError unsatisfiedLinkError) {
|
||||
unsatisfiedLinkError.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
protected static void freeImage(int n) {
|
||||
try {
|
||||
BTrayIcon.nativeFreeImage(n);
|
||||
}
|
||||
catch (UnsatisfiedLinkError unsatisfiedLinkError) {
|
||||
unsatisfiedLinkError.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] stringArray) {
|
||||
BTrayIcon bTrayIcon = new BTrayIcon();
|
||||
long l = System.currentTimeMillis();
|
||||
bTrayIcon.show();
|
||||
long l2 = System.currentTimeMillis();
|
||||
bTrayIcon.updateTrayIcon("77 UnAcked Alarms");
|
||||
long l3 = System.currentTimeMillis();
|
||||
System.out.println("show: " + (l2 - l) + "ms");
|
||||
System.out.println("end: " + (l3 - l2) + "ms");
|
||||
System.out.println("total: " + (l3 - l) + "ms");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("trayIcon");
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
System.out.println("ERROR: Cannot load trayIcon native library");
|
||||
System.out.println(" " + throwable);
|
||||
}
|
||||
YELLOW_ICON = 0;
|
||||
GRAY_ICON = 1;
|
||||
GREEN_ICON = 2;
|
||||
RED_ICON = 3;
|
||||
WHITE_ICON = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.BIAlarmServiceView;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
public class ConsoleColumns {
|
||||
protected ArrayList columns;
|
||||
protected ArrayList models = new ArrayList();
|
||||
protected BIAlarmServiceView alarmServiceView;
|
||||
protected HashMap alarmClassDisplayNames = new HashMap();
|
||||
private boolean inited = false;
|
||||
Context cx;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$BAlarmConsole == null ? (class$com$tridium$alarm$ui$BAlarmConsole = ConsoleColumns.class$("com.tridium.alarm.ui.BAlarmConsole")) : class$com$tridium$alarm$ui$BAlarmConsole);
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmConsole;
|
||||
|
||||
public ConsoleColumns() {
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
Property[] propertyArray = bAlarmRecord.getPropertiesArray();
|
||||
this.columns = new ArrayList(propertyArray.length);
|
||||
for (int i = 0; i < propertyArray.length; ++i) {
|
||||
if (propertyArray[i].getType() == BAbsTime.TYPE) {
|
||||
this.columns.add(new TimeColumn(propertyArray[i]));
|
||||
continue;
|
||||
}
|
||||
this.columns.add(new PropertyColumn(propertyArray[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public void init(BIAlarmServiceView bIAlarmServiceView, Context context) {
|
||||
this.alarmServiceView = bIAlarmServiceView;
|
||||
this.cx = context;
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.columns.size();
|
||||
}
|
||||
|
||||
public Column getColumn(int n) {
|
||||
return (Column)this.columns.get(n);
|
||||
}
|
||||
|
||||
public void addDataColumn(String string, String string2) {
|
||||
this.columns.add(new DataColumn(string, SlotPath.escape((String)string2)));
|
||||
}
|
||||
|
||||
public int removeDataColumn(String string) {
|
||||
int n = this.dataColumnIndex(string);
|
||||
if (n != -1) {
|
||||
this.columns.remove(n);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public int dataColumnIndex(String string) {
|
||||
int n = this.columns.size();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
Column column = (Column)this.columns.get(i);
|
||||
if (!(column instanceof DataColumn) || !((DataColumn)column).key.equals(SlotPath.escape((String)string))) continue;
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void addModel(ConsoleTableModel consoleTableModel) {
|
||||
this.models.add(consoleTableModel);
|
||||
}
|
||||
|
||||
public void removeModel(ConsoleTableModel consoleTableModel) {
|
||||
this.models.remove((Object)consoleTableModel);
|
||||
}
|
||||
|
||||
public void fireModified() {
|
||||
int n = this.models.size();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
((ConsoleTableModel)((Object)this.models.get(i))).columnsModified();
|
||||
}
|
||||
}
|
||||
|
||||
private BAlarmService getAlarmService(BConsoleRecipient bConsoleRecipient) {
|
||||
try {
|
||||
return (BAlarmService)BOrd.make((String)"serivce:alarm:AlarmService").resolve((BObject)bConsoleRecipient).get();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getAlarmClassDisplayName(BAlarmRecord bAlarmRecord) {
|
||||
String string = bAlarmRecord.getAlarmClass();
|
||||
if (this.inited) {
|
||||
AlarmClassKey alarmClassKey;
|
||||
String string2;
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
String string3 = bOrd.toString();
|
||||
if (string3.indexOf("|station:|") >= 0) {
|
||||
string3 = string3.substring(0, string3.indexOf("|station:|"));
|
||||
}
|
||||
if ((string2 = (String)this.alarmClassDisplayNames.get(alarmClassKey = new AlarmClassKey(string3, string))) == null) {
|
||||
BAlarmService bAlarmService = this.alarmServiceView.getAlarmService(bAlarmRecord);
|
||||
if (bAlarmService == null) {
|
||||
string2 = string;
|
||||
} else {
|
||||
string2 = bAlarmService.getAlarmClassDisplayName(BString.make((String)string), this.cx).toString();
|
||||
this.alarmClassDisplayNames.put(alarmClassKey, string2);
|
||||
}
|
||||
}
|
||||
return string2;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private class AlarmClassKey {
|
||||
String station;
|
||||
String alarmClass;
|
||||
|
||||
public AlarmClassKey(String string, String string2) {
|
||||
this.station = string;
|
||||
this.alarmClass = string2;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof AlarmClassKey) {
|
||||
AlarmClassKey alarmClassKey = (AlarmClassKey)object;
|
||||
return alarmClassKey.station.equals(this.station) && alarmClassKey.alarmClass.equals(this.alarmClass);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return new String(this.station + "|" + this.alarmClass).hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DataColumn
|
||||
extends Column {
|
||||
private String name;
|
||||
private String key;
|
||||
|
||||
public DataColumn(String string, String string2) {
|
||||
this.name = string;
|
||||
this.key = string2;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (this.name == null) {
|
||||
this.name = lexicon.get("alarmData." + this.key, null);
|
||||
}
|
||||
if (this.name == null) {
|
||||
this.name = TextUtil.toFriendly((String)this.key);
|
||||
}
|
||||
return SlotPath.unescape((String)this.name);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public Object getValue(BAlarmRecord bAlarmRecord) {
|
||||
if (this.key.equals("sourceOrd")) {
|
||||
return bAlarmRecord.getSource();
|
||||
}
|
||||
BFacets bFacets = bAlarmRecord.getAlarmData();
|
||||
Object object = bFacets.get(this.key);
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
object = BFormat.make((String)object.toString()).format((Object)bAlarmRecord);
|
||||
return object;
|
||||
}
|
||||
|
||||
public String getQueryName() {
|
||||
return "alarmData." + this.key;
|
||||
}
|
||||
}
|
||||
|
||||
public class TimeColumn
|
||||
extends PropertyColumn {
|
||||
public TimeColumn(Property property) {
|
||||
super(property);
|
||||
}
|
||||
|
||||
public Object getValue(BAlarmRecord bAlarmRecord) {
|
||||
BAbsTime bAbsTime = (BAbsTime)super.getValue(bAlarmRecord);
|
||||
return bAbsTime;
|
||||
}
|
||||
}
|
||||
|
||||
public class PropertyColumn
|
||||
extends Column {
|
||||
private Property prop;
|
||||
|
||||
public PropertyColumn(Property property) {
|
||||
this.prop = property;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.prop.getDefaultDisplayName(null);
|
||||
}
|
||||
|
||||
public Object getValue(BAlarmRecord bAlarmRecord) {
|
||||
return this.getValue(bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Object getValue(BAlarmRecord bAlarmRecord, Context context) {
|
||||
if (this.prop.equals(BAlarmRecord.source)) {
|
||||
BString bString = (BString)bAlarmRecord.getAlarmData().get("sourceName");
|
||||
if (bString != null && bString != BString.DEFAULT) {
|
||||
return BFormat.make((String)bString.toString(context)).format((Object)bAlarmRecord);
|
||||
}
|
||||
return bAlarmRecord.get(this.prop);
|
||||
}
|
||||
if (this.prop.equals(BAlarmRecord.alarmClass)) {
|
||||
return ConsoleColumns.this.getAlarmClassDisplayName(bAlarmRecord);
|
||||
}
|
||||
return bAlarmRecord.get(this.prop);
|
||||
}
|
||||
|
||||
public String getQueryName() {
|
||||
return this.prop.getName();
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class Column {
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getQueryName();
|
||||
|
||||
public abstract Object getValue(BAlarmRecord var1);
|
||||
|
||||
public Object getValue(BAlarmRecord bAlarmRecord, Context context) {
|
||||
return this.getValue(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.data.BDataTable
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.nre.util.TextUtil
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.timezone.BTimeZone
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.util.BFormat
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BAlarmConsoleOptions;
|
||||
import com.tridium.alarm.ui.BIAlarmServiceView;
|
||||
import com.tridium.alarm.ui.BTimeZoneDisplay;
|
||||
import com.tridium.alarm.ui.ConsoleColumns;
|
||||
import com.tridium.data.BDataTable;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.util.BFormat;
|
||||
|
||||
public abstract class ConsoleTableModel
|
||||
extends TableModel {
|
||||
private static BImage alarmImg = BImage.make((String)"module://icons/x16/alarm.png");
|
||||
private static BImage redAlarmImg = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmRed.png");
|
||||
private static BImage greenAlarmImg = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmGreen.png");
|
||||
private static BImage orangeAlarmImg = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmOrange.png");
|
||||
private static BImage whiteAlarmImg = BImage.make((String)"module://alarm/com/tridium/alarm/icons/alarmWhite.png");
|
||||
public BAlarmConsoleOptions options = BAlarmConsoleOptions.getDefault();
|
||||
private ConsoleColumns columns;
|
||||
private int sortCol = 5;
|
||||
private boolean sortAsc = false;
|
||||
public static final BFacets TIME_FACETS = BFacets.make((String)"showSeconds", (boolean)true);
|
||||
|
||||
public ConsoleTableModel(ConsoleColumns consoleColumns) {
|
||||
this.columns = consoleColumns;
|
||||
consoleColumns.addModel(this);
|
||||
}
|
||||
|
||||
public void init(BIAlarmServiceView bIAlarmServiceView, Context context) {
|
||||
this.columns.init(bIAlarmServiceView, context);
|
||||
}
|
||||
|
||||
public abstract BAlarmRecord getRecord(int var1);
|
||||
|
||||
public BAlarmRecord getRecord(BOrdList bOrdList, int n) {
|
||||
return this.getRecord(n);
|
||||
}
|
||||
|
||||
public abstract int getAlarmCount();
|
||||
|
||||
public int getAlarmCount(BOrdList bOrdList) {
|
||||
return this.getAlarmCount();
|
||||
}
|
||||
|
||||
public abstract int getSourceCount();
|
||||
|
||||
public ConsoleColumns getColumns() {
|
||||
return this.columns;
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.columns.getColumnCount();
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
return this.columns.getColumn(n).getName();
|
||||
}
|
||||
|
||||
public void addDataColumn(String string, String string2) {
|
||||
this.columns.addDataColumn(string, string2);
|
||||
}
|
||||
|
||||
public void removeDataColumn(String string) {
|
||||
this.columns.removeDataColumn(string);
|
||||
}
|
||||
|
||||
public void columnsModified() {
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public Object getSubject(int n) {
|
||||
return this.getRecord(n);
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
BAlarmRecord bAlarmRecord;
|
||||
ConsoleColumns.Column column = this.columns.getColumn(n2);
|
||||
Object object = column.getValue(bAlarmRecord = this.getRecord(n));
|
||||
if (object instanceof BAbsTime) {
|
||||
if (this.options.getTimeZoneDisplay() == BTimeZoneDisplay.source) {
|
||||
return ((BAbsTime)object).toString((Context)BFacets.make((BFacets)bAlarmRecord.getAlarmData(), (BFacets)TIME_FACETS));
|
||||
}
|
||||
return ((BAbsTime)object).toString((Context)BFacets.make((BFacets)TIME_FACETS, (String)"TimeZone", (BIDataValue)BTimeZone.getLocal()));
|
||||
}
|
||||
if (object instanceof BString || object instanceof String) {
|
||||
return TextUtil.replace((String)object.toString(), (String)"\\n", (String)" ");
|
||||
}
|
||||
if (object instanceof BFacets) {
|
||||
return BFormat.make((String)object.toString()).format((Object)bAlarmRecord).replace('\n', ' ');
|
||||
}
|
||||
if (object instanceof String) {
|
||||
return TextUtil.replace((String)object.toString(), (String)"\\n", (String)" ");
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public BImage getRowIcon(int n) {
|
||||
BAlarmRecord bAlarmRecord = this.getRecord(n);
|
||||
BImage bImage = alarmImg;
|
||||
BSourceState bSourceState = bAlarmRecord.getSourceState();
|
||||
BAckState bAckState = bAlarmRecord.getAckState();
|
||||
if (bSourceState == BSourceState.alert && bAckState != BAckState.acked) {
|
||||
bImage = orangeAlarmImg;
|
||||
} else if (bSourceState == BSourceState.alert && bAckState == BAckState.acked) {
|
||||
bImage = whiteAlarmImg;
|
||||
} else if (bAckState == BAckState.acked && bSourceState != BSourceState.normal) {
|
||||
bImage = alarmImg;
|
||||
} else if (bSourceState == BSourceState.normal && bAckState != BAckState.acked) {
|
||||
bImage = greenAlarmImg;
|
||||
} else if (bAckState != BAckState.acked && bSourceState != BSourceState.normal) {
|
||||
bImage = redAlarmImg;
|
||||
} else if (bAckState == BAckState.acked && bSourceState == BSourceState.normal) {
|
||||
bImage = whiteAlarmImg;
|
||||
}
|
||||
if (bAlarmRecord.getAlarmData().get("notes") != null) {
|
||||
return BImage.make((BIcon)BIcon.make((BIcon)BIcon.make((BOrdList)bImage.getOrdList()), (BIcon)BIcon.std((String)"badges/note.png")));
|
||||
}
|
||||
return bImage;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.columns.removeModel(this);
|
||||
}
|
||||
|
||||
public BITable export() {
|
||||
int n;
|
||||
int n2 = this.getTable().getModel().getColumnCount();
|
||||
int n3 = this.getTable().getModel().getRowCount();
|
||||
BDataTable bDataTable = new BDataTable();
|
||||
for (n = 0; n < n2; ++n) {
|
||||
String string = this.getTable().getModel().getColumnName(n);
|
||||
String string2 = SlotPath.escape((String)string);
|
||||
Type type = BIDataValue.TYPE;
|
||||
bDataTable.addColumn(string2, string, type, 0, BFacets.NULL);
|
||||
}
|
||||
bDataTable.startRows();
|
||||
for (n = 0; n < n3; ++n) {
|
||||
bDataTable.startRow();
|
||||
for (int i = 0; i < n2; ++i) {
|
||||
int n4 = i;
|
||||
if (this.getTable().getModel() instanceof DynamicTableModel) {
|
||||
n4 = ((DynamicTableModel)this.getTable().getModel()).toRootColumnIndex(i);
|
||||
}
|
||||
bDataTable.set(this.export(n, n4).toDataValue(), BFacets.NULL);
|
||||
}
|
||||
bDataTable.endRow();
|
||||
}
|
||||
bDataTable.endRows();
|
||||
return bDataTable;
|
||||
}
|
||||
|
||||
public BObject export(int n, int n2) {
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n2);
|
||||
if (column instanceof ConsoleColumns.DataColumn) {
|
||||
return BString.make((String)SlotPath.unescape((String)this.hexCorrection(this.getValueAt(n, n2).toString())));
|
||||
}
|
||||
return super.export(n, n2);
|
||||
}
|
||||
|
||||
private String hexCorrection(String string) {
|
||||
int n = string.split("at ").length;
|
||||
int n2 = string.split(".java:").length;
|
||||
string = string.replaceAll("\n", " ").trim();
|
||||
if (n == n2 && string.matches(".*java:[0-9]+\\)$")) {
|
||||
string = string.replaceAll("\\$", "\\$24");
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public boolean isColumnSortable(int n) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setInitialSort(int n, boolean bl) {
|
||||
this.sortCol = n;
|
||||
this.sortAsc = bl;
|
||||
}
|
||||
|
||||
public int getLastSortColumn() {
|
||||
return this.sortCol;
|
||||
}
|
||||
|
||||
public boolean getLastSortAscending() {
|
||||
return this.sortAsc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BAbstractFile
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.SoundPlayer;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.InputStream;
|
||||
import javax.baja.file.BAbstractFile;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.DataLine;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
|
||||
public class MediaPlayer
|
||||
extends SoundPlayer {
|
||||
static /* synthetic */ Class class$javax$sound$sampled$SourceDataLine;
|
||||
|
||||
public MediaPlayer() {
|
||||
}
|
||||
|
||||
public MediaPlayer(BValue bValue, BAbstractFile bAbstractFile) {
|
||||
this.addMediaObject(bValue, bAbstractFile);
|
||||
}
|
||||
|
||||
public MediaPlayer(BValue bValue, BAbstractFile bAbstractFile, BRelTime bRelTime) {
|
||||
this.addMediaObject(bValue, bAbstractFile);
|
||||
this.delay = bRelTime;
|
||||
}
|
||||
|
||||
protected void processMediaObject(Object object) throws Exception {
|
||||
BAbstractFile bAbstractFile;
|
||||
InputStream inputStream;
|
||||
BufferedInputStream bufferedInputStream;
|
||||
AudioInputStream audioInputStream;
|
||||
AudioFormat audioFormat;
|
||||
DataLine.Info info = new DataLine.Info(class$javax$sound$sampled$SourceDataLine == null ? (class$javax$sound$sampled$SourceDataLine = MediaPlayer.class$("javax.sound.sampled.SourceDataLine")) : class$javax$sound$sampled$SourceDataLine, audioFormat = (audioInputStream = AudioSystem.getAudioInputStream(bufferedInputStream = new BufferedInputStream(inputStream = (bAbstractFile = (BAbstractFile)object).getInputStream()))).getFormat());
|
||||
if (!AudioSystem.isLineSupported(info)) {
|
||||
logger.warning("BAlarmConsole: audio system does not handle this type of audio: " + audioFormat);
|
||||
return;
|
||||
}
|
||||
SourceDataLine sourceDataLine = (SourceDataLine)AudioSystem.getLine(info);
|
||||
sourceDataLine.open(audioFormat);
|
||||
sourceDataLine.start();
|
||||
int n = (int)bAbstractFile.getSize();
|
||||
if (n > 4096) {
|
||||
n = 4096;
|
||||
}
|
||||
byte[] byArray = new byte[n];
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
while (!this.stopRequest) {
|
||||
++n3;
|
||||
n2 = audioInputStream.read(byArray, 0, byArray.length);
|
||||
if (n2 < 0) break;
|
||||
sourceDataLine.write(byArray, 0, n2);
|
||||
}
|
||||
sourceDataLine.drain();
|
||||
sourceDataLine.close();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.util.Queue
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.util.Queue;
|
||||
|
||||
public class SoundPlayer {
|
||||
protected boolean stopRequest = false;
|
||||
protected Queue media = new Queue();
|
||||
protected HashMap soundToSourcesMap = new HashMap();
|
||||
protected HashMap sourceToSoundMap = new HashMap();
|
||||
protected boolean isPlaying = false;
|
||||
protected BRelTime delay = BRelTime.make((long)1000L);
|
||||
public static final Log logger = Log.getLog((String)"bajaui");
|
||||
private ArrayList listeners = new ArrayList();
|
||||
static /* synthetic */ Class class$javax$baja$sys$BValue;
|
||||
|
||||
public SoundPlayer() {
|
||||
}
|
||||
|
||||
public SoundPlayer(BRelTime bRelTime) {
|
||||
this.delay = bRelTime;
|
||||
}
|
||||
|
||||
public boolean addMediaObject(BValue bValue, Object object) {
|
||||
Array array = (Array)this.soundToSourcesMap.get(object);
|
||||
if (array == null) {
|
||||
array = new Array(class$javax$baja$sys$BValue == null ? (class$javax$baja$sys$BValue = SoundPlayer.class$("javax.baja.sys.BValue")) : class$javax$baja$sys$BValue);
|
||||
array.add((Object)bValue);
|
||||
this.soundToSourcesMap.put(object, array);
|
||||
this.sourceToSoundMap.put(bValue, object);
|
||||
this.media.enqueue(object);
|
||||
return true;
|
||||
}
|
||||
if (!array.contains((Object)bValue)) {
|
||||
array.add((Object)bValue);
|
||||
this.soundToSourcesMap.put(object, array);
|
||||
this.sourceToSoundMap.put(bValue, object);
|
||||
this.media.enqueue(object);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeMediaObject(BValue bValue) {
|
||||
Object v = this.sourceToSoundMap.remove(bValue);
|
||||
Array array = (Array)this.soundToSourcesMap.get(v);
|
||||
if (array != null) {
|
||||
array.remove((Object)bValue);
|
||||
if (array.size() == 0) {
|
||||
this.soundToSourcesMap.remove(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasMediaObjects() {
|
||||
return this.media.size() > 0 && this.soundToSourcesMap.size() > 0;
|
||||
}
|
||||
|
||||
public void setDelay(BRelTime bRelTime) {
|
||||
this.delay = bRelTime.getMillis() < 1000L ? BRelTime.make((long)1000L) : bRelTime;
|
||||
}
|
||||
|
||||
public BRelTime getDelay() {
|
||||
return this.delay;
|
||||
}
|
||||
|
||||
public void beep() {
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
}
|
||||
|
||||
protected void processMediaObject(Object object) throws Exception {
|
||||
this.beep();
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return this.isPlaying;
|
||||
}
|
||||
|
||||
public void play() throws Exception {
|
||||
this.play(true);
|
||||
}
|
||||
|
||||
public void play(boolean bl) throws Exception {
|
||||
this.play(bl, this.delay);
|
||||
}
|
||||
|
||||
public void play(boolean bl, BRelTime bRelTime) throws Exception {
|
||||
this.delay = bRelTime;
|
||||
if (this.media.isEmpty()) {
|
||||
throw new Exception("Cannot play: Media File(s) not specified.");
|
||||
}
|
||||
if (this.isPlaying) {
|
||||
return;
|
||||
}
|
||||
this.stopRequest = false;
|
||||
PlayThread playThread = new PlayThread(bl);
|
||||
playThread.start();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
this.stopRequest = true;
|
||||
this.soundToSourcesMap.clear();
|
||||
this.sourceToSoundMap.clear();
|
||||
this.media.clear();
|
||||
}
|
||||
|
||||
public void fireMediaPlayerStopped() {
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
((MediaPlayerListener)this.listeners.get(i)).mediaPlayerStopped();
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(MediaPlayerListener mediaPlayerListener) {
|
||||
this.listeners.add(mediaPlayerListener);
|
||||
}
|
||||
|
||||
public void removeListener(MediaPlayerListener mediaPlayerListener) {
|
||||
this.listeners.remove(mediaPlayerListener);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static interface MediaPlayerListener {
|
||||
public void mediaPlayerStopped();
|
||||
}
|
||||
|
||||
private class PlayThread
|
||||
extends Thread {
|
||||
private boolean continuous;
|
||||
|
||||
PlayThread(boolean bl) {
|
||||
super("Alarm: MediaPlayer");
|
||||
this.continuous = bl;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
block4: while (true) {
|
||||
try {
|
||||
while (!SoundPlayer.this.media.isEmpty()) {
|
||||
SoundPlayer.this.isPlaying = true;
|
||||
Object object = SoundPlayer.this.media.dequeue();
|
||||
if (SoundPlayer.this.stopRequest) break block4;
|
||||
if (SoundPlayer.this.soundToSourcesMap.get(object) != null) {
|
||||
SoundPlayer.this.processMediaObject(object);
|
||||
if (this.continuous) {
|
||||
SoundPlayer.this.media.enqueue(object);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(SoundPlayer.this.delay.getMillis());
|
||||
continue block4;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("BAlarmConsole.soundAlarm: failed to play alarm sound: " + exception);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (SoundPlayer.this.stopRequest || !this.continuous && SoundPlayer.this.media.isEmpty()) {
|
||||
SoundPlayer.this.fireMediaPlayerStopped();
|
||||
}
|
||||
SoundPlayer.this.stopRequest = false;
|
||||
SoundPlayer.this.isPlaying = false;
|
||||
SoundPlayer.this.media.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,566 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.nre.util.SortUtil
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.util.BUuid
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.AlarmTableModel;
|
||||
import com.tridium.alarm.ui.BIAlarmServiceView;
|
||||
import com.tridium.alarm.ui.ConsoleColumns;
|
||||
import com.tridium.alarm.ui.ConsoleTableModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.util.BUuid;
|
||||
|
||||
public class SourceTableModel
|
||||
extends ConsoleTableModel {
|
||||
protected BConsoleRecipient recip;
|
||||
private ArrayList srcList = new ArrayList();
|
||||
private HashMap bySrc = new HashMap();
|
||||
private UuidList byUuid = new UuidList();
|
||||
private boolean holdUpdates = false;
|
||||
private boolean updatePending = false;
|
||||
BIAlarmServiceView alarmServiceView;
|
||||
public Context context;
|
||||
|
||||
public SourceTableModel(ConsoleColumns consoleColumns, BConsoleRecipient bConsoleRecipient, Context context) {
|
||||
super(consoleColumns);
|
||||
this.recip = bConsoleRecipient;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void init(BIAlarmServiceView bIAlarmServiceView, Context context) {
|
||||
super.init(bIAlarmServiceView, context);
|
||||
this.alarmServiceView = bIAlarmServiceView;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public synchronized void load(Cursor cursor) {
|
||||
this.setHoldUpdates(true);
|
||||
this.clear();
|
||||
this.doAdd(cursor);
|
||||
this.setHoldUpdates(false);
|
||||
}
|
||||
|
||||
public synchronized void add(Cursor cursor) {
|
||||
this.setHoldUpdates(true);
|
||||
this.doAdd(cursor);
|
||||
this.setHoldUpdates(false);
|
||||
}
|
||||
|
||||
private synchronized void doAdd(Cursor cursor) {
|
||||
while (cursor.next()) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)cursor.get();
|
||||
this.recip.lease();
|
||||
if (!this.recip.accept(bAlarmRecord)) continue;
|
||||
bAlarmRecord = this.updateAlarmRecord(bAlarmRecord);
|
||||
this.update(bAlarmRecord, false);
|
||||
}
|
||||
this.sortByColumn(this.getLastSortColumn(), this.getLastSortAscending());
|
||||
}
|
||||
|
||||
protected BAlarmRecord updateAlarmRecord(BAlarmRecord bAlarmRecord) {
|
||||
return bAlarmRecord;
|
||||
}
|
||||
|
||||
public synchronized BAlarmRecord getRecord(int n) {
|
||||
if (n < this.srcList.size()) {
|
||||
return ((AlarmList)this.srcList.get(n)).getMostRecentRecord();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized int getRecordCount(int n) {
|
||||
return ((AlarmList)this.srcList.get(n)).size();
|
||||
}
|
||||
|
||||
public synchronized BAlarmRecord getRecordAt(int n, int n2) {
|
||||
AlarmList alarmList = (AlarmList)this.srcList.get(n);
|
||||
AlarmEntry alarmEntry = alarmList.getEntry(n2);
|
||||
return alarmEntry.rec;
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
this.srcList.clear();
|
||||
this.bySrc.clear();
|
||||
this.byUuid.clear();
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public int getAlarmCount() {
|
||||
return this.byUuid.getAlarmCount();
|
||||
}
|
||||
|
||||
public int getSourceCount() {
|
||||
return this.getRowCount();
|
||||
}
|
||||
|
||||
private synchronized void add(BAlarmRecord bAlarmRecord, boolean bl) {
|
||||
BOrdList bOrdList = (bAlarmRecord = this.updateAlarmRecord(bAlarmRecord)).getSource();
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bOrdList);
|
||||
if (alarmList == null) {
|
||||
alarmList = new AlarmList(bOrdList);
|
||||
this.srcList.add(alarmList);
|
||||
this.bySrc.put(bOrdList, alarmList);
|
||||
AlarmEntry alarmEntry = alarmList.add(bAlarmRecord);
|
||||
this.byUuid.put(bAlarmRecord.getUuid(), alarmEntry);
|
||||
} else {
|
||||
AlarmEntry alarmEntry = alarmList.add(bAlarmRecord);
|
||||
this.byUuid.put(bAlarmRecord.getUuid(), alarmEntry);
|
||||
}
|
||||
if (bl) {
|
||||
this.sortListByColumn(alarmList, this.getLastSortColumn(), this.getLastSortAscending());
|
||||
this.sortByColumn(this.getLastSortColumn(), this.getLastSortAscending());
|
||||
}
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public synchronized void update(BAlarmRecord bAlarmRecord) {
|
||||
this.update(bAlarmRecord, true);
|
||||
}
|
||||
|
||||
public synchronized void update(BAlarmRecord bAlarmRecord, boolean bl) {
|
||||
AlarmEntry alarmEntry = this.byUuid.get(bAlarmRecord.getUuid(), bAlarmRecord.getSource());
|
||||
if (alarmEntry != null && alarmEntry.rec.getSource().equals((Object)bAlarmRecord.getSource())) {
|
||||
BAlarmRecord bAlarmRecord2 = alarmEntry.rec;
|
||||
alarmEntry.rec = bAlarmRecord = this.updateAlarmRecord(bAlarmRecord);
|
||||
if (!bAlarmRecord2.isAcknowledged() && !bAlarmRecord2.isAckPending() && alarmEntry.rec.isAckPending()) {
|
||||
alarmEntry.list.ackPendingCount++;
|
||||
alarmEntry.list.unackedCount--;
|
||||
} else if (bAlarmRecord2.isAckPending() && alarmEntry.rec.isAcknowledged()) {
|
||||
alarmEntry.list.ackPendingCount--;
|
||||
alarmEntry.list.ackedCount++;
|
||||
} else if (bAlarmRecord2.isAckPending() && !alarmEntry.rec.isAcknowledged() && !alarmEntry.rec.isAckPending()) {
|
||||
alarmEntry.list.ackPendingCount--;
|
||||
alarmEntry.list.unackedCount++;
|
||||
} else if (bAlarmRecord2.isAcknowledged() && !alarmEntry.rec.isAcknowledged() && !alarmEntry.rec.isAckPending()) {
|
||||
alarmEntry.list.ackedCount--;
|
||||
alarmEntry.list.unackedCount++;
|
||||
} else if (bAlarmRecord2.isAcknowledged() && alarmEntry.rec.isAckPending()) {
|
||||
alarmEntry.list.ackedCount--;
|
||||
alarmEntry.list.ackPendingCount++;
|
||||
} else if (alarmEntry.rec.isAcknowledged() && !bAlarmRecord2.isAcknowledged() && !bAlarmRecord2.isAckPending()) {
|
||||
alarmEntry.list.ackedCount++;
|
||||
alarmEntry.list.unackedCount--;
|
||||
}
|
||||
alarmEntry.list.fireModified();
|
||||
this.updateTable();
|
||||
} else {
|
||||
this.add(bAlarmRecord, bl);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void remove(BAlarmRecord bAlarmRecord) {
|
||||
BUuid bUuid = bAlarmRecord.getUuid();
|
||||
AlarmEntry[] alarmEntryArray = this.byUuid.get(bUuid);
|
||||
for (int i = 0; i < alarmEntryArray.length; ++i) {
|
||||
AlarmEntry alarmEntry = alarmEntryArray[i];
|
||||
if (alarmEntry == null) {
|
||||
return;
|
||||
}
|
||||
this.byUuid.remove(bUuid);
|
||||
AlarmList alarmList = alarmEntry.list;
|
||||
alarmList.remove(alarmEntry);
|
||||
if (alarmList.size() != 0) continue;
|
||||
this.bySrc.remove(alarmList.getSource());
|
||||
this.srcList.remove(alarmList);
|
||||
}
|
||||
this.sortByColumn(this.getLastSortColumn(), this.getLastSortAscending());
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public synchronized void removeSource(BOrdList bOrdList) {
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bOrdList);
|
||||
for (int i = 0; i < alarmList.size(); ++i) {
|
||||
AlarmEntry alarmEntry = alarmList.getEntry(i);
|
||||
this.byUuid.remove(alarmEntry.rec.getUuid());
|
||||
}
|
||||
this.bySrc.remove(bOrdList);
|
||||
this.srcList.remove(alarmList);
|
||||
this.updateTable();
|
||||
}
|
||||
|
||||
public synchronized int getRowCount() {
|
||||
return this.srcList.size();
|
||||
}
|
||||
|
||||
public synchronized Object getValueAt(int n, int n2) {
|
||||
if (n2 == 3) {
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n2);
|
||||
BAlarmRecord bAlarmRecord = this.getRecord(n);
|
||||
if (bAlarmRecord == null) {
|
||||
return "";
|
||||
}
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bAlarmRecord.getSource());
|
||||
if (alarmList == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(alarmList.getAckedCount() + " " + BAckState.acked.getDisplayTag(this.context) + " / " + alarmList.getUnackedCount() + " " + BAckState.unacked.getDisplayTag(this.context));
|
||||
if (alarmList.getAckPendingCount() > 0) {
|
||||
stringBuffer.append(" / " + alarmList.getAckPendingCount() + " " + BAckState.ackPending.getDisplayTag(this.context));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
|
||||
public synchronized AlarmTableModel getModelForSource(BOrdList bOrdList) {
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bOrdList);
|
||||
if (alarmList == null) {
|
||||
return null;
|
||||
}
|
||||
AlarmTableModel alarmTableModel = new AlarmTableModel(this.getColumns(), alarmList);
|
||||
alarmTableModel.sortByColumn(this.getLastSortColumn(), this.getLastSortAscending());
|
||||
alarmTableModel.init(this.alarmServiceView, this.context);
|
||||
return alarmTableModel;
|
||||
}
|
||||
|
||||
public synchronized int getUnackedCountForSource(BOrdList bOrdList) {
|
||||
if (this.bySrc.get(bOrdList) == null) {
|
||||
return 0;
|
||||
}
|
||||
return ((AlarmList)this.bySrc.get(bOrdList)).getUnackedCount();
|
||||
}
|
||||
|
||||
public synchronized int getAckedCountForSource(BOrdList bOrdList) {
|
||||
if (this.bySrc.get(bOrdList) == null) {
|
||||
return 0;
|
||||
}
|
||||
return ((AlarmList)this.bySrc.get(bOrdList)).getAckedCount();
|
||||
}
|
||||
|
||||
public synchronized int getAckPendingCountForSource(BOrdList bOrdList) {
|
||||
if (this.bySrc.get(bOrdList) == null) {
|
||||
return 0;
|
||||
}
|
||||
return ((AlarmList)this.bySrc.get(bOrdList)).getAckPendingCount();
|
||||
}
|
||||
|
||||
public synchronized int getAlarmCount(BOrdList bOrdList) {
|
||||
if (bOrdList == null) {
|
||||
return 0;
|
||||
}
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bOrdList);
|
||||
if (alarmList != null) {
|
||||
return alarmList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public synchronized BAlarmRecord getRecord(BOrdList bOrdList, int n) {
|
||||
if (bOrdList == null) {
|
||||
return null;
|
||||
}
|
||||
AlarmList alarmList = (AlarmList)this.bySrc.get(bOrdList);
|
||||
if (alarmList == null || alarmList.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return alarmList.getRecord(n);
|
||||
}
|
||||
|
||||
private synchronized void setHoldUpdates(boolean bl) {
|
||||
this.holdUpdates = bl;
|
||||
if (!this.holdUpdates && this.updatePending) {
|
||||
this.updatePending = false;
|
||||
this.updateTable();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void updateTable() {
|
||||
if (this.holdUpdates) {
|
||||
this.updatePending = true;
|
||||
} else {
|
||||
super.updateTable();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void updateTable(boolean bl) {
|
||||
if (this.holdUpdates) {
|
||||
this.updatePending = true;
|
||||
} else {
|
||||
super.updateTable(bl);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void sortByColumn(int n, boolean bl) {
|
||||
if (n < 0 || n >= super.getColumnCount()) {
|
||||
return;
|
||||
}
|
||||
this.setInitialSort(n, bl);
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n);
|
||||
if (bl) {
|
||||
this.sortSrcList(column, SortUtil.ASCENDING);
|
||||
} else {
|
||||
this.sortSrcList(column, SortUtil.DESCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
public void sortSrcList(ConsoleColumns.Column column, Comparator comparator) {
|
||||
int n = this.srcList.size();
|
||||
for (int i = n / 2; i >= 1; i /= 2) {
|
||||
for (int j = i; j < n; ++j) {
|
||||
int n2;
|
||||
AlarmList alarmList = (AlarmList)this.srcList.get(j);
|
||||
Object object = column.getValue(alarmList.getMostRecentRecord());
|
||||
for (n2 = j; n2 >= i && comparator.compare(object, column.getValue(((AlarmList)this.srcList.get(n2 - i)).getMostRecentRecord())) <= 0; n2 -= i) {
|
||||
if (comparator.compare(object, column.getValue(((AlarmList)this.srcList.get(n2 - i)).getMostRecentRecord())) == 0) {
|
||||
BAbsTime bAbsTime = alarmList.getMostRecentRecord().getTimestamp();
|
||||
BAbsTime bAbsTime2 = ((AlarmList)this.srcList.get(n2 - i)).getMostRecentRecord().getTimestamp();
|
||||
if (!bAbsTime2.isBefore(bAbsTime)) break;
|
||||
this.srcList.set(n2, this.srcList.get(n2 - i));
|
||||
continue;
|
||||
}
|
||||
this.srcList.set(n2, this.srcList.get(n2 - i));
|
||||
}
|
||||
this.srcList.set(n2, alarmList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void sortListByColumn(AlarmList alarmList, int n, boolean bl) {
|
||||
if (n < 0 || n >= super.getColumnCount()) {
|
||||
return;
|
||||
}
|
||||
this.setInitialSort(n, bl);
|
||||
ConsoleColumns.Column column = this.getColumns().getColumn(n);
|
||||
if (bl) {
|
||||
alarmList.sort(column, SortUtil.ASCENDING);
|
||||
} else {
|
||||
alarmList.sort(column, SortUtil.DESCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
class UuidList {
|
||||
private HashMap byUuid = new HashMap();
|
||||
|
||||
UuidList() {
|
||||
}
|
||||
|
||||
public void put(BUuid bUuid, AlarmEntry alarmEntry) {
|
||||
HashMap<BOrdList, AlarmEntry> hashMap = (HashMap<BOrdList, AlarmEntry>)this.byUuid.get(bUuid);
|
||||
if (hashMap == null) {
|
||||
hashMap = new HashMap<BOrdList, AlarmEntry>();
|
||||
}
|
||||
hashMap.put(alarmEntry.rec.getSource(), alarmEntry);
|
||||
this.byUuid.put(bUuid, hashMap);
|
||||
}
|
||||
|
||||
public AlarmEntry get(BUuid bUuid, BOrdList bOrdList) {
|
||||
HashMap hashMap = (HashMap)this.byUuid.get(bUuid);
|
||||
if (hashMap == null) {
|
||||
return null;
|
||||
}
|
||||
return (AlarmEntry)hashMap.get(bOrdList);
|
||||
}
|
||||
|
||||
public AlarmEntry[] get(BUuid bUuid) {
|
||||
HashMap hashMap = (HashMap)this.byUuid.get(bUuid);
|
||||
if (hashMap == null) {
|
||||
return new AlarmEntry[0];
|
||||
}
|
||||
Object[] objectArray = hashMap.values().toArray();
|
||||
AlarmEntry[] alarmEntryArray = new AlarmEntry[objectArray.length];
|
||||
for (int i = 0; i < objectArray.length; ++i) {
|
||||
alarmEntryArray[i] = (AlarmEntry)objectArray[i];
|
||||
}
|
||||
return alarmEntryArray;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.byUuid.size();
|
||||
}
|
||||
|
||||
public int getAlarmCount() {
|
||||
int n = 0;
|
||||
Iterator iterator = this.byUuid.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
HashMap hashMap = (HashMap)iterator.next();
|
||||
if (hashMap == null) continue;
|
||||
n += hashMap.size();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.byUuid.clear();
|
||||
}
|
||||
|
||||
public void remove(BUuid bUuid) {
|
||||
this.byUuid.remove(bUuid);
|
||||
}
|
||||
}
|
||||
|
||||
class AlarmEntry {
|
||||
public AlarmList list;
|
||||
public BAlarmRecord rec;
|
||||
|
||||
public AlarmEntry(AlarmList alarmList, BAlarmRecord bAlarmRecord) {
|
||||
this.list = alarmList;
|
||||
this.rec = bAlarmRecord;
|
||||
}
|
||||
}
|
||||
|
||||
class AlarmList {
|
||||
private BOrdList src;
|
||||
private ArrayList entries;
|
||||
private TableModel tableModel;
|
||||
private AlarmEntry mostRecentEntry;
|
||||
private int ackedCount = 0;
|
||||
private int unackedCount = 0;
|
||||
private int ackPendingCount = 0;
|
||||
|
||||
public AlarmList(BOrdList bOrdList) {
|
||||
this.src = bOrdList;
|
||||
this.entries = new ArrayList(1);
|
||||
}
|
||||
|
||||
public void setModel(TableModel tableModel) {
|
||||
this.tableModel = tableModel;
|
||||
}
|
||||
|
||||
public TableModel getModel() {
|
||||
return this.tableModel;
|
||||
}
|
||||
|
||||
public void fireModified() {
|
||||
if (this.tableModel != null) {
|
||||
this.tableModel.updateTable();
|
||||
}
|
||||
}
|
||||
|
||||
public BOrdList getSource() {
|
||||
return this.src;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.entries.size();
|
||||
}
|
||||
|
||||
public AlarmEntry getEntry(int n) {
|
||||
return (AlarmEntry)this.entries.get(n);
|
||||
}
|
||||
|
||||
public AlarmEntry getEntry(BUuid bUuid) {
|
||||
for (int i = 0; i < this.entries.size(); ++i) {
|
||||
AlarmEntry alarmEntry = (AlarmEntry)this.entries.get(i);
|
||||
if (!alarmEntry.rec.getUuid().equals((Object)bUuid)) continue;
|
||||
return alarmEntry;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getAckedCount() {
|
||||
return this.ackedCount;
|
||||
}
|
||||
|
||||
public int getUnackedCount() {
|
||||
return this.unackedCount;
|
||||
}
|
||||
|
||||
public int getAckPendingCount() {
|
||||
return this.ackPendingCount;
|
||||
}
|
||||
|
||||
public BAlarmRecord getMostRecentRecord() {
|
||||
return this.mostRecentEntry.rec;
|
||||
}
|
||||
|
||||
public BAlarmRecord getRecord(int n) {
|
||||
return this.getEntry((int)n).rec;
|
||||
}
|
||||
|
||||
public AlarmEntry add(BAlarmRecord bAlarmRecord) {
|
||||
BAbsTime bAbsTime = bAlarmRecord.getTimestamp();
|
||||
AlarmEntry alarmEntry = new AlarmEntry(this, bAlarmRecord);
|
||||
this.entries.add(alarmEntry);
|
||||
if (alarmEntry.rec.isAcknowledged()) {
|
||||
++this.ackedCount;
|
||||
} else if (alarmEntry.rec.getAckState() == BAckState.ackPending) {
|
||||
++this.ackPendingCount;
|
||||
} else {
|
||||
++this.unackedCount;
|
||||
}
|
||||
if (this.mostRecentEntry == null || bAbsTime.isAfter(this.mostRecentEntry.rec.getTimestamp())) {
|
||||
this.mostRecentEntry = alarmEntry;
|
||||
}
|
||||
this.fireModified();
|
||||
return alarmEntry;
|
||||
}
|
||||
|
||||
public void remove(AlarmEntry alarmEntry) {
|
||||
this.entries.remove(alarmEntry);
|
||||
if (alarmEntry.rec.isAcknowledged()) {
|
||||
--this.ackedCount;
|
||||
} else if (alarmEntry.rec.getAckState() == BAckState.ackPending) {
|
||||
--this.ackPendingCount;
|
||||
} else {
|
||||
--this.unackedCount;
|
||||
}
|
||||
if (alarmEntry.rec.getUuid().equals((Object)this.mostRecentEntry.rec.getUuid())) {
|
||||
int n = this.entries.size();
|
||||
this.mostRecentEntry = null;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (this.mostRecentEntry == null) {
|
||||
this.mostRecentEntry = (AlarmEntry)this.entries.get(i);
|
||||
}
|
||||
AlarmEntry alarmEntry2 = (AlarmEntry)this.entries.get(i);
|
||||
if (!alarmEntry2.rec.getTimestamp().isAfter(this.mostRecentEntry.rec.getTimestamp())) continue;
|
||||
this.mostRecentEntry = alarmEntry2;
|
||||
}
|
||||
}
|
||||
this.fireModified();
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
this.entries.clear();
|
||||
this.mostRecentEntry = null;
|
||||
this.ackedCount = 0;
|
||||
this.unackedCount = 0;
|
||||
this.ackPendingCount = 0;
|
||||
this.fireModified();
|
||||
}
|
||||
|
||||
public void sort(ConsoleColumns.Column column, Comparator comparator) {
|
||||
int n = this.entries.size();
|
||||
for (int i = n / 2; i >= 1; i /= 2) {
|
||||
for (int j = i; j < n; ++j) {
|
||||
int n2;
|
||||
AlarmEntry alarmEntry = (AlarmEntry)this.entries.get(j);
|
||||
Object object = column.getValue(alarmEntry.rec);
|
||||
for (n2 = j; n2 >= i && comparator.compare(object, column.getValue(((AlarmEntry)this.entries.get((int)(n2 - i))).rec)) <= 0; n2 -= i) {
|
||||
if (comparator.compare(object, column.getValue(((AlarmEntry)this.entries.get((int)(n2 - i))).rec)) == 0) {
|
||||
BAbsTime bAbsTime = alarmEntry.rec.getTimestamp();
|
||||
BAbsTime bAbsTime2 = ((AlarmEntry)this.entries.get((int)(n2 - i))).rec.getTimestamp();
|
||||
if (!bAbsTime2.isBefore(bAbsTime)) break;
|
||||
this.entries.set(n2, this.entries.get(n2 - i));
|
||||
continue;
|
||||
}
|
||||
this.entries.set(n2, this.entries.get(n2 - i));
|
||||
}
|
||||
this.entries.set(n2, alarmEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.alarm.ui;
|
||||
|
||||
import com.tridium.alarm.ui.BTrayIcon;
|
||||
|
||||
public interface TrayIconListener {
|
||||
public void onTrayIconClicked(BTrayIcon var1);
|
||||
|
||||
public void onTrayIconDoubleClicked(BTrayIcon var1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,391 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.sys.BFoxClientConnection$Interest
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.fox.sys.broker.BFoxStationSpace
|
||||
* com.tridium.workbench.auth.AuthUtil
|
||||
* com.tridium.workbench.auth.CredentialsList
|
||||
* com.tridium.workbench.util.CollectionTableModel
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.Size
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.event.BKeyEvent
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.ui.wizard.WizardModel
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecord;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecordList;
|
||||
import com.tridium.alarm.ui.portal.BHostSelectPane;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.broker.BFoxStationSpace;
|
||||
import com.tridium.workbench.auth.AuthUtil;
|
||||
import com.tridium.workbench.auth.CredentialsList;
|
||||
import com.tridium.workbench.util.CollectionTableModel;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.Size;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.event.BKeyEvent;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.ui.wizard.WizardModel;
|
||||
|
||||
public class AddConsoleWizard
|
||||
extends WizardModel
|
||||
implements BFoxClientConnection.Interest {
|
||||
static UiLexicon lex = new UiLexicon(class$com$tridium$alarm$ui$portal$AddConsoleWizard == null ? (class$com$tridium$alarm$ui$portal$AddConsoleWizard = AddConsoleWizard.class$("com.tridium.alarm.ui.portal.AddConsoleWizard")) : class$com$tridium$alarm$ui$portal$AddConsoleWizard);
|
||||
static UiLexicon uiLex = UiLexicon.bajaui;
|
||||
static BImage banner = BImage.make((String)"module://bajaui/com/tridium/ui/images/wizard/wizardShortcut.png");
|
||||
int currentStep = 0;
|
||||
BWidget step0;
|
||||
BWidget step1;
|
||||
boolean edit = false;
|
||||
boolean online = true;
|
||||
BHostSelectPane openPane;
|
||||
BTable acTable;
|
||||
BOrd consoleOrd;
|
||||
CollectionTableModel acTableModel;
|
||||
BTextField offlineOrdField;
|
||||
BICredentials credentials;
|
||||
BConsoleRecordList list;
|
||||
BOrd ord;
|
||||
String station;
|
||||
BOrd hostOrd;
|
||||
int port;
|
||||
boolean useFoxs;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$AddConsoleWizard;
|
||||
|
||||
public AddConsoleWizard(BConsoleRecordList bConsoleRecordList) {
|
||||
this.list = bConsoleRecordList;
|
||||
this.buildStep0();
|
||||
}
|
||||
|
||||
public AddConsoleWizard(BConsoleRecordList bConsoleRecordList, BOrd bOrd, int n, boolean bl, BOrd bOrd2) {
|
||||
this.list = bConsoleRecordList;
|
||||
this.hostOrd = bOrd;
|
||||
this.port = n;
|
||||
this.consoleOrd = bOrd2;
|
||||
this.useFoxs = false;
|
||||
this.edit = true;
|
||||
this.openPane = new BHostSelectPane(bOrd, n, bl);
|
||||
this.step0 = this.openPane;
|
||||
}
|
||||
|
||||
private void buildStep0() {
|
||||
this.openPane = new BHostSelectPane();
|
||||
this.step0 = this.openPane;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
private void buildStep1() throws Exception {
|
||||
boolean bl;
|
||||
BUsernameAndPassword bUsernameAndPassword;
|
||||
BFoxSession bFoxSession = null;
|
||||
this.port = 1911;
|
||||
this.useFoxs = false;
|
||||
try {
|
||||
this.credentials = this.openPane.getCredentials();
|
||||
bUsernameAndPassword = (BUsernameAndPassword)this.credentials;
|
||||
this.port = this.openPane.getPort();
|
||||
this.useFoxs = this.openPane.getUseFoxs();
|
||||
this.hostOrd = this.openPane.getHostOrd();
|
||||
bl = this.openPane.getRememberCredentials();
|
||||
if (bl) {
|
||||
AuthUtil.saveCredentials((String)this.openPane.getRealm(), (BICredentials)this.credentials);
|
||||
} else {
|
||||
CredentialsList.INSTANCE.remove(this.openPane.getRealm());
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
if (exception.getCause() != null) {
|
||||
exception.getCause().printStackTrace();
|
||||
}
|
||||
BDialog.error((BWidget)this.getWizard(), (String)UiLexicon.bajaui.getText("dialog.error"), (Object)exception.getMessage(), (Throwable)exception);
|
||||
return;
|
||||
}
|
||||
this.getWizard().enterBusy();
|
||||
try {
|
||||
BICredentials bICredentials;
|
||||
String string;
|
||||
String string2;
|
||||
BUsernameAndPassword bUsernameAndPassword2;
|
||||
bUsernameAndPassword = BOrd.make((String)"station:");
|
||||
BHost bHost = (BHost)this.hostOrd.get();
|
||||
bFoxSession = BFoxSession.make((BHost)bHost, (int)this.port, (boolean)this.useFoxs);
|
||||
if (!bFoxSession.isConnected()) {
|
||||
bUsernameAndPassword2 = (BUsernameAndPassword)this.credentials;
|
||||
bFoxSession.setCredentials(this.credentials);
|
||||
bFoxSession.connect();
|
||||
} else {
|
||||
bUsernameAndPassword2 = (BUsernameAndPassword)this.credentials;
|
||||
string2 = bUsernameAndPassword2.getUsername();
|
||||
if (!string2.equals(string = bFoxSession.getUsername())) {
|
||||
Log.getLog((String)"alarm").message(lex.getText("portal.reconnectingAs", new Object[]{string2}));
|
||||
bFoxSession.disconnect();
|
||||
bFoxSession.setCredentials(this.credentials);
|
||||
bFoxSession.connect();
|
||||
} else {
|
||||
bICredentials = bFoxSession.getCredentials();
|
||||
if (bICredentials instanceof BUsernameAndPassword) {
|
||||
if (!bUsernameAndPassword2.getPassword().getValue().equals(((BUsernameAndPassword)bICredentials).getPassword().getValue())) {
|
||||
throw new Exception("Invalid username/password");
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Unsupported credential type for re-validation.");
|
||||
}
|
||||
}
|
||||
}
|
||||
bUsernameAndPassword2 = bUsernameAndPassword.get((BObject)bFoxSession);
|
||||
string2 = (BFoxStationSpace)bUsernameAndPassword2;
|
||||
string = BOrd.make((String)"station:|slot:/|bql:select slotPathOrd from alarm:ConsoleRecipient");
|
||||
bICredentials = (BICollection)string.get((BObject)string2.getRootComponent());
|
||||
this.acTable = new BTable();
|
||||
this.acTable.setController((TableController)new Controller());
|
||||
this.acTableModel = new CollectionTableModel((BICollection)bICredentials, null);
|
||||
this.acTable.setModel((TableModel)this.acTableModel);
|
||||
this.acTable.setSelection(new TableSelection(){
|
||||
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, true);
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
super.select(n2, true);
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray[0], true);
|
||||
}
|
||||
});
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)this.acTable);
|
||||
this.step1 = bEdgePane;
|
||||
this.online = true;
|
||||
if (this.acTableModel.getRowCount() == 1) {
|
||||
TableSelection tableSelection = this.acTable.getSelection();
|
||||
tableSelection.selectAll();
|
||||
this.acTable.setSelection(tableSelection);
|
||||
this.update(5);
|
||||
} else if (this.edit) {
|
||||
TableSelection tableSelection = this.acTable.getSelection();
|
||||
for (int i = 0; i < this.acTableModel.getRowCount(); ++i) {
|
||||
if (!this.acTableModel.getValueAt(i, 0).equals(this.consoleOrd.toString())) continue;
|
||||
tableSelection.select(i);
|
||||
}
|
||||
this.acTable.setSelection(tableSelection);
|
||||
this.update(5);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.online = false;
|
||||
BLabel bLabel = new BLabel(lex.getText("messages.connectionError", new Object[]{this.openPane.getHostOrd()}));
|
||||
BLabel bLabel2 = new BLabel(exception.toString());
|
||||
BLabel bLabel3 = new BLabel(lex.getText("portal.wizard.alarmConsoleOrd"));
|
||||
this.offlineOrdField = this.edit ? new BTextField(this.consoleOrd.toString(), 40) : new BTextField("slot:/", 40);
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.add(null, (BValue)bLabel);
|
||||
bGridPane.add(null, (BValue)bLabel2);
|
||||
bGridPane.add(null, (BValue)new BLabel(""));
|
||||
bGridPane.add(null, (BValue)bLabel3);
|
||||
bGridPane.add(null, (BValue)this.offlineOrdField);
|
||||
this.step1 = bGridPane;
|
||||
}
|
||||
finally {
|
||||
if (bFoxSession != null && !this.openPane.getRealm().equals(bFoxSession.getAuthenticationRealmName())) {
|
||||
if (bl) {
|
||||
AuthUtil.saveCredentials((String)bFoxSession.getAuthenticationRealmName(), (BICredentials)this.credentials);
|
||||
} else {
|
||||
CredentialsList.INSTANCE.remove(bFoxSession.getAuthenticationRealmName());
|
||||
}
|
||||
}
|
||||
this.getWizard().exitBusy();
|
||||
}
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
if (this.edit) {
|
||||
return lex.getText("portal.wizard.editTitle");
|
||||
}
|
||||
return lex.getText("portal.wizard.addTitle");
|
||||
}
|
||||
|
||||
public Size getPreferredSizeOfSteps() {
|
||||
return new Size(360.0, 180.0);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
this.updateTo0();
|
||||
}
|
||||
|
||||
public void back() {
|
||||
switch (this.currentStep) {
|
||||
case 1: {
|
||||
this.updateTo0();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void next() {
|
||||
switch (this.currentStep) {
|
||||
case 0: {
|
||||
this.hostOrd = this.openPane.getHostOrd();
|
||||
this.updateTo1();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean finish() {
|
||||
try {
|
||||
if (!this.online) {
|
||||
this.doit();
|
||||
} else if (this.acTable.getSelection() != null) {
|
||||
this.doit();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateTo0() {
|
||||
this.update(this.step0, 2);
|
||||
this.getWizard().setNextAsDefault();
|
||||
this.currentStep = 0;
|
||||
}
|
||||
|
||||
private void updateTo1() {
|
||||
try {
|
||||
this.buildStep1();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)this.getWizard().getOwner(), (String)"", (Object)exception.toString(), (Throwable)exception);
|
||||
}
|
||||
int n = 1;
|
||||
if (this.acTable != null && this.acTable.getSelection().getRowCount() == 1) {
|
||||
n |= 4;
|
||||
}
|
||||
if (this.step1 != null) {
|
||||
this.update(this.step1, n);
|
||||
this.currentStep = 1;
|
||||
}
|
||||
if (!this.online) {
|
||||
this.update(5);
|
||||
}
|
||||
}
|
||||
|
||||
private void doit() throws Exception {
|
||||
if (this.online) {
|
||||
int[] nArray = this.acTableModel.getSelection().getRows();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
String string = (String)this.acTableModel.getValueAt(nArray[i], 0);
|
||||
BConsoleRecord bConsoleRecord = new BConsoleRecord();
|
||||
bConsoleRecord.setHostOrd(this.hostOrd);
|
||||
bConsoleRecord.setPort(this.port);
|
||||
bConsoleRecord.setUseFoxs(this.useFoxs);
|
||||
bConsoleRecord.setConsoleOrd(BOrd.make((String)string));
|
||||
this.list = BConsoleRecordList.add(this.list, bConsoleRecord);
|
||||
}
|
||||
} else {
|
||||
BConsoleRecord bConsoleRecord = new BConsoleRecord();
|
||||
bConsoleRecord.setHostOrd(this.hostOrd);
|
||||
bConsoleRecord.setPort(this.port);
|
||||
bConsoleRecord.setUseFoxs(this.useFoxs);
|
||||
bConsoleRecord.setConsoleOrd(BOrd.make((String)this.offlineOrdField.getText()));
|
||||
this.list = BConsoleRecordList.add(this.list, bConsoleRecord);
|
||||
}
|
||||
}
|
||||
|
||||
public BConsoleRecordList getConsoleRecordList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Model
|
||||
extends CollectionTableModel {
|
||||
public Model(BICollection bICollection) {
|
||||
super(bICollection, null);
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
String string = super.getValueAt(n, n2).toString();
|
||||
return SlotPath.unescape((String)string);
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
public void keyReleased(BKeyEvent bKeyEvent) {
|
||||
super.keyReleased(bKeyEvent);
|
||||
this.updateFinish();
|
||||
}
|
||||
|
||||
public void mouseReleased(BMouseEvent bMouseEvent) {
|
||||
super.mouseReleased(bMouseEvent);
|
||||
this.updateFinish();
|
||||
}
|
||||
|
||||
private void updateFinish() {
|
||||
if (AddConsoleWizard.this.acTable.getSelection().getRowCount() == 1) {
|
||||
AddConsoleWizard.this.update(5);
|
||||
} else {
|
||||
AddConsoleWizard.this.update(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,597 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.workbench.shell.BNiagaraWbShell
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.status.BStatus
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponentEvent
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.Subscriber
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BCheckBox
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.enums.BOrientation
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.pane.BSplitPane
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DefaultTableModel
|
||||
* javax.baja.ui.table.TableCellRenderer
|
||||
* javax.baja.ui.table.TableCellRenderer$Cell
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.util.BTitlePane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.ui.wizard.BWizard
|
||||
* javax.baja.ui.wizard.WizardModel
|
||||
* javax.baja.workbench.view.BWbView
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.portal.AddConsoleWizard;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalTool;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecord;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecordList;
|
||||
import com.tridium.alarm.ui.portal.BPortalAlarmConsole;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.workbench.shell.BNiagaraWbShell;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.status.BStatus;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponentEvent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Subscriber;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BCheckBox;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.enums.BOrientation;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.pane.BSplitPane;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DefaultTableModel;
|
||||
import javax.baja.ui.table.TableCellRenderer;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.ui.util.BTitlePane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.ui.wizard.BWizard;
|
||||
import javax.baja.ui.wizard.WizardModel;
|
||||
import javax.baja.workbench.view.BWbView;
|
||||
|
||||
public class BAlarmPortal
|
||||
extends BWbView {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BAlarmPortal == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortal = BAlarmPortal.class$("com.tridium.alarm.ui.portal.BAlarmPortal")) : class$com$tridium$alarm$ui$portal$BAlarmPortal));
|
||||
private ConsoleRecipientSubscriber subscriber;
|
||||
BGridPane controlPane;
|
||||
ToggleCommand trayIconEnabled;
|
||||
ToggleCommand alarmPopupEnabled;
|
||||
ToggleCommand alarmPopupAlwaysOnTop;
|
||||
ToggleCommand alarmPopupUncloseable;
|
||||
Command addCommand;
|
||||
BButton startButton;
|
||||
BButton stopButton;
|
||||
BCheckBox autoStart;
|
||||
public static final UiLexicon lexicon = new UiLexicon(class$com$tridium$alarm$ui$portal$BAlarmPortal == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortal = BAlarmPortal.class$("com.tridium.alarm.ui.portal.BAlarmPortal")) : class$com$tridium$alarm$ui$portal$BAlarmPortal);
|
||||
public static final Log log = Log.getLog((String)"alarm");
|
||||
BAlarmPortalTool tool;
|
||||
BPortalAlarmConsole console;
|
||||
BTable acMonitor = new BTable();
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BAlarmPortal;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmPortal() throws Exception {
|
||||
this.acMonitor.setController((TableController)new MonitorController());
|
||||
this.acMonitor.setModel((TableModel)new MonitorModel());
|
||||
this.acMonitor.setCellRenderer((TableCellRenderer)new MonitorCellRenderer());
|
||||
this.acMonitor.setSelection(new TableSelection(){
|
||||
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, true);
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
super.select(n2, true);
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray[0], true);
|
||||
}
|
||||
});
|
||||
BSplitPane bSplitPane = new BSplitPane(BOrientation.vertical, 20.0);
|
||||
bSplitPane.setWidget1((BWidget)BTitlePane.makePane((String)lexicon.getText("portal.alarmConsoleMonitor"), (BTable)this.acMonitor, (String)"Consoles"));
|
||||
this.console = new BPortalAlarmConsole();
|
||||
bSplitPane.setWidget2((BWidget)this.console);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)bSplitPane);
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) throws Exception {
|
||||
this.tool = (BAlarmPortalTool)bObject;
|
||||
this.trayIconEnabled = new ToggleCommand((BWidget)this.getWbShell(), BAlarmPortal.lexicon.module, "commands.trayIconEnabled"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmPortal.this.tool.options.setTrayIconEnabled(this.isSelected());
|
||||
BAlarmPortal.this.tool.updateTrayIcon(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.trayIconEnabled.setSelected(this.tool.options.getTrayIconEnabled());
|
||||
this.alarmPopupEnabled = new ToggleCommand((BWidget)this.getWbShell(), BAlarmPortal.lexicon.module, "commands.alarmPopupEnabled"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmPortal.this.tool.options.setAlarmPopupEnabled(this.isSelected());
|
||||
BAlarmPortal.this.alarmPopupAlwaysOnTop.setEnabled(this.isSelected());
|
||||
BAlarmPortal.this.alarmPopupUncloseable.setEnabled(this.isSelected());
|
||||
if (this.isSelected()) {
|
||||
BAlarmPortal.this.tool.showAlarmDialog(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm(), BAlarmPortal.this.console.getMostRecentRecord());
|
||||
} else {
|
||||
BAlarmPortal.this.tool.closeAlarmDialog();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.alarmPopupEnabled.setSelected(this.tool.options.getAlarmPopupEnabled());
|
||||
this.alarmPopupAlwaysOnTop = new ToggleCommand((BWidget)this.getWbShell(), BAlarmPortal.lexicon.module, "commands.alarmPopupAlwaysOnTop"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmPortal.this.tool.options.setAlarmPopupAlwaysOnTop(this.isSelected());
|
||||
if (BAlarmPortalTool.alarmDialog != null) {
|
||||
BAlarmPortalTool.alarmDialog.setAlwaysOnTop(this.isSelected());
|
||||
}
|
||||
BAlarmPortal.this.tool.showAlarmDialog(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm(), null);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.alarmPopupAlwaysOnTop.setEnabled(this.alarmPopupEnabled.isSelected());
|
||||
this.alarmPopupAlwaysOnTop.setSelected(this.tool.options.getAlarmPopupAlwaysOnTop());
|
||||
this.alarmPopupUncloseable = new ToggleCommand((BWidget)this.getWbShell(), BAlarmPortal.lexicon.module, "commands.alarmPopupUncloseable"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmPortal.this.tool.options.setAlarmPopupUncloseable(this.isSelected());
|
||||
if (BAlarmPortalTool.alarmDialog != null) {
|
||||
BAlarmPortalTool.alarmDialog.setUncloseable(this.isSelected());
|
||||
}
|
||||
BAlarmPortal.this.tool.showAlarmDialog(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm(), null);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.alarmPopupUncloseable.setEnabled(this.alarmPopupEnabled.isSelected());
|
||||
this.alarmPopupUncloseable.setSelected(this.tool.options.getAlarmPopupUncloseable());
|
||||
this.addCommand = new Command((BWidget)this.getWbShell(), BAlarmPortal.lexicon.module, "commands.add"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BAlarmPortal.this.addConsoleRecipient();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
BConsoleRecordList bConsoleRecordList = this.tool.options.getConsoleList();
|
||||
for (int i = 0; i < bConsoleRecordList.size(); ++i) {
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(i);
|
||||
((MonitorModel)this.acMonitor.getModel()).addConsoleRecord(bConsoleRecord);
|
||||
}
|
||||
this.tool.viewActivated();
|
||||
new LoadThread().start();
|
||||
}
|
||||
|
||||
public void deactivated() {
|
||||
this.tool.viewDeactivated();
|
||||
super.deactivated();
|
||||
if (this.subscriber != null) {
|
||||
this.subscriber.unsubscribeAll();
|
||||
}
|
||||
}
|
||||
|
||||
public BMenu[] getViewMenus() {
|
||||
BMenu[] bMenuArray = this.console.getViewMenus();
|
||||
bMenuArray[0].add("portalSep", (BValue)new BSeparator());
|
||||
bMenuArray[0].add("addConsole", this.addCommand);
|
||||
bMenuArray[0].add("portalSep2", (BValue)new BSeparator());
|
||||
bMenuArray[0].add("trayIconEnabled", (Command)this.trayIconEnabled);
|
||||
bMenuArray[0].add("alarmPopupEnabled", (Command)this.alarmPopupEnabled);
|
||||
bMenuArray[0].add("alarmPopupAlwaysOnTop", (Command)this.alarmPopupAlwaysOnTop);
|
||||
bMenuArray[0].add("alarmPopupUncloseable", (Command)this.alarmPopupUncloseable);
|
||||
return bMenuArray;
|
||||
}
|
||||
|
||||
public BToolBar getViewToolBar() {
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add("addConsole", this.addCommand);
|
||||
return bToolBar;
|
||||
}
|
||||
|
||||
private void addConsoleRecipient() {
|
||||
BConsoleRecordList bConsoleRecordList = this.tool.options.getConsoleList();
|
||||
int n = bConsoleRecordList.size();
|
||||
AddConsoleWizard addConsoleWizard = new AddConsoleWizard(bConsoleRecordList);
|
||||
BWizard.open((BWidget)this.getWbShell(), (WizardModel)addConsoleWizard);
|
||||
bConsoleRecordList = addConsoleWizard.getConsoleRecordList();
|
||||
int n2 = bConsoleRecordList.size() - n;
|
||||
if (n2 > 0) {
|
||||
this.tool.options.setConsoleList(bConsoleRecordList);
|
||||
this.tool.options.save();
|
||||
for (int i = n2; i > 0; --i) {
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(bConsoleRecordList.size() - i);
|
||||
((MonitorModel)this.acMonitor.getModel()).addConsoleRecord(bConsoleRecord);
|
||||
this.connect(bConsoleRecord, bConsoleRecordList.size() - i);
|
||||
}
|
||||
this.acMonitor.sizeColumnsToFit();
|
||||
this.acMonitor.getModel().updateTable();
|
||||
}
|
||||
}
|
||||
|
||||
void connect(BConsoleRecord bConsoleRecord, int n) {
|
||||
BAbsTime bAbsTime = (BAbsTime)this.acMonitor.getModel().getValueAt(n, 5);
|
||||
ConnectThread connectThread = new ConnectThread(bConsoleRecord, n, bAbsTime);
|
||||
connectThread.start();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class MonitorCellRenderer
|
||||
extends TableCellRenderer {
|
||||
int i = -1;
|
||||
|
||||
MonitorCellRenderer() {
|
||||
}
|
||||
|
||||
public BBrush getBackground(TableCellRenderer.Cell cell) {
|
||||
boolean bl;
|
||||
BOrd bOrd = (BOrd)this.getTable().getModel().getValueAt(cell.row, 0);
|
||||
Integer n = (Integer)this.getTable().getModel().getValueAt(cell.row, 1);
|
||||
BBoolean bBoolean = (BBoolean)this.getTable().getModel().getValueAt(cell.row, 2);
|
||||
BOrd bOrd2 = (BOrd)this.getTable().getModel().getValueAt(cell.row, 3);
|
||||
BConsoleRecipient bConsoleRecipient = bBoolean.getBoolean() ? (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bOrd + "|foxs:" + n + "|station:|" + bOrd2)) : (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bOrd + "|fox:" + n + "|station:|" + bOrd2));
|
||||
boolean bl2 = bl = bConsoleRecipient != null && bConsoleRecipient.isMounted();
|
||||
if (!bl) {
|
||||
if (BAlarmPortal.this.console != null && BAlarmPortal.this.tool != null) {
|
||||
BAlarmPortal.this.tool.updateTrayIcon(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm());
|
||||
BAlarmPortal.this.tool.showAlarmDialog(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm(), null);
|
||||
}
|
||||
return BBrush.makeSolid((BColor)((BColor)BStatus.downBg));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class MonitorController
|
||||
extends TableController {
|
||||
MonitorController() {
|
||||
}
|
||||
|
||||
public void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
Command command = new Command((BWidget)BAlarmPortal.this.getWbShell(), BAlarmPortal.lexicon.module, "commands.connect"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n = MonitorController.this.getTable().getSelection().getRow();
|
||||
BAbsTime bAbsTime = (BAbsTime)MonitorController.this.getTable().getModel().getValueAt(n, 5);
|
||||
BConsoleRecord bConsoleRecord = ((MonitorModel)MonitorController.this.getTable().getModel()).getConsoleEntry(n);
|
||||
try {
|
||||
((MonitorController)MonitorController.this).BAlarmPortal.this.tool.connectToServer((BWidget)BAlarmPortal.this, bConsoleRecord);
|
||||
BConsoleRecipient bConsoleRecipient = ((MonitorController)MonitorController.this).BAlarmPortal.this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
BOrd bOrd = bConsoleRecord.getUseFoxs() ? BOrd.make((BOrd)bConsoleRecord.getHostOrd(), (String)("foxs:" + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd().toString())) : BOrd.make((BOrd)bConsoleRecord.getHostOrd(), (String)("fox:" + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd().toString()));
|
||||
String string = ((MonitorController)MonitorController.this).BAlarmPortal.this.console.channel(bConsoleRecipient).getInitialAlarmQuery(((MonitorController)MonitorController.this).BAlarmPortal.this.console, bConsoleRecipient, bOrd).toString();
|
||||
BOrd bOrd2 = BOrd.make((String)(string + " and timestamp >= AbsTime '" + bAbsTime.encodeToString() + "'"));
|
||||
BICollection bICollection = (BICollection)bOrd2.get((BObject)bConsoleRecipient);
|
||||
((MonitorModel)MonitorController.this.getTable().getModel()).set(n, 5, BAbsTime.now());
|
||||
Cursor cursor = bICollection.cursor();
|
||||
BPortalAlarmConsole.SourceModCursor sourceModCursor = new BPortalAlarmConsole.SourceModCursor(bOrd, cursor);
|
||||
while (sourceModCursor.next()) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)sourceModCursor.get();
|
||||
((MonitorController)MonitorController.this).BAlarmPortal.this.console.processAlarm(bAlarmRecord);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BAlarmPortal.this, (String)lexicon.getText("alarm.connectFailed"), (Object)lexicon.getText("messages.connectionError", new Object[]{bConsoleRecord.getHostOrd()}), (Throwable)exception);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command2 = new Command((BWidget)BAlarmPortal.this.getWbShell(), BAlarmPortal.lexicon.module, "commands.disconnect"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
int n = MonitorController.this.getTable().getSelection().getRow();
|
||||
BConsoleRecord bConsoleRecord = ((MonitorModel)MonitorController.this.getTable().getModel()).getConsoleEntry(n);
|
||||
BConsoleRecipient bConsoleRecipient = bConsoleRecord.getUseFoxs() ? (BConsoleRecipient)((Object)((MonitorController)MonitorController.this).BAlarmPortal.this.tool.recipients.get(bConsoleRecord.getHostOrd() + "|foxs:" + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd())) : (BConsoleRecipient)((Object)((MonitorController)MonitorController.this).BAlarmPortal.this.tool.recipients.get(bConsoleRecord.getHostOrd() + "|fox:" + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd()));
|
||||
if (bConsoleRecipient != null && bConsoleRecipient.getSession() != null) {
|
||||
((BFoxSession)bConsoleRecipient.getSession()).disconnect();
|
||||
}
|
||||
((MonitorModel)MonitorController.this.getTable().getModel()).set(n, 5, BAbsTime.now());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
log.error("Cannot disconnect: " + exception);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command3 = new Command((BWidget)BAlarmPortal.this.getWbShell(), BAlarmPortal.lexicon.module, "commands.edit"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
MonitorController.this.editConsoleRecipient();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command4 = new Command((BWidget)BAlarmPortal.this.getWbShell(), BAlarmPortal.lexicon.module, "commands.remove"){
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
MonitorController.this.deleteConsoleRecipient();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Command command5 = null;
|
||||
command5 = this.getTable().getModel().getValueAt(n, 4).toString().equals(lexicon.getText("portal.connected")) ? command2 : command;
|
||||
BMenu bMenu = new BMenu();
|
||||
bMenu.add("connect", command5);
|
||||
bMenu.add("sep", (BValue)new BSeparator());
|
||||
bMenu.add("edit", command3);
|
||||
bMenu.add("remove", command4);
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void backgroundPopup(BMouseEvent bMouseEvent) {
|
||||
BMenu bMenu = new BMenu();
|
||||
bMenu.add("add", BAlarmPortal.this.addCommand);
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
private void editConsoleRecipient() {
|
||||
int n = this.getTable().getSelection().getRow();
|
||||
BOrd bOrd = (BOrd)this.getTable().getModel().getValueAt(n, 0);
|
||||
int n2 = (Integer)this.getTable().getModel().getValueAt(n, 1);
|
||||
boolean bl = ((BBoolean)this.getTable().getModel().getValueAt(n, 2)).getBoolean();
|
||||
BOrd bOrd2 = (BOrd)this.getTable().getModel().getValueAt(n, 3);
|
||||
int n3 = BAlarmPortal.this.acMonitor.getModel().getRowCount();
|
||||
BConsoleRecordList bConsoleRecordList = BAlarmPortal.this.tool.options.getConsoleList();
|
||||
int n4 = bConsoleRecordList.size();
|
||||
AddConsoleWizard addConsoleWizard = new AddConsoleWizard(bConsoleRecordList, bOrd, n2, bl, bOrd2);
|
||||
BWizard.open((BWidget)BAlarmPortal.this.getWbShell(), (WizardModel)addConsoleWizard);
|
||||
bConsoleRecordList = addConsoleWizard.getConsoleRecordList();
|
||||
int n5 = bConsoleRecordList.size() - n4;
|
||||
if (n5 > 0) {
|
||||
BAlarmPortal.this.tool.options.setConsoleList(bConsoleRecordList);
|
||||
BAlarmPortal.this.tool.options.save();
|
||||
for (int i = n5; i > 0; --i) {
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(bConsoleRecordList.size() - i);
|
||||
((MonitorModel)BAlarmPortal.this.acMonitor.getModel()).addConsoleRecord(bConsoleRecord);
|
||||
}
|
||||
BAlarmPortal.this.acMonitor.sizeColumnsToFit();
|
||||
BAlarmPortal.this.acMonitor.getModel().updateTable();
|
||||
}
|
||||
if (BAlarmPortal.this.acMonitor.getModel().getRowCount() > n3) {
|
||||
this.deleteConsoleRecipient();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteConsoleRecipient() {
|
||||
int[] nArray = this.getTable().getSelection().getRows();
|
||||
nArray = this.sort(nArray);
|
||||
BConsoleRecord[] bConsoleRecordArray = new BConsoleRecord[nArray.length];
|
||||
for (int i = nArray.length - 1; i >= 0; --i) {
|
||||
bConsoleRecordArray[i] = ((MonitorModel)this.getTable().getModel()).getConsoleEntry(nArray[i]);
|
||||
BConsoleRecipient bConsoleRecipient = bConsoleRecordArray[i].getUseFoxs() ? (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bConsoleRecordArray[i].getHostOrd() + "|foxs:" + bConsoleRecordArray[i].getPort() + "|station:|" + bConsoleRecordArray[i].getConsoleOrd())) : (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bConsoleRecordArray[i].getHostOrd() + "|fox:" + bConsoleRecordArray[i].getPort() + "|station:|" + bConsoleRecordArray[i].getConsoleOrd()));
|
||||
if (bConsoleRecipient != null && bConsoleRecipient.getSession() != null) {
|
||||
((BFoxSession)bConsoleRecipient.getSession()).disconnect();
|
||||
}
|
||||
BAlarmPortal.this.console.removeAlarmsFrom(bConsoleRecordArray[i]);
|
||||
}
|
||||
BConsoleRecordList bConsoleRecordList = BAlarmPortal.this.tool.options.getConsoleList();
|
||||
for (int i = nArray.length - 1; i >= 0; --i) {
|
||||
bConsoleRecordList = BConsoleRecordList.remove(bConsoleRecordList, nArray[i]);
|
||||
((MonitorModel)this.getTable().getModel()).removeConsoleRecordAt(nArray[i]);
|
||||
}
|
||||
BAlarmPortal.this.tool.options.setConsoleList(bConsoleRecordList);
|
||||
BAlarmPortal.this.tool.options.save();
|
||||
((MonitorModel)this.getTable().getModel()).updateTable();
|
||||
this.getTable().sizeColumnsToFit();
|
||||
BAlarmPortal.this.tool.showAlarmDialog(BAlarmPortal.this.console.getAckedAlarmCount(), BAlarmPortal.this.console.getUnackedAlarmCount(), BAlarmPortal.this.console.sourcesInAlarm(), null);
|
||||
}
|
||||
|
||||
private int[] sort(int[] nArray) {
|
||||
for (int i = nArray.length - 1; i >= 0; --i) {
|
||||
for (int j = 1; j <= i; ++j) {
|
||||
if (nArray[j - 1] <= nArray[j]) continue;
|
||||
int n = nArray[j - 1];
|
||||
nArray[j - 1] = nArray[j];
|
||||
nArray[j] = n;
|
||||
}
|
||||
}
|
||||
return nArray;
|
||||
}
|
||||
}
|
||||
|
||||
class MonitorModel
|
||||
extends DefaultTableModel {
|
||||
ArrayList entries;
|
||||
Hashtable wasConnectedList = new Hashtable();
|
||||
|
||||
public MonitorModel() {
|
||||
super(new String[]{lexicon.getText("portal.station"), lexicon.getText("portal.port"), lexicon.getText("auth.foxs"), lexicon.getText("portal.consoleOrd"), lexicon.getText("portal.status"), lexicon.getText("portal.lastConnectTime"), lexicon.getText("portal.lastDisconnectTime")});
|
||||
this.entries = new ArrayList();
|
||||
}
|
||||
|
||||
public void addConsoleRecord(BConsoleRecord bConsoleRecord) {
|
||||
this.entries.add(bConsoleRecord);
|
||||
Object[] objectArray = new Object[]{bConsoleRecord.getHostOrd(), new Integer(bConsoleRecord.getPort()), BBoolean.make((boolean)bConsoleRecord.getUseFoxs()), bConsoleRecord.getConsoleOrd(), lexicon.getText("portal.notConnected"), BAbsTime.NULL, BAbsTime.NULL};
|
||||
this.addRow(null, objectArray);
|
||||
}
|
||||
|
||||
public void removeConsoleRecordAt(int n) {
|
||||
this.removeRow(n);
|
||||
BConsoleRecord bConsoleRecord = (BConsoleRecord)((Object)this.entries.remove(n));
|
||||
if (bConsoleRecord != null) {
|
||||
String string = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bConsoleRecord.getHostOrd() + string + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd()));
|
||||
if (bConsoleRecipient != null && BAlarmPortal.this.subscriber != null) {
|
||||
BAlarmPortal.this.subscriber.unsubscribe(bConsoleRecipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BConsoleRecord getConsoleEntry(int n) {
|
||||
return (BConsoleRecord)((Object)this.entries.get(n));
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
if (n2 == 4) {
|
||||
boolean bl;
|
||||
BOrd bOrd = (BOrd)this.getTable().getModel().getValueAt(n, 0);
|
||||
Integer n3 = (Integer)this.getTable().getModel().getValueAt(n, 1);
|
||||
BBoolean bBoolean = (BBoolean)this.getTable().getModel().getValueAt(n, 2);
|
||||
BOrd bOrd2 = (BOrd)this.getTable().getModel().getValueAt(n, 3);
|
||||
String string = bBoolean.getBoolean() ? "|foxs:" : "|fox:";
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)BAlarmPortal.this.tool.recipients.get(bOrd + string + n3 + "|station:|" + bOrd2));
|
||||
Boolean bl2 = new Boolean(false);
|
||||
if (bConsoleRecipient == null) {
|
||||
return lexicon.getText("portal.notConnected");
|
||||
}
|
||||
bl2 = (Boolean)this.wasConnectedList.get((Object)bConsoleRecipient);
|
||||
boolean bl3 = bl2 != null ? bl2 : false;
|
||||
boolean bl4 = bl = bConsoleRecipient != null && bConsoleRecipient.isMounted();
|
||||
if (bl3 && !bl) {
|
||||
this.set(n, 6, BAbsTime.now());
|
||||
} else if (!bl3 && bl) {
|
||||
BConsoleRecord bConsoleRecord = ((MonitorModel)this.getTable().getModel()).getConsoleEntry(n);
|
||||
BAlarmPortal.this.connect(bConsoleRecord, n);
|
||||
this.set(n, 5, BAbsTime.now());
|
||||
}
|
||||
this.wasConnectedList.put(bConsoleRecipient, new Boolean(bl));
|
||||
return bl ? lexicon.getText("portal.connected") : lexicon.getText("portal.notConnected");
|
||||
}
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
}
|
||||
|
||||
private class ConsoleRecipientSubscriber
|
||||
extends Subscriber {
|
||||
private ConsoleRecipientSubscriber() {
|
||||
}
|
||||
|
||||
public void event(BComponentEvent bComponentEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
class ConnectThread
|
||||
extends Thread {
|
||||
BConsoleRecord rec;
|
||||
int currentRow;
|
||||
BAbsTime sinceTime;
|
||||
|
||||
ConnectThread(BConsoleRecord bConsoleRecord, int n, BAbsTime bAbsTime) {
|
||||
super("alarm: Portal Reconnect");
|
||||
this.rec = bConsoleRecord;
|
||||
this.currentRow = n;
|
||||
this.sinceTime = bAbsTime;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
BAlarmPortal.this.tool.connectToServer((BWidget)BAlarmPortal.this, this.rec);
|
||||
BConsoleRecipient bConsoleRecipient = BAlarmPortal.this.tool.getRecipientForRecord(this.rec);
|
||||
if (BAlarmPortal.this.subscriber == null) {
|
||||
BAlarmPortal.this.subscriber = new ConsoleRecipientSubscriber();
|
||||
}
|
||||
BAlarmPortal.this.subscriber.subscribe(bConsoleRecipient);
|
||||
String string = this.rec.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
BOrd bOrd = BOrd.make((String)(this.rec.getHostOrd() + string + this.rec.getPort() + "|station:|" + this.rec.getConsoleOrd()));
|
||||
String string2 = BAlarmPortal.this.console.channel(bConsoleRecipient).getInitialAlarmQuery(BAlarmPortal.this.console, bConsoleRecipient, bOrd).toString();
|
||||
boolean bl = this.sinceTime.isNull();
|
||||
BOrd bOrd2 = bl ? BOrd.make((String)string2) : BOrd.make((String)(string2 + " and timestamp >= AbsTime '" + this.sinceTime.encodeToString() + "'"));
|
||||
BICollection bICollection = (BICollection)bOrd2.get((BObject)bConsoleRecipient);
|
||||
((MonitorModel)BAlarmPortal.this.acMonitor.getModel()).set(this.currentRow, 5, BAbsTime.now());
|
||||
Cursor cursor = bICollection.cursor();
|
||||
BPortalAlarmConsole.SourceModCursor sourceModCursor = new BPortalAlarmConsole.SourceModCursor(bOrd, cursor);
|
||||
int n = 0;
|
||||
while (sourceModCursor.next()) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)sourceModCursor.get();
|
||||
BAlarmPortal.this.console.doProcessAlarm(bAlarmRecord);
|
||||
++n;
|
||||
}
|
||||
this.rec.setInitialLoadComplete(true);
|
||||
BAlarmPortal.this.console.init();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
String string = this.rec.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
log.error("Cannot connect to: " + this.rec.getHostOrd() + string + this.rec.getPort() + "|station:|" + this.rec.getConsoleOrd() + " : ", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LoadThread
|
||||
extends Thread {
|
||||
LoadThread() {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
BAlarmPortal.this.console.loadValue((BObject)BAlarmPortal.this.tool);
|
||||
BAlarmPortal.this.tool.connect((BWidget)BAlarmPortal.this);
|
||||
try {
|
||||
BNiagaraWbShell bNiagaraWbShell = (BNiagaraWbShell)BAlarmPortal.this.getWbShell();
|
||||
bNiagaraWbShell.pane.update(bNiagaraWbShell.tab());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
int n = BAlarmPortal.this.console.getAckedAlarmCount();
|
||||
int n2 = BAlarmPortal.this.console.getUnackedAlarmCount();
|
||||
BAlarmPortal.this.tool.showAlarmDialog(n, n2, BAlarmPortal.this.console.sourcesInAlarm(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.util.BDynamicTimeRange
|
||||
* javax.baja.gx.BPoint
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.options.BUserOptions
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecordList;
|
||||
import com.tridium.bql.util.BDynamicTimeRange;
|
||||
import javax.baja.gx.BPoint;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.options.BUserOptions;
|
||||
|
||||
public class BAlarmPortalOptions
|
||||
extends BUserOptions {
|
||||
public static final Property consoleList = BAlarmPortalOptions.newProperty((int)4, (BValue)BConsoleRecordList.DEFAULT, null);
|
||||
public static final Property trayIconEnabled = BAlarmPortalOptions.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property alarmPopupEnabled = BAlarmPortalOptions.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property alarmPopupAlwaysOnTop = BAlarmPortalOptions.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property alarmPopupUncloseable = BAlarmPortalOptions.newProperty((int)0, (boolean)true, null);
|
||||
public static final Property popupPosition = BAlarmPortalOptions.newProperty((int)4, (BValue)BPoint.make((double)0.0, (double)0.0), null);
|
||||
public static final Property kioskMode = BAlarmPortalOptions.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property reconnectInterval = BAlarmPortalOptions.newProperty((int)0, (BValue)BRelTime.make((long)120000L), null);
|
||||
public static final Property defaultTimeRange = BAlarmPortalOptions.newProperty((int)0, (BValue)BDynamicTimeRange.TODAY, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BAlarmPortalOptions == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortalOptions = BAlarmPortalOptions.class$("com.tridium.alarm.ui.portal.BAlarmPortalOptions")) : class$com$tridium$alarm$ui$portal$BAlarmPortalOptions));
|
||||
private static BAlarmPortalOptions options;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BAlarmPortalOptions;
|
||||
|
||||
public BConsoleRecordList getConsoleList() {
|
||||
return (BConsoleRecordList)this.get(consoleList);
|
||||
}
|
||||
|
||||
public void setConsoleList(BConsoleRecordList bConsoleRecordList) {
|
||||
this.set(consoleList, (BValue)bConsoleRecordList, null);
|
||||
}
|
||||
|
||||
public boolean getTrayIconEnabled() {
|
||||
return this.getBoolean(trayIconEnabled);
|
||||
}
|
||||
|
||||
public void setTrayIconEnabled(boolean bl) {
|
||||
this.setBoolean(trayIconEnabled, bl, null);
|
||||
}
|
||||
|
||||
public boolean getAlarmPopupEnabled() {
|
||||
return this.getBoolean(alarmPopupEnabled);
|
||||
}
|
||||
|
||||
public void setAlarmPopupEnabled(boolean bl) {
|
||||
this.setBoolean(alarmPopupEnabled, bl, null);
|
||||
}
|
||||
|
||||
public boolean getAlarmPopupAlwaysOnTop() {
|
||||
return this.getBoolean(alarmPopupAlwaysOnTop);
|
||||
}
|
||||
|
||||
public void setAlarmPopupAlwaysOnTop(boolean bl) {
|
||||
this.setBoolean(alarmPopupAlwaysOnTop, bl, null);
|
||||
}
|
||||
|
||||
public boolean getAlarmPopupUncloseable() {
|
||||
return this.getBoolean(alarmPopupUncloseable);
|
||||
}
|
||||
|
||||
public void setAlarmPopupUncloseable(boolean bl) {
|
||||
this.setBoolean(alarmPopupUncloseable, bl, null);
|
||||
}
|
||||
|
||||
public BPoint getPopupPosition() {
|
||||
return (BPoint)this.get(popupPosition);
|
||||
}
|
||||
|
||||
public void setPopupPosition(BPoint bPoint) {
|
||||
this.set(popupPosition, (BValue)bPoint, null);
|
||||
}
|
||||
|
||||
public boolean getKioskMode() {
|
||||
return this.getBoolean(kioskMode);
|
||||
}
|
||||
|
||||
public void setKioskMode(boolean bl) {
|
||||
this.setBoolean(kioskMode, bl, null);
|
||||
}
|
||||
|
||||
public BRelTime getReconnectInterval() {
|
||||
return (BRelTime)this.get(reconnectInterval);
|
||||
}
|
||||
|
||||
public void setReconnectInterval(BRelTime bRelTime) {
|
||||
this.set(reconnectInterval, (BValue)bRelTime, null);
|
||||
}
|
||||
|
||||
public BDynamicTimeRange getDefaultTimeRange() {
|
||||
return (BDynamicTimeRange)this.get(defaultTimeRange);
|
||||
}
|
||||
|
||||
public void setDefaultTimeRange(BDynamicTimeRange bDynamicTimeRange) {
|
||||
this.set(defaultTimeRange, (BValue)bDynamicTimeRange, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BAlarmPortalOptions getDefault() {
|
||||
if (options == null) {
|
||||
options = (BAlarmPortalOptions)BAlarmPortalOptions.load((Type)TYPE);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.UiEnv
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.registry.TypeInfo
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BMenuBar
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidgetShell
|
||||
* javax.baja.workbench.BWbLocatorBar
|
||||
* javax.baja.workbench.BWbProfile
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalOptions;
|
||||
import com.tridium.ui.UiEnv;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.registry.TypeInfo;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BMenuBar;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidgetShell;
|
||||
import javax.baja.workbench.BWbLocatorBar;
|
||||
import javax.baja.workbench.BWbProfile;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public class BAlarmPortalProfile
|
||||
extends BWbProfile {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BAlarmPortalProfile == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortalProfile = BAlarmPortalProfile.class$("com.tridium.alarm.ui.portal.BAlarmPortalProfile")) : class$com$tridium$alarm$ui$portal$BAlarmPortalProfile));
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BAlarmPortalProfile;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmPortalProfile(BWbShell bWbShell) {
|
||||
super(bWbShell);
|
||||
BAlarmPortalOptions bAlarmPortalOptions = BAlarmPortalOptions.getDefault();
|
||||
if (bAlarmPortalOptions.getKioskMode()) {
|
||||
UiEnv.get().setKiosk((BWidgetShell)bWbShell);
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd getStartOrd() {
|
||||
return BOrd.make((String)"tool:alarm:AlarmPortalTool|slot:/");
|
||||
}
|
||||
|
||||
public BOrd getHomeOrd() {
|
||||
return this.getStartOrd();
|
||||
}
|
||||
|
||||
public BMenuBar makeMenuBar() {
|
||||
BMenuBar bMenuBar = super.makeMenuBar();
|
||||
BMenu bMenu = (BMenu)bMenuBar.get("file");
|
||||
bMenu.remove("open");
|
||||
bMenu.remove("save");
|
||||
bMenu.remove("saveBog");
|
||||
bMenu.remove("saveAll");
|
||||
bMenu.remove("export");
|
||||
bMenuBar.remove("search");
|
||||
bMenuBar.remove("edit");
|
||||
bMenuBar.remove("window");
|
||||
bMenuBar.remove("bookmarks");
|
||||
BMenu bMenu2 = (BMenu)bMenuBar.get("tools");
|
||||
bMenu2.remove("options");
|
||||
return bMenuBar;
|
||||
}
|
||||
|
||||
public BToolBar makeToolBar() {
|
||||
BToolBar bToolBar = super.makeToolBar();
|
||||
bToolBar.remove("save");
|
||||
bToolBar.remove("saveBog");
|
||||
bToolBar.remove("cut");
|
||||
bToolBar.remove("copy");
|
||||
bToolBar.remove("duplicate");
|
||||
bToolBar.remove("paste");
|
||||
bToolBar.remove("delete");
|
||||
bToolBar.remove("undo");
|
||||
bToolBar.remove("redo");
|
||||
bToolBar.remove("export");
|
||||
bToolBar.remove("open");
|
||||
return bToolBar;
|
||||
}
|
||||
|
||||
public BWbLocatorBar makeLocatorBar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasSideBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasTool(TypeInfo typeInfo) {
|
||||
return typeInfo.toString().equals("wbutil:ManageCredentialsTool") || typeInfo.toString().equals("platCrypto:CertManagerTool") || typeInfo.toString().equals("platform:LicenseDatabaseTool");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.fox.sys.BFoxClientConnection
|
||||
* com.tridium.fox.sys.BFoxClientConnection$Interest
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* com.tridium.fox.sys.broker.BFoxStationSpace
|
||||
* com.tridium.workbench.auth.AuthUtil
|
||||
* javax.baja.agent.AgentList
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.BPoint
|
||||
* javax.baja.log.Log
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.nav.BNavRoot
|
||||
* javax.baja.nav.NavEvent
|
||||
* javax.baja.nav.NavListener
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.security.AuthenticationRealm
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BRelTime
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Clock$Ticket
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BHyperlinkMode
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.BWidgetShell
|
||||
* javax.baja.ui.HyperlinkInfo
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
* javax.baja.workbench.tool.BWbService
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.BAlarmConsoleChannel;
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.alarm.ui.BAlarmConsoleUIChannel;
|
||||
import com.tridium.alarm.ui.BAlarmDialog;
|
||||
import com.tridium.alarm.ui.BTrayIcon;
|
||||
import com.tridium.alarm.ui.TrayIconListener;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalOptions;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecord;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecordList;
|
||||
import com.tridium.alarm.ui.portal.BPortalConsoleRecipient;
|
||||
import com.tridium.fox.sys.BFoxClientConnection;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import com.tridium.fox.sys.broker.BFoxStationSpace;
|
||||
import com.tridium.workbench.auth.AuthUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BSourceState;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.BPoint;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.nav.BNavRoot;
|
||||
import javax.baja.nav.NavEvent;
|
||||
import javax.baja.nav.NavListener;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.security.AuthenticationRealm;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BHyperlinkMode;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.BWidgetShell;
|
||||
import javax.baja.ui.HyperlinkInfo;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
import javax.baja.workbench.tool.BWbService;
|
||||
|
||||
public class BAlarmPortalTool
|
||||
extends BWbService
|
||||
implements TrayIconListener,
|
||||
NavListener,
|
||||
BFoxClientConnection.Interest {
|
||||
public static final Property alarmPortalConsoleRecipient = BAlarmPortalTool.newProperty((int)4, (BValue)new BConsoleRecipient(), null);
|
||||
public static final Action connect = BAlarmPortalTool.newAction((int)4, (BValue)new BWidget(), null);
|
||||
public static final Action routeAlarm = BAlarmPortalTool.newAction((int)4, (BValue)new BAlarmRecord(), null);
|
||||
public static final Action updateConnectionStatus = BAlarmPortalTool.newAction((int)4, null);
|
||||
public static final Action scanForReconnect = BAlarmPortalTool.newAction((int)4, null);
|
||||
public static final Topic newUnackedAlarm = BAlarmPortalTool.newTopic((int)0, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BAlarmPortalTool == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortalTool = BAlarmPortalTool.class$("com.tridium.alarm.ui.portal.BAlarmPortalTool")) : class$com$tridium$alarm$ui$portal$BAlarmPortalTool));
|
||||
Hashtable recipients = new Hashtable();
|
||||
Hashtable recipToRecord = new Hashtable();
|
||||
Array stations = new Array(class$javax$baja$naming$BOrd == null ? (class$javax$baja$naming$BOrd = BAlarmPortalTool.class$("javax.baja.naming.BOrd")) : class$javax$baja$naming$BOrd);
|
||||
BWidget view;
|
||||
Clock.Ticket reconnectTicket;
|
||||
BTrayIcon trayIcon = new BTrayIcon();
|
||||
protected int acked = 0;
|
||||
protected int unacked = 0;
|
||||
int activeViewCount = 0;
|
||||
int unackedTrayIconImg = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"), BTrayIcon.YELLOW_ICON);
|
||||
int inactiveTrayIconImg = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"), BTrayIcon.GRAY_ICON);
|
||||
int activeTrayIconImg = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"), BTrayIcon.RED_ICON);
|
||||
int normalTrayIconImg = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"), BTrayIcon.GREEN_ICON);
|
||||
int clearedTrayIconImg = BTrayIcon.loadImage(System.mapLibraryName("trayIcon"), BTrayIcon.WHITE_ICON);
|
||||
protected BAlarmPortalOptions options;
|
||||
static BAlarmDialog alarmDialog;
|
||||
private static final Object ALARM_DIALOG_LOCK;
|
||||
Hashtable alarms = new Hashtable();
|
||||
Hashtable sourceStates = new Hashtable();
|
||||
boolean sourcesInAlarm = false;
|
||||
Clock.Ticket updateTicket;
|
||||
private boolean running = false;
|
||||
static BImage alarmImg;
|
||||
public static final UiLexicon lexicon;
|
||||
private static final BIcon icon;
|
||||
public static final Log logger;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BAlarmPortalTool;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$BConsoleRecipient;
|
||||
static /* synthetic */ Class class$javax$baja$naming$BOrd;
|
||||
|
||||
public BConsoleRecipient getAlarmPortalConsoleRecipient() {
|
||||
return (BConsoleRecipient)this.get(alarmPortalConsoleRecipient);
|
||||
}
|
||||
|
||||
public void setAlarmPortalConsoleRecipient(BConsoleRecipient bConsoleRecipient) {
|
||||
this.set(alarmPortalConsoleRecipient, (BValue)bConsoleRecipient, null);
|
||||
}
|
||||
|
||||
public void connect(BWidget bWidget) {
|
||||
this.invoke(connect, (BValue)bWidget, null);
|
||||
}
|
||||
|
||||
public void routeAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.invoke(routeAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public void updateConnectionStatus() {
|
||||
this.invoke(updateConnectionStatus, null, null);
|
||||
}
|
||||
|
||||
public void scanForReconnect() {
|
||||
this.invoke(scanForReconnect, null, null);
|
||||
}
|
||||
|
||||
public void fireNewUnackedAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.fire(newUnackedAlarm, (BValue)bAlarmRecord, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BAlarmPortalTool() {
|
||||
this.options = BAlarmPortalOptions.getDefault();
|
||||
this.setAlarmPortalConsoleRecipient(new BPortalConsoleRecipient(this));
|
||||
BNavRoot.INSTANCE.addNavListener((NavListener)this);
|
||||
this.start();
|
||||
}
|
||||
|
||||
private void doConnect() {
|
||||
this.doConnect(null);
|
||||
}
|
||||
|
||||
public void doConnect(BWidget bWidget) {
|
||||
this.view = bWidget;
|
||||
this.acked = 0;
|
||||
this.unacked = 0;
|
||||
this.sourcesInAlarm = false;
|
||||
BLink[] bLinkArray = this.getLinks();
|
||||
for (int i = 0; i < bLinkArray.length; ++i) {
|
||||
this.remove(bLinkArray[i].getName());
|
||||
}
|
||||
this.recipients = new Hashtable();
|
||||
BConsoleRecordList bConsoleRecordList = this.options.getConsoleList();
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
for (int i = 0; i < bConsoleRecordList.size(); ++i) {
|
||||
Object object;
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(i);
|
||||
try {
|
||||
BConsoleRecipient bConsoleRecipient = this.connectToServer(bWidget, bConsoleRecord);
|
||||
object = this.getInitialAlarmCounts(bConsoleRecipient);
|
||||
this.acked += object[0];
|
||||
this.unacked += object[1];
|
||||
continue;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
object = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
Object[] objectArray = new Object[]{bConsoleRecord.getHostOrd() + (String)object + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd()};
|
||||
arrayList.add(lexicon.getText("messages.connectionError", objectArray));
|
||||
}
|
||||
}
|
||||
if (arrayList.size() > 0) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < arrayList.size(); ++i) {
|
||||
stringBuffer.append(arrayList.get(i) + "\n");
|
||||
}
|
||||
}
|
||||
this.updateTrayIcon(this.acked, this.unacked, this.sourcesInAlarm);
|
||||
this.showAlarmDialog(this.acked, this.unacked, this.sourcesInAlarm, null);
|
||||
Clock.Ticket ticket = Clock.schedulePeriodically((BComponent)this, (BRelTime)this.options.getReconnectInterval(), (Action)scanForReconnect, null);
|
||||
}
|
||||
|
||||
public void doRouteAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.getAlarmPortalConsoleRecipient().doRouteAlarm(bAlarmRecord);
|
||||
}
|
||||
|
||||
public void doUpdateConnectionStatus() {
|
||||
this.updateTicket.cancel();
|
||||
this.updateTrayIcon(this.acked, this.unacked, this.sourcesInAlarm);
|
||||
boolean bl = this.fullyConnected();
|
||||
if (alarmDialog != null) {
|
||||
alarmDialog.setFullyConnected(bl);
|
||||
}
|
||||
if (!bl) {
|
||||
if ((this.running || this.activeViewCount > 0) && this.options.getAlarmPopupEnabled() && alarmDialog == null) {
|
||||
this.showAlarmDialog(this.acked, this.unacked, this.sourcesInAlarm, null);
|
||||
}
|
||||
} else {
|
||||
if (this.updateTicket != null) {
|
||||
this.updateTicket.cancel();
|
||||
}
|
||||
this.updateTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.make((long)30000L), (Action)updateConnectionStatus, null);
|
||||
}
|
||||
}
|
||||
|
||||
public BConsoleRecipient connectToServer(BWidget bWidget, BConsoleRecord bConsoleRecord) throws Exception {
|
||||
String string = bConsoleRecord.getHostOrd().toString();
|
||||
BOrd bOrd = bConsoleRecord.getHostOrd();
|
||||
BFoxSession bFoxSession = BFoxSession.make((BHost)((BHost)bOrd.get()), (int)bConsoleRecord.getPort(), (boolean)bConsoleRecord.getUseFoxs());
|
||||
BOrd bOrd2 = bConsoleRecord.getConsoleOrd();
|
||||
BICredentials bICredentials = AuthUtil.getCredentials((AuthenticationRealm)bFoxSession);
|
||||
if (((BUsernameAndPassword)bICredentials).getUsername().isEmpty()) {
|
||||
AuthUtil.challenge(null, (AuthenticationRealm)bFoxSession);
|
||||
} else {
|
||||
bFoxSession.setCredentials(bICredentials);
|
||||
}
|
||||
try {
|
||||
bFoxSession.connect();
|
||||
BOrd bOrd3 = BOrd.make((String)"station:");
|
||||
BObject bObject = bOrd3.get((BObject)bFoxSession);
|
||||
BFoxStationSpace bFoxStationSpace = (BFoxStationSpace)bObject;
|
||||
BOrd bOrd4 = BOrd.make((String)("station:|" + bOrd2.toString()));
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)bOrd4.get((BObject)bFoxStationSpace.getRootComponent());
|
||||
if (!this.recipients.contains((Object)bConsoleRecipient)) {
|
||||
if (!this.stations.contains((Object)bConsoleRecord.getHostOrd())) {
|
||||
this.stations.add((Object)bConsoleRecord.getHostOrd());
|
||||
}
|
||||
String string2 = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
this.recipients.put(bConsoleRecord.getHostOrd() + string2 + bConsoleRecord.getPort() + "|station:|" + bOrd2, bConsoleRecipient);
|
||||
this.recipToRecord.put(bConsoleRecipient, bConsoleRecord);
|
||||
}
|
||||
boolean bl = this.fullyConnected();
|
||||
this.updateTrayIcon(this.acked, this.unacked, this.sourcesInAlarm);
|
||||
this.showAlarmDialog(this.acked, this.unacked, this.sourcesInAlarm, null);
|
||||
return bConsoleRecipient;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
private BAlarmConsoleUIChannel channel(BConsoleRecipient bConsoleRecipient) {
|
||||
if (bConsoleRecipient == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
BFoxSession bFoxSession = (BFoxSession)bConsoleRecipient.getSession();
|
||||
if (bFoxSession != null) {
|
||||
BFoxClientConnection bFoxClientConnection = bFoxSession.getConnection();
|
||||
Object object = BAlarmConsoleChannel.channelMutex;
|
||||
synchronized (object) {
|
||||
BAlarmConsoleChannel bAlarmConsoleChannel = (BAlarmConsoleChannel)bFoxClientConnection.getChannels().get("alarmui");
|
||||
if (bAlarmConsoleChannel == null || !(bAlarmConsoleChannel instanceof BAlarmConsoleUIChannel)) {
|
||||
bAlarmConsoleChannel = new BAlarmConsoleUIChannel();
|
||||
((BFoxSession)bConsoleRecipient.getSession()).getConnection().getChannels().remove("alarmui");
|
||||
((BFoxSession)bConsoleRecipient.getSession()).getConnection().getChannels().add("alarmui", (BValue)bAlarmConsoleChannel);
|
||||
}
|
||||
return (BAlarmConsoleUIChannel)bAlarmConsoleChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int[] getInitialAlarmCounts(BConsoleRecipient bConsoleRecipient) {
|
||||
if (bConsoleRecipient == null) {
|
||||
return new int[]{0, 0};
|
||||
}
|
||||
try {
|
||||
String string = this.channel(bConsoleRecipient).getInitialAlarmQuery(this, bConsoleRecipient).toString();
|
||||
BOrd bOrd = BOrd.make((String)string);
|
||||
BICollection bICollection = (BICollection)bOrd.get((BObject)bConsoleRecipient);
|
||||
Cursor cursor = bICollection.cursor();
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
while (cursor.next()) {
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)cursor.get();
|
||||
if (!this.accept(bAlarmRecord)) continue;
|
||||
if (this.alarms == null) {
|
||||
this.alarms = new Hashtable();
|
||||
}
|
||||
this.alarms.put(bAlarmRecord.getUuid(), bAlarmRecord.getAckState());
|
||||
if (this.sourceStates == null) {
|
||||
this.sourceStates = new Hashtable();
|
||||
}
|
||||
this.sourceStates.put(bAlarmRecord.getSource(), bAlarmRecord.getSourceState());
|
||||
if (bAlarmRecord.isAcknowledged()) {
|
||||
++n;
|
||||
} else {
|
||||
++n2;
|
||||
}
|
||||
if (bAlarmRecord.isNormal()) continue;
|
||||
this.sourcesInAlarm = true;
|
||||
}
|
||||
return new int[]{n, n2};
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return new int[]{0, 0};
|
||||
}
|
||||
}
|
||||
|
||||
protected BConsoleRecord getConsoleRecordForStation(BOrd bOrd) {
|
||||
BConsoleRecordList bConsoleRecordList = this.options.getConsoleList();
|
||||
for (int i = 0; i < bConsoleRecordList.size(); ++i) {
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(i);
|
||||
String string = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
String string2 = bConsoleRecord.getHostOrd() + string + bConsoleRecord.getPort();
|
||||
if (!string2.equals(bOrd.toString())) continue;
|
||||
return bConsoleRecordList.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BConsoleRecipient getRecipientForRecord(BConsoleRecord bConsoleRecord) {
|
||||
if (bConsoleRecord == null) {
|
||||
return null;
|
||||
}
|
||||
String string = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
return (BConsoleRecipient)((Object)this.recipients.get(bConsoleRecord.getHostOrd() + string + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd()));
|
||||
}
|
||||
|
||||
protected BConsoleRecord getRecordForRecipient(BConsoleRecipient bConsoleRecipient) {
|
||||
return (BConsoleRecord)((Object)this.recipToRecord.get((Object)bConsoleRecipient));
|
||||
}
|
||||
|
||||
protected BConsoleRecord getConsoleRecordFor(BOrd bOrd) {
|
||||
String string;
|
||||
Object object;
|
||||
String string2;
|
||||
String string3 = string2 = bOrd.toString();
|
||||
if (string2.indexOf("|fox:") < 0 && string2.indexOf("|foxs:") < 0) {
|
||||
int n = string2.indexOf("|station");
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
object = new StringBuffer();
|
||||
string = string2.substring(0, n);
|
||||
stringBuffer.append(string);
|
||||
((StringBuffer)object).append(string);
|
||||
stringBuffer.append("|fox:1911");
|
||||
((StringBuffer)object).append("|foxs:4911");
|
||||
String string4 = string2.substring(n);
|
||||
stringBuffer.append(string4);
|
||||
((StringBuffer)object).append(string4);
|
||||
string2 = stringBuffer.toString();
|
||||
string3 = ((StringBuffer)object).toString();
|
||||
}
|
||||
BConsoleRecordList bConsoleRecordList = this.options.getConsoleList();
|
||||
for (int i = 0; i < bConsoleRecordList.size(); ++i) {
|
||||
object = bConsoleRecordList.get(i);
|
||||
string = object.getHostOrd() + "|fox:" + object.getPort() + "|station:|" + object.getConsoleOrd();
|
||||
if (string.toString().equals(string2)) {
|
||||
return object;
|
||||
}
|
||||
string = object.getHostOrd() + "|foxs:" + object.getPort() + "|station:|" + object.getConsoleOrd();
|
||||
if (!string.toString().equals(string3)) continue;
|
||||
return object;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected BConsoleRecipient[] getRecipientsFor(BOrd bOrd) {
|
||||
Array array = new Array(class$com$tridium$alarm$BConsoleRecipient == null ? (class$com$tridium$alarm$BConsoleRecipient = BAlarmPortalTool.class$("com.tridium.alarm.BConsoleRecipient")) : class$com$tridium$alarm$BConsoleRecipient);
|
||||
Enumeration enumeration = this.recipients.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String string = (String)enumeration.nextElement();
|
||||
if (!string.equals(bOrd.toString())) continue;
|
||||
array.add(this.recipients.get(string));
|
||||
}
|
||||
return (BConsoleRecipient[])array.array();
|
||||
}
|
||||
|
||||
public final void handleAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.getAlarmPortalConsoleRecipient().fireNewUnackedAlarm(bAlarmRecord);
|
||||
}
|
||||
|
||||
public void processAlarm(BAlarmRecord bAlarmRecord) {
|
||||
if (this.running && this.accept(bAlarmRecord)) {
|
||||
BAckState bAckState = (BAckState)((Object)this.alarms.get(bAlarmRecord.getUuid()));
|
||||
BSourceState bSourceState = (BSourceState)((Object)this.sourceStates.get(bAlarmRecord.getSource()));
|
||||
if (bAckState == null) {
|
||||
++this.unacked;
|
||||
} else if (bAckState != BAckState.acked && bAlarmRecord.isAcknowledged()) {
|
||||
++this.acked;
|
||||
--this.unacked;
|
||||
}
|
||||
if (bSourceState == null) {
|
||||
this.sourcesInAlarm = true;
|
||||
} else if (bSourceState != BSourceState.normal && bAlarmRecord.isNormal()) {
|
||||
this.sourcesInAlarm = false;
|
||||
} else if (bSourceState == BSourceState.normal && !bAlarmRecord.isNormal()) {
|
||||
this.sourcesInAlarm = false;
|
||||
Iterator iterator = this.sourceStates.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if ((BSourceState)((Object)iterator.next()) == BSourceState.normal) continue;
|
||||
this.sourcesInAlarm = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.alarms.put(bAlarmRecord.getUuid(), bAlarmRecord.getAckState());
|
||||
this.sourceStates.put(bAlarmRecord.getSource(), bAlarmRecord.getSourceState());
|
||||
this.showAlarmDialog(this.acked, this.unacked, this.sourcesInAlarm, bAlarmRecord);
|
||||
this.updateTrayIcon(this.acked, this.unacked, this.sourcesInAlarm);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accept(BAlarmRecord bAlarmRecord) {
|
||||
Iterator iterator = this.recipients.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)iterator.next());
|
||||
if (!bConsoleRecipient.accept(bAlarmRecord)) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void navEvent(NavEvent navEvent) {
|
||||
}
|
||||
|
||||
public boolean fullyConnected() {
|
||||
if (this.options.getConsoleList().size() <= 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < this.options.getConsoleList().size(); ++i) {
|
||||
BConsoleRecipient bConsoleRecipient = this.getRecipientForRecord(this.options.getConsoleList().get(i));
|
||||
if (bConsoleRecipient != null && bConsoleRecipient.isMounted() && bConsoleRecipient.getSession() != null && ((BFoxSession)bConsoleRecipient.getSession()).isConnected()) continue;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean partiallyConnected() {
|
||||
if (this.options.getConsoleList().size() <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.fullyConnected()) {
|
||||
return false;
|
||||
}
|
||||
Enumeration enumeration = this.recipients.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)this.recipients.get(enumeration.nextElement()));
|
||||
if (!bConsoleRecipient.isMounted()) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean serviceRunning() {
|
||||
return BAlarmPortalTool.getManager().isRunning(this.getType().getTypeInfo());
|
||||
}
|
||||
|
||||
protected BWbShell getToolWbShell() {
|
||||
int n;
|
||||
BWidgetShell[] bWidgetShellArray = BWidget.getApplication().getShells();
|
||||
if (bWidgetShellArray.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (n = 0; n < bWidgetShellArray.length && !(bWidgetShellArray[n] instanceof BWbShell); ++n) {
|
||||
}
|
||||
try {
|
||||
return (BWbShell)bWidgetShellArray[n];
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateTrayIcon(int n, int n2, boolean bl) {
|
||||
if (this.running || this.activeViewCount > 0) {
|
||||
if (this.options.getTrayIconEnabled()) {
|
||||
if (this.trayIcon == null) {
|
||||
this.trayIcon = new BTrayIcon();
|
||||
}
|
||||
int n3 = this.activeTrayIconImg;
|
||||
if (!this.fullyConnected()) {
|
||||
n3 = this.inactiveTrayIconImg;
|
||||
} else if (n == 0 && n2 == 0) {
|
||||
n3 = this.clearedTrayIconImg;
|
||||
} else if (n > 0 && n2 == 0) {
|
||||
n3 = this.unackedTrayIconImg;
|
||||
} else if (!bl) {
|
||||
n3 = this.normalTrayIconImg;
|
||||
}
|
||||
this.trayIcon.updateTrayIcon(n3, lexicon.getText("AlarmPortalTool.displayName") + ": " + n + " " + lexicon.getText("trayIcon.acked") + " / " + n2 + " " + lexicon.getText("trayIcon.unackedAlarms"));
|
||||
if (!this.trayIcon.isShowing()) {
|
||||
this.trayIcon.show();
|
||||
}
|
||||
if (n3 != this.inactiveTrayIconImg) {
|
||||
if (this.updateTicket != null) {
|
||||
this.updateTicket.cancel();
|
||||
}
|
||||
this.updateTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.make((long)30000L), (Action)updateConnectionStatus, null);
|
||||
}
|
||||
} else if (this.trayIcon != null && this.trayIcon.isShowing()) {
|
||||
this.trayIcon.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
protected void showAlarmDialog(int n, int n2, boolean bl, BAlarmRecord bAlarmRecord) {
|
||||
if ((this.running || this.activeViewCount > 0) && this.options.getAlarmPopupEnabled()) {
|
||||
Object object = ALARM_DIALOG_LOCK;
|
||||
synchronized (object) {
|
||||
if (alarmDialog == null) {
|
||||
alarmDialog = new BAlarmDialog(this, lexicon.getText("AlarmPortalTool.displayName"), alarmImg, bAlarmRecord, n, n2, this.options.getAlarmPopupAlwaysOnTop(), this.options.getAlarmPopupUncloseable());
|
||||
alarmDialog.open();
|
||||
} else {
|
||||
alarmDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
alarmDialog.setFullyConnected(this.fullyConnected());
|
||||
alarmDialog.updateAlarmCounts(n, n2, bl);
|
||||
alarmDialog.updateLastAlarm(bAlarmRecord);
|
||||
alarmDialog.setFullyConnected(this.fullyConnected());
|
||||
if (this.fullyConnected()) {
|
||||
if (this.updateTicket != null) {
|
||||
this.updateTicket.cancel();
|
||||
}
|
||||
this.updateTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)BRelTime.make((long)30000L), (Action)updateConnectionStatus, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateLastAlarm(BAlarmRecord bAlarmRecord) {
|
||||
if (alarmDialog != null) {
|
||||
alarmDialog.updateLastAlarm(bAlarmRecord);
|
||||
if (!alarmDialog.isVisible()) {
|
||||
alarmDialog.setVisible(true);
|
||||
alarmDialog.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAlarmDialog() {
|
||||
if (alarmDialog != null) {
|
||||
alarmDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void viewActivated() {
|
||||
++this.activeViewCount;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
protected void viewDeactivated() {
|
||||
if (alarmDialog != null) {
|
||||
this.options.setPopupPosition(BPoint.make((double)alarmDialog.getScreenBounds().x(), (double)alarmDialog.getScreenBounds().y()));
|
||||
this.options.save();
|
||||
}
|
||||
--this.activeViewCount;
|
||||
if (this.activeViewCount == 0) {
|
||||
Object object = ALARM_DIALOG_LOCK;
|
||||
synchronized (object) {
|
||||
if (alarmDialog != null) {
|
||||
alarmDialog.close();
|
||||
}
|
||||
}
|
||||
if (this.trayIcon != null) {
|
||||
this.trayIcon.removeTrayIconListener(this);
|
||||
if (this.trayIcon.isShowing()) {
|
||||
this.trayIcon.hide();
|
||||
}
|
||||
}
|
||||
if (!this.serviceRunning()) {
|
||||
try {
|
||||
this.serviceStopped();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serviceStarted() throws Exception {
|
||||
this.running = true;
|
||||
this.alarms = new Hashtable();
|
||||
try {
|
||||
this.doConnect();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
this.updateTrayIcon(this.acked, this.unacked, this.sourcesInAlarm);
|
||||
this.showAlarmDialog(this.acked, this.unacked, this.sourcesInAlarm, null);
|
||||
if (this.trayIcon != null) {
|
||||
this.trayIcon.addTrayIconListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void serviceStopped() throws Exception {
|
||||
this.running = false;
|
||||
this.alarms = null;
|
||||
this.sourceStates = null;
|
||||
BConsoleRecordList bConsoleRecordList = this.options.getConsoleList();
|
||||
for (int i = 0; i < bConsoleRecordList.size(); ++i) {
|
||||
try {
|
||||
BConsoleRecord bConsoleRecord = bConsoleRecordList.get(i);
|
||||
this.channel(this.getRecipientForRecord(bConsoleRecord)).unregister((BAlarmConsole)null);
|
||||
continue;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
if (this.activeViewCount == 0) {
|
||||
if (this.trayIcon != null) {
|
||||
this.trayIcon.removeTrayIconListener(this);
|
||||
}
|
||||
if (this.trayIcon.isShowing()) {
|
||||
this.trayIcon.hide();
|
||||
}
|
||||
this.options.save();
|
||||
Object object = ALARM_DIALOG_LOCK;
|
||||
synchronized (object) {
|
||||
alarmDialog.close();
|
||||
alarmDialog = null;
|
||||
}
|
||||
this.trayIcon = null;
|
||||
}
|
||||
if (this.reconnectTicket != null) {
|
||||
this.reconnectTicket.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void onTrayIconClicked(BTrayIcon bTrayIcon) {
|
||||
}
|
||||
|
||||
public void onTrayIconDoubleClicked(BTrayIcon bTrayIcon) {
|
||||
try {
|
||||
this.getToolWbShell().hyperlink(this.getNavOrd());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
||||
public void onAlarmDialogHyperlink(BAlarmDialog bAlarmDialog, BOrd bOrd) {
|
||||
try {
|
||||
this.getToolWbShell().hyperlink(new HyperlinkInfo(bOrd, BHyperlinkMode.newTab));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
||||
public void onAlarmDialogClosed(BAlarmDialog bAlarmDialog) {
|
||||
this.options.setPopupPosition(BPoint.make((double)bAlarmDialog.getScreenBounds().x(), (double)bAlarmDialog.getScreenBounds().y()));
|
||||
alarmDialog = null;
|
||||
}
|
||||
|
||||
public void doScanForReconnect() throws Exception {
|
||||
if (this.options.getConsoleList().size() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (this.recipients.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Enumeration enumeration = this.recipients.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
try {
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)this.recipients.get(enumeration.nextElement()));
|
||||
if (bConsoleRecipient.isMounted()) continue;
|
||||
this.connectToServer(this.view, this.getRecordForRecipient(bConsoleRecipient));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.remove("alarm:AlarmConsole");
|
||||
agentList.remove("alarm:PortalAlarmConsole");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ALARM_DIALOG_LOCK = new Object();
|
||||
alarmImg = BImage.make((String)"module://icons/x16/alarm.png");
|
||||
lexicon = new UiLexicon(class$com$tridium$alarm$ui$portal$BAlarmPortalTool == null ? (class$com$tridium$alarm$ui$portal$BAlarmPortalTool = BAlarmPortalTool.class$("com.tridium.alarm.ui.portal.BAlarmPortalTool")) : class$com$tridium$alarm$ui$portal$BAlarmPortalTool);
|
||||
icon = BIcon.std((String)"alarm.png");
|
||||
logger = Log.getLog((String)"alarm");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BStruct
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BStruct;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BConsoleRecord
|
||||
extends BStruct {
|
||||
public static final Property hostOrd = BConsoleRecord.newProperty((int)0, (BValue)BOrd.NULL, null);
|
||||
public static final Property port = BConsoleRecord.newProperty((int)0, (int)1911, null);
|
||||
public static final Property useFoxs = BConsoleRecord.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property consoleOrd = BConsoleRecord.newProperty((int)0, (BValue)BOrd.NULL, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BConsoleRecord == null ? (class$com$tridium$alarm$ui$portal$BConsoleRecord = BConsoleRecord.class$("com.tridium.alarm.ui.portal.BConsoleRecord")) : class$com$tridium$alarm$ui$portal$BConsoleRecord));
|
||||
boolean loaded = false;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BConsoleRecord;
|
||||
|
||||
public BOrd getHostOrd() {
|
||||
return (BOrd)this.get(hostOrd);
|
||||
}
|
||||
|
||||
public void setHostOrd(BOrd bOrd) {
|
||||
this.set(hostOrd, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.getInt(port);
|
||||
}
|
||||
|
||||
public void setPort(int n) {
|
||||
this.setInt(port, n, null);
|
||||
}
|
||||
|
||||
public boolean getUseFoxs() {
|
||||
return this.getBoolean(useFoxs);
|
||||
}
|
||||
|
||||
public void setUseFoxs(boolean bl) {
|
||||
this.setBoolean(useFoxs, bl, null);
|
||||
}
|
||||
|
||||
public BOrd getConsoleOrd() {
|
||||
return (BOrd)this.get(consoleOrd);
|
||||
}
|
||||
|
||||
public void setConsoleOrd(BOrd bOrd) {
|
||||
this.set(consoleOrd, (BValue)bOrd, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BConsoleRecord() {
|
||||
}
|
||||
|
||||
public BConsoleRecord(BOrd bOrd, int n, boolean bl, BOrd bOrd2) {
|
||||
this.setHostOrd(bOrd);
|
||||
this.setPort(n);
|
||||
this.setUseFoxs(bl);
|
||||
this.setConsoleOrd(bOrd2);
|
||||
}
|
||||
|
||||
protected void setInitialLoadComplete(boolean bl) {
|
||||
this.loaded = bl;
|
||||
}
|
||||
|
||||
protected boolean isInitialLoadComplete() {
|
||||
return this.loaded;
|
||||
}
|
||||
|
||||
public String encodeToString() throws IOException {
|
||||
return this.getHostOrd().encodeToString() + "\\" + this.getPort() + "\\" + this.getConsoleOrd().encodeToString() + "\\" + this.getUseFoxs();
|
||||
}
|
||||
|
||||
public BObject decodeFromString(String string) throws IOException {
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, "\\");
|
||||
BOrd bOrd = (BOrd)BOrd.NULL.decodeFromString(stringTokenizer.nextToken());
|
||||
int n = 1911;
|
||||
try {
|
||||
n = Integer.parseInt(stringTokenizer.nextToken());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
BOrd bOrd2 = BOrd.make((String)stringTokenizer.nextToken());
|
||||
boolean bl = false;
|
||||
try {
|
||||
bl = Boolean.parseBoolean(stringTokenizer.nextToken());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
return new BConsoleRecord(bOrd, n, bl, bOrd2);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BSimple
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecord;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public final class BConsoleRecordList
|
||||
extends BSimple {
|
||||
public static final BConsoleRecordList NULL;
|
||||
public static final BConsoleRecordList DEFAULT;
|
||||
public static final Type TYPE;
|
||||
private int hashCode = -1;
|
||||
private BConsoleRecord[] ords;
|
||||
private String string;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BConsoleRecordList;
|
||||
|
||||
public static BConsoleRecordList make(BConsoleRecord bConsoleRecord) {
|
||||
return new BConsoleRecordList(new BConsoleRecord[]{bConsoleRecord});
|
||||
}
|
||||
|
||||
public static BConsoleRecordList make(BConsoleRecord[] bConsoleRecordArray) {
|
||||
if (bConsoleRecordArray.length == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return new BConsoleRecordList((BConsoleRecord[])bConsoleRecordArray.clone());
|
||||
}
|
||||
|
||||
public static BConsoleRecordList add(BConsoleRecordList bConsoleRecordList, BConsoleRecord bConsoleRecord) {
|
||||
BConsoleRecord[] bConsoleRecordArray = new BConsoleRecord[bConsoleRecordList.ords.length + 1];
|
||||
System.arraycopy(bConsoleRecordList.ords, 0, bConsoleRecordArray, 0, bConsoleRecordList.ords.length);
|
||||
bConsoleRecordArray[bConsoleRecordArray.length - 1] = bConsoleRecord;
|
||||
return new BConsoleRecordList(bConsoleRecordArray);
|
||||
}
|
||||
|
||||
public static BConsoleRecordList remove(BConsoleRecordList bConsoleRecordList, int n) {
|
||||
BConsoleRecord[] bConsoleRecordArray = new BConsoleRecord[bConsoleRecordList.ords.length - 1];
|
||||
System.arraycopy(bConsoleRecordList.ords, 0, bConsoleRecordArray, 0, n);
|
||||
if (n < bConsoleRecordList.ords.length) {
|
||||
System.arraycopy(bConsoleRecordList.ords, n + 1, bConsoleRecordArray, n, bConsoleRecordList.ords.length - n - 1);
|
||||
}
|
||||
return new BConsoleRecordList(bConsoleRecordArray);
|
||||
}
|
||||
|
||||
private BConsoleRecordList(BConsoleRecord[] bConsoleRecordArray) {
|
||||
this.ords = bConsoleRecordArray;
|
||||
}
|
||||
|
||||
public BConsoleRecord get(int n) {
|
||||
return this.ords[n];
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.ords.length;
|
||||
}
|
||||
|
||||
public boolean isNull() {
|
||||
return this.ords.length == 0;
|
||||
}
|
||||
|
||||
public BConsoleRecord[] toArray() {
|
||||
return (BConsoleRecord[])this.ords.clone();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
if (this.hashCode == -1) {
|
||||
int n = 11;
|
||||
for (int i = 0; i < this.ords.length; ++i) {
|
||||
n ^= this.ords[i].hashCode();
|
||||
}
|
||||
this.hashCode = n;
|
||||
}
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof BConsoleRecordList) {
|
||||
BConsoleRecord[] bConsoleRecordArray = this.ords;
|
||||
BConsoleRecord[] bConsoleRecordArray2 = ((BConsoleRecordList)((Object)object)).ords;
|
||||
if (bConsoleRecordArray.length != bConsoleRecordArray2.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < bConsoleRecordArray.length; ++i) {
|
||||
if (bConsoleRecordArray[i].equals((Object)bConsoleRecordArray2[i])) continue;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void encode(DataOutput dataOutput) throws IOException {
|
||||
dataOutput.writeUTF(this.string);
|
||||
}
|
||||
|
||||
public BObject decode(DataInput dataInput) throws IOException {
|
||||
return this.decodeFromString(dataInput.readUTF());
|
||||
}
|
||||
|
||||
public String encodeToString() throws IOException {
|
||||
if (this.string == null) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < this.ords.length; ++i) {
|
||||
if (i > 0) {
|
||||
stringBuffer.append('\n');
|
||||
}
|
||||
stringBuffer.append(this.ords[i].encodeToString());
|
||||
}
|
||||
this.string = stringBuffer.toString();
|
||||
}
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public BObject decodeFromString(String string) throws IOException {
|
||||
ArrayList<BObject> arrayList = new ArrayList<BObject>();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(string, "\n");
|
||||
while (stringTokenizer.hasMoreTokens()) {
|
||||
arrayList.add(new BConsoleRecord().decodeFromString(stringTokenizer.nextToken()));
|
||||
}
|
||||
BConsoleRecord[] bConsoleRecordArray = arrayList.toArray(new BConsoleRecord[arrayList.size()]);
|
||||
return new BConsoleRecordList(bConsoleRecordArray);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
DEFAULT = NULL = new BConsoleRecordList(new BConsoleRecord[0]);
|
||||
TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BConsoleRecordList == null ? (class$com$tridium$alarm$ui$portal$BConsoleRecordList = BConsoleRecordList.class$("com.tridium.alarm.ui.portal.BConsoleRecordList")) : class$com$tridium$alarm$ui$portal$BConsoleRecordList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* com.tridium.workbench.auth.AuthUtil
|
||||
* com.tridium.workbench.auth.BUsernameAndPasswordFE
|
||||
* com.tridium.workbench.auth.CredentialsList
|
||||
* com.tridium.workbench.fieldeditors.BBooleanFE
|
||||
* com.tridium.workbench.fieldeditors.BIntegerFE
|
||||
* com.tridium.workbench.ord.BHostOrdFE
|
||||
* com.tridium.workbench.shell.BGeneralOptions
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BFont
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.security.BICredentials
|
||||
* javax.baja.security.BUsernameAndPassword
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BLink
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BCheckBox
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.workbench.BWbPlugin
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import com.tridium.workbench.auth.AuthUtil;
|
||||
import com.tridium.workbench.auth.BUsernameAndPasswordFE;
|
||||
import com.tridium.workbench.auth.CredentialsList;
|
||||
import com.tridium.workbench.fieldeditors.BBooleanFE;
|
||||
import com.tridium.workbench.fieldeditors.BIntegerFE;
|
||||
import com.tridium.workbench.ord.BHostOrdFE;
|
||||
import com.tridium.workbench.shell.BGeneralOptions;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BFont;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.security.BICredentials;
|
||||
import javax.baja.security.BUsernameAndPassword;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BLink;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BCheckBox;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.workbench.BWbPlugin;
|
||||
|
||||
public class BHostSelectPane
|
||||
extends BEdgePane {
|
||||
public static final Action addressModified = BHostSelectPane.newAction((int)0, null);
|
||||
public static final Action foxsModified = BHostSelectPane.newAction((int)0, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BHostSelectPane == null ? (class$com$tridium$alarm$ui$portal$BHostSelectPane = BHostSelectPane.class$("com.tridium.alarm.ui.portal.BHostSelectPane")) : class$com$tridium$alarm$ui$portal$BHostSelectPane));
|
||||
public static final BImage logo = BImage.make((String)"module://icons/x32/connect.png");
|
||||
public static final BImage keys = BImage.make((String)"module://icons/x16/keys.png");
|
||||
BIntegerFE portFE;
|
||||
BBooleanFE useFoxsFE;
|
||||
BHostOrdFE hostOrdFE;
|
||||
BLink link = null;
|
||||
BUsernameAndPasswordFE credentialsEditor;
|
||||
BCheckBox saveCredentials;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BHostSelectPane;
|
||||
|
||||
public void addressModified() {
|
||||
this.invoke(addressModified, null, null);
|
||||
}
|
||||
|
||||
public void foxsModified() {
|
||||
this.invoke(foxsModified, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BHostSelectPane() {
|
||||
this(BOrd.NULL, BGeneralOptions.make().getIsDefaultConnectionTypeSsl() ? 4911 : 1911, BGeneralOptions.make().getIsDefaultConnectionTypeSsl());
|
||||
}
|
||||
|
||||
public BHostSelectPane(BOrd bOrd, int n, boolean bl) {
|
||||
UiLexicon uiLexicon = UiLexicon.bajaui;
|
||||
BLabel bLabel = new BLabel(logo);
|
||||
bLabel.setValign(BValign.top);
|
||||
String string = uiLexicon.getText("auth.title");
|
||||
String string2 = uiLexicon.getText("auth.description");
|
||||
String string3 = uiLexicon.getText("auth.host");
|
||||
String string4 = uiLexicon.getText("auth.port");
|
||||
String string5 = uiLexicon.getText("auth.foxs");
|
||||
String string6 = uiLexicon.getText("auth.credentials");
|
||||
String string7 = uiLexicon.getText("auth.saveCredentials");
|
||||
BFont bFont = Theme.widget().getBoldText();
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
bGridPane.add(null, (BValue)new BLabel(string3, bFont));
|
||||
this.hostOrdFE = new BHostOrdFE();
|
||||
BFacets bFacets = BFacets.make((String)"ordRelativize", (BIDataValue)BBoolean.FALSE, (String)"mruAutoSave", (BIDataValue)BBoolean.FALSE);
|
||||
BGeneralOptions bGeneralOptions = BGeneralOptions.make();
|
||||
boolean bl2 = bGeneralOptions.getAllowUserCredentialCaching();
|
||||
if (!bl2) {
|
||||
AuthUtil.saveCredentials = false;
|
||||
}
|
||||
this.saveCredentials = new BCheckBox(string7, AuthUtil.saveCredentials);
|
||||
this.saveCredentials.setEnabled(bl2);
|
||||
this.hostOrdFE.loadValue((BObject)bOrd, (Context)bFacets);
|
||||
this.link = this.linkTo((BComponent)this.hostOrdFE, (Slot)BHostOrdFE.pluginModified, (Slot)addressModified);
|
||||
bGridPane.add(null, (BValue)this.hostOrdFE);
|
||||
bGridPane.add(null, (BValue)new BLabel(string4, bFont));
|
||||
this.portFE = new BIntegerFE();
|
||||
this.portFE.loadValue((BObject)BInteger.make((int)n));
|
||||
bGridPane.add(null, (BValue)this.portFE);
|
||||
bGridPane.add(null, (BValue)new BLabel(string5, bFont));
|
||||
this.useFoxsFE = new BBooleanFE();
|
||||
this.useFoxsFE.loadValue((BObject)BBoolean.make((boolean)bl));
|
||||
bGridPane.add(null, (BValue)this.useFoxsFE);
|
||||
this.linkTo((BComponent)this.useFoxsFE, (Slot)BWbPlugin.pluginModified, (Slot)foxsModified);
|
||||
this.credentialsEditor = new BUsernameAndPasswordFE();
|
||||
this.credentialsEditor.loadValue((BObject)new BUsernameAndPassword());
|
||||
BGridPane bGridPane2 = new BGridPane(1);
|
||||
bGridPane2.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)new BLabel(string6, bFont));
|
||||
bGridPane2.add(null, (BValue)new BBorderPane((BWidget)this.credentialsEditor, 0.0, 0.0, 0.0, 20.0));
|
||||
BGridPane bGridPane3 = new BGridPane(1);
|
||||
bGridPane3.setHalign(BHalign.left);
|
||||
bGridPane3.setRowGap(10.0);
|
||||
bGridPane3.add(null, (BValue)bGridPane);
|
||||
bGridPane3.add(null, (BValue)bGridPane2);
|
||||
bGridPane3.add(null, (BValue)this.saveCredentials);
|
||||
this.setCenter((BWidget)new BBorderPane((BWidget)bGridPane3, 5.0, 5.0, 5.0, 5.0));
|
||||
if (bOrd != BOrd.NULL) {
|
||||
String string8 = this.addressToOrdString(this.getHostOrd(), this.getPort(), bl);
|
||||
BUsernameAndPassword bUsernameAndPassword = (BUsernameAndPassword)CredentialsList.INSTANCE.lookup(string8);
|
||||
try {
|
||||
if (!((BOrd)this.hostOrdFE.saveValue()).equals((Object)BOrd.make((String)"ip:")) && (bUsernameAndPassword == null || bUsernameAndPassword.getUsername() == null || bUsernameAndPassword.getUsername().isEmpty())) {
|
||||
this.saveCredentials.setSelected(false);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.doAddressModified();
|
||||
}
|
||||
|
||||
public String getHostString() {
|
||||
try {
|
||||
return this.hostOrdFE.saveValue().toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
try {
|
||||
return ((BInteger)this.portFE.saveValue()).getInt();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return 1911;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getUseFoxs() {
|
||||
try {
|
||||
return ((BBoolean)this.useFoxsFE.saveValue()).getBoolean();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public BOrd getHostOrd() {
|
||||
try {
|
||||
this.remove((BComplex)this.link);
|
||||
this.hostOrdFE.setModified();
|
||||
this.addressToOrdString(this.getHostOrd(), this.getPort(), this.getUseFoxs());
|
||||
this.link = this.linkTo((BComponent)this.hostOrdFE, (Slot)BHostOrdFE.pluginModified, (Slot)addressModified);
|
||||
BOrd bOrd = (BOrd)this.hostOrdFE.saveValue();
|
||||
return bOrd;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
return BOrd.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public BICredentials getCredentials() {
|
||||
try {
|
||||
BICredentials bICredentials = (BICredentials)this.credentialsEditor.saveValue();
|
||||
BUsernameAndPassword bUsernameAndPassword = (BUsernameAndPassword)bICredentials;
|
||||
return bICredentials;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return new BUsernameAndPassword();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getRememberCredentials() {
|
||||
return this.saveCredentials.isSelected();
|
||||
}
|
||||
|
||||
public String getRealm() {
|
||||
return this.addressToOrdString(this.getHostOrd(), this.getPort(), this.getUseFoxs());
|
||||
}
|
||||
|
||||
protected String addressToOrdString(BOrd bOrd, int n, boolean bl) {
|
||||
String string = bOrd.toString();
|
||||
if (bl) {
|
||||
string = string + "|foxs:";
|
||||
if (n != 4911) {
|
||||
string = string + n;
|
||||
}
|
||||
} else {
|
||||
string = string + "|fox:";
|
||||
if (n != 1911) {
|
||||
string = string + n;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public void doAddressModified() {
|
||||
try {
|
||||
String string = this.addressToOrdString(this.getHostOrd(), this.getPort(), this.getUseFoxs());
|
||||
BUsernameAndPassword bUsernameAndPassword = (BUsernameAndPassword)CredentialsList.INSTANCE.lookup(string);
|
||||
if (bUsernameAndPassword != null) {
|
||||
this.credentialsEditor.loadValue((BObject)bUsernameAndPassword);
|
||||
} else {
|
||||
this.credentialsEditor.loadValue((BObject)new BUsernameAndPassword());
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void doFoxsModified() {
|
||||
if (this.getUseFoxs()) {
|
||||
this.portFE.loadValue((BObject)BInteger.make((int)4911));
|
||||
} else {
|
||||
this.portFE.loadValue((BObject)BInteger.make((int)1911));
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,577 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.filter.BAbsTimeFilter
|
||||
* com.tridium.bql.util.BDynamicTimeRange
|
||||
* com.tridium.fox.sys.BFoxSession
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.BOrdList
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Cursor
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.table.DynamicTableModel
|
||||
* javax.baja.ui.table.TableCellRenderer
|
||||
* javax.baja.ui.table.TableCellRenderer$Cell
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.BAlarmClassDef;
|
||||
import com.tridium.alarm.ui.BAlarmClassMapping;
|
||||
import com.tridium.alarm.ui.BAlarmConsole;
|
||||
import com.tridium.alarm.ui.SourceTableModel;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalTool;
|
||||
import com.tridium.alarm.ui.portal.BConsoleRecord;
|
||||
import com.tridium.bql.filter.BAbsTimeFilter;
|
||||
import com.tridium.bql.util.BDynamicTimeRange;
|
||||
import com.tridium.fox.sys.BFoxSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.alarm.BAckState;
|
||||
import javax.baja.alarm.BAlarmClass;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.alarm.BAlarmService;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.BOrdList;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Cursor;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.table.DynamicTableModel;
|
||||
import javax.baja.ui.table.TableCellRenderer;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public class BPortalAlarmConsole
|
||||
extends BAlarmConsole {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BPortalAlarmConsole == null ? (class$com$tridium$alarm$ui$portal$BPortalAlarmConsole = BPortalAlarmConsole.class$("com.tridium.alarm.ui.portal.BPortalAlarmConsole")) : class$com$tridium$alarm$ui$portal$BPortalAlarmConsole));
|
||||
BAlarmPortalTool tool;
|
||||
BButton serviceToggle;
|
||||
public Command startCommand;
|
||||
public Command stopCommand;
|
||||
public ToggleCommand autoStartCommand;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BPortalAlarmConsole;
|
||||
static /* synthetic */ Class class$javax$baja$alarm$BAlarmRecord;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
Object object;
|
||||
Object object2;
|
||||
if (this.sourceTable.getModel() instanceof DynamicTableModel) {
|
||||
object2 = (DynamicTableModel)this.sourceTable.getModel();
|
||||
object = new StringBuffer();
|
||||
for (int i = 0; i < object2.getRootColumnCount(); ++i) {
|
||||
if (!object2.showColumn(i)) continue;
|
||||
object.append(i + ",");
|
||||
}
|
||||
if (object2.getRootColumnCount() > 0) {
|
||||
this.options.setDisplayColumns(object.toString());
|
||||
}
|
||||
}
|
||||
this.options.setSortColumn(this.sourceModel.getLastSortColumn());
|
||||
this.options.setSortAscending(this.sourceModel.getLastSortAscending());
|
||||
this.options.save();
|
||||
if (!this.tool.serviceRunning()) {
|
||||
object2 = this.tool.recipients.keys();
|
||||
while (object2.hasMoreElements()) {
|
||||
object = (BConsoleRecipient)((Object)this.tool.recipients.get(object2.nextElement()));
|
||||
if (this.channel((BConsoleRecipient)((Object)object)) == null) continue;
|
||||
this.channel((BConsoleRecipient)((Object)object)).unregister((BConsoleRecipient)((Object)object));
|
||||
this.channel((BConsoleRecipient)((Object)object)).unregister(this);
|
||||
}
|
||||
if (this.tool.trayIcon != null && this.tool.trayIcon.isShowing()) {
|
||||
this.tool.trayIcon.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doLoadValue(BObject bObject, Context context) throws Exception {
|
||||
this.tool = (BAlarmPortalTool)bObject;
|
||||
super.doLoadValue((BObject)this.tool.getAlarmPortalConsoleRecipient(), context);
|
||||
this.sourceTable.setCellRenderer((TableCellRenderer)new AlarmPortalTableCellRenderer());
|
||||
}
|
||||
|
||||
public BGridPane makeToolBar() {
|
||||
BGridPane bGridPane = super.makeToolBar();
|
||||
return bGridPane;
|
||||
}
|
||||
|
||||
public void doProcessAlarm(BAlarmRecord bAlarmRecord) {
|
||||
super.doProcessAlarm(bAlarmRecord);
|
||||
if (this.options.getAlarmFilters().accept((BComplex)bAlarmRecord)) {
|
||||
int n = this.getAckedAlarmCount();
|
||||
int n2 = this.getUnackedAlarmCount();
|
||||
this.tool.updateTrayIcon(n, n2, this.sourcesInAlarm());
|
||||
this.tool.showAlarmDialog(n, n2, this.sourcesInAlarm(), bAlarmRecord);
|
||||
}
|
||||
}
|
||||
|
||||
public void doTimeRangeModified() throws Exception {
|
||||
this.timeRange = (BDynamicTimeRange)this.timeRangeEd.saveValue();
|
||||
this.reload();
|
||||
}
|
||||
|
||||
public int getAckedAlarmCount() {
|
||||
if (this.sourceModel == null || this.tool == null) {
|
||||
return 0;
|
||||
}
|
||||
int n = 0;
|
||||
int n2 = this.sourceModel.getRowCount();
|
||||
for (int i = 0; i < n2; ++i) {
|
||||
n += this.sourceModel.getAckedCountForSource(this.sourceModel.getRecord(i).getSource());
|
||||
}
|
||||
this.tool.acked = n;
|
||||
return n;
|
||||
}
|
||||
|
||||
public int getUnackedAlarmCount() {
|
||||
if (this.sourceModel == null || this.tool == null) {
|
||||
return 0;
|
||||
}
|
||||
int n = 0;
|
||||
int n2 = this.sourceModel.getRowCount();
|
||||
for (int i = 0; i < n2; ++i) {
|
||||
n += this.sourceModel.getUnackedCountForSource(this.sourceModel.getRecord(i).getSource());
|
||||
}
|
||||
this.tool.unacked = n;
|
||||
return n;
|
||||
}
|
||||
|
||||
public boolean sourcesInAlarm() {
|
||||
if (this.sourceModel == null || this.tool == null) {
|
||||
return false;
|
||||
}
|
||||
boolean bl = false;
|
||||
int n = this.sourceModel.getRowCount();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
bl |= !this.sourceModel.getRecord(i).isNormal();
|
||||
}
|
||||
this.tool.sourcesInAlarm = bl;
|
||||
return bl;
|
||||
}
|
||||
|
||||
public BAlarmRecord getMostRecentRecord() {
|
||||
if (this.sourceModel == null || this.tool == null) {
|
||||
return null;
|
||||
}
|
||||
BAlarmRecord bAlarmRecord = new BAlarmRecord();
|
||||
bAlarmRecord.setTimestamp(BAbsTime.NULL);
|
||||
int n = this.sourceModel.getRowCount();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
BAlarmRecord bAlarmRecord2 = this.sourceModel.getRecord(i);
|
||||
if (!bAlarmRecord2.getTimestamp().isAfter(bAlarmRecord.getTimestamp())) continue;
|
||||
bAlarmRecord = bAlarmRecord2;
|
||||
}
|
||||
return bAlarmRecord;
|
||||
}
|
||||
|
||||
public void removeAlarmsFrom(BConsoleRecord bConsoleRecord) {
|
||||
int n;
|
||||
String string = bConsoleRecord.getUseFoxs() ? "|foxs:" : "|fox:";
|
||||
BOrd bOrd = BOrd.make((String)(bConsoleRecord.getHostOrd() + string + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd()));
|
||||
if (this.sourceModel == null) {
|
||||
return;
|
||||
}
|
||||
int n2 = this.sourceModel.getRowCount();
|
||||
ArrayList<BOrdList> arrayList = new ArrayList<BOrdList>();
|
||||
for (n = 0; n < n2; ++n) {
|
||||
BOrdList bOrdList = this.sourceModel.getRecord(n).getSource();
|
||||
if (!this.ordListContains(bOrdList, bOrd)) continue;
|
||||
arrayList.add(bOrdList);
|
||||
}
|
||||
for (n = 0; n < arrayList.size(); ++n) {
|
||||
try {
|
||||
this.sourceModel.removeSource((BOrdList)arrayList.get(n));
|
||||
continue;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ordListContains(BOrdList bOrdList, BOrd bOrd) {
|
||||
for (int i = 0; i < bOrdList.size(); ++i) {
|
||||
BOrd bOrd2 = bOrdList.get(i);
|
||||
if (!bOrd2.equals((Object)bOrd)) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void reload() {
|
||||
Object object;
|
||||
Object object2;
|
||||
this.sourceModel.clear();
|
||||
Enumeration enumeration = this.tool.recipients.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
object2 = (BConsoleRecipient)((Object)this.tool.recipients.get(enumeration.nextElement()));
|
||||
BConsoleRecord bConsoleRecord = this.tool.getRecordForRecipient((BConsoleRecipient)((Object)object2));
|
||||
object = bConsoleRecord.getUseFoxs() ? "foxs:" : "fox:";
|
||||
BOrd bOrd = BOrd.make((BOrd)bConsoleRecord.getHostOrd(), (String)((String)object + bConsoleRecord.getPort() + "|station:|" + bConsoleRecord.getConsoleOrd().toString()));
|
||||
this.enterBusy();
|
||||
try {
|
||||
String string;
|
||||
BAbsTimeFilter bAbsTimeFilter;
|
||||
StringBuffer stringBuffer = new StringBuffer(this.channel((BConsoleRecipient)((Object)object2)).getInitialAlarmQuery(this, (BConsoleRecipient)((Object)object2), bOrd).toString());
|
||||
StringBuffer stringBuffer2 = new StringBuffer(64);
|
||||
String string2 = this.options.getAlarmFilters().getPredicate();
|
||||
if (string2 != null && string2.length() > 0) {
|
||||
if (stringBuffer2.length() != 0) {
|
||||
stringBuffer2.append(" and ");
|
||||
}
|
||||
stringBuffer2.append(string2);
|
||||
}
|
||||
if (stringBuffer2.length() != 0) {
|
||||
stringBuffer.append(" and ").append(stringBuffer2.toString());
|
||||
}
|
||||
if (!this.timeRange.equals((Object)BDynamicTimeRange.DEFAULT)) {
|
||||
bAbsTimeFilter = new BAbsTimeFilter();
|
||||
bAbsTimeFilter.initFromDynamicTimeRange(this.timeRange);
|
||||
string = bAbsTimeFilter.getPredicate(BAlarmRecord.timestamp.getName());
|
||||
stringBuffer.append(" and ").append(string.toString());
|
||||
}
|
||||
stringBuffer.append(" order by timestamp desc, ");
|
||||
stringBuffer.append(this.sourceModel.getColumns().getColumn(this.options.getSortColumn()).getQueryName());
|
||||
if (this.options.getSortAscending()) {
|
||||
stringBuffer.append(" asc");
|
||||
} else {
|
||||
stringBuffer.append(" desc");
|
||||
}
|
||||
bAbsTimeFilter = BOrd.make((BOrd)((BWbShell)this.getShell()).getActiveOrd(), (BOrd)BOrd.make((String)stringBuffer.toString()));
|
||||
string = (BICollection)bAbsTimeFilter.resolve((BObject)object2).get();
|
||||
Cursor cursor = string.cursor();
|
||||
BAlarmRecord bAlarmRecord = null;
|
||||
if (!cursor.next()) continue;
|
||||
bAlarmRecord = (BAlarmRecord)cursor.get();
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
bOrdList = BOrdList.add((BOrdList)bOrdList, (BOrd)bOrd);
|
||||
bAlarmRecord.setSource(bOrdList);
|
||||
this.sourceModel.update(bAlarmRecord);
|
||||
this.sourceTable.sizeColumnsToFit();
|
||||
while (cursor.next()) {
|
||||
bAlarmRecord = (BAlarmRecord)cursor.get();
|
||||
bOrdList = bAlarmRecord.getSource();
|
||||
bOrdList = BOrdList.add((BOrdList)bOrdList, (BOrd)bOrd);
|
||||
bAlarmRecord.setSource(bOrdList);
|
||||
this.sourceModel.update(bAlarmRecord, false);
|
||||
}
|
||||
this.sourceModel.sortByColumn(this.sourceModel.getLastSortColumn(), this.sourceModel.getLastSortAscending());
|
||||
this.sourceModel.updateTable();
|
||||
this.sourceTable.sizeColumnsToFit();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
this.exitBusy();
|
||||
this.loadComplete();
|
||||
this.sourceModel.init(this, this.ctx);
|
||||
this.sourceTable.sizeColumnsToFit();
|
||||
}
|
||||
}
|
||||
this.exitBusy();
|
||||
object2 = null;
|
||||
for (int i = 0; i < this.sourceModel.getRowCount(); ++i) {
|
||||
object = this.sourceModel.getRecord(i);
|
||||
if (object.isAlarm()) {
|
||||
this.soundAlarmFor((BAlarmRecord)((Object)object));
|
||||
}
|
||||
if (object2 == null) {
|
||||
object2 = object;
|
||||
continue;
|
||||
}
|
||||
if (!((BAlarmRecord)((Object)object2)).getTimestamp().isBefore(object.getTimestamp())) continue;
|
||||
object2 = object;
|
||||
}
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
this.sourceModel.init(this, this.ctx);
|
||||
}
|
||||
|
||||
protected void ackAlarms(BAlarmRecord[] bAlarmRecordArray) {
|
||||
try {
|
||||
BOrdList bOrdList;
|
||||
Object object;
|
||||
Hashtable<BConsoleRecipient, Array> hashtable = new Hashtable<BConsoleRecipient, Array>();
|
||||
for (int i = 0; i < bAlarmRecordArray.length && !((BAlarmRecord)((Object)(object = (BAlarmRecord)bAlarmRecordArray[i].newCopy()))).isAcknowledged(); ++i) {
|
||||
bOrdList = ((BAlarmRecord)((Object)object)).getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordFor(bOrd);
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
((BAlarmRecord)((Object)object)).setUser(this.getUsername((BAlarmRecord)((Object)object)));
|
||||
((BAlarmRecord)((Object)object)).setAckTime(BAbsTime.now());
|
||||
((BAlarmRecord)((Object)object)).setAckState(BAckState.ackPending);
|
||||
this.sourceModel.update((BAlarmRecord)((Object)object));
|
||||
Array array = (Array)hashtable.get((Object)bConsoleRecipient);
|
||||
if (array == null) {
|
||||
array = new Array(class$javax$baja$alarm$BAlarmRecord == null ? BPortalAlarmConsole.class$("javax.baja.alarm.BAlarmRecord") : class$javax$baja$alarm$BAlarmRecord);
|
||||
}
|
||||
BAlarmRecord bAlarmRecord = (BAlarmRecord)object.newCopy();
|
||||
bAlarmRecord.setSource(BOrdList.remove((BOrdList)((BAlarmRecord)((Object)object)).getSource(), (int)(((BAlarmRecord)((Object)object)).getSource().size() - 1)));
|
||||
array.add((Object)bAlarmRecord);
|
||||
hashtable.put(bConsoleRecipient, array);
|
||||
}
|
||||
Enumeration enumeration = hashtable.keys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
object = (BConsoleRecipient)((Object)enumeration.nextElement());
|
||||
bOrdList = (Array)hashtable.get(object);
|
||||
this.channel((BConsoleRecipient)((Object)object)).ackAlarms(this.tool.getAlarmPortalConsoleRecipient(), (BAlarmRecord[])bOrdList.trim());
|
||||
}
|
||||
this.sourceTable.sizeColumnsToFit();
|
||||
this.sourceTable.fireTableModified(null);
|
||||
if (this.alarmTable != null) {
|
||||
this.alarmTable.fireTableModified(null);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUsername(BAlarmRecord bAlarmRecord) {
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordFor(bOrd);
|
||||
if (bConsoleRecord == null) {
|
||||
return null;
|
||||
}
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
if (!bConsoleRecipient.isMounted()) {
|
||||
return null;
|
||||
}
|
||||
return ((BFoxSession)bConsoleRecipient.getSession()).getConnection().getUsername();
|
||||
}
|
||||
|
||||
public BAlarmService getAlarmService() {
|
||||
SourceTableModel sourceTableModel = (SourceTableModel)((DynamicTableModel)this.sourceModel.getModel()).getRootModel();
|
||||
BAlarmRecord bAlarmRecord = sourceTableModel.getRecord(this.sourceModel.getSelection().getSelection().getRow());
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
String string = bOrd.toString();
|
||||
string = string.substring(0, string.indexOf("|station:|"));
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordForStation(BOrd.make((String)string));
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
BOrd bOrd2 = BOrd.make((String)"service:alarm:AlarmService");
|
||||
BAlarmService bAlarmService = (BAlarmService)bOrd2.resolve((BObject)bConsoleRecipient).get();
|
||||
bAlarmService.lease();
|
||||
return bAlarmService;
|
||||
}
|
||||
|
||||
protected boolean canModifySelectedAlarms(TableSelection tableSelection) {
|
||||
if (tableSelection == null || tableSelection.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int[] nArray = tableSelection.getRows();
|
||||
SourceTableModel sourceTableModel = (SourceTableModel)((DynamicTableModel)this.sourceModel.getModel()).getRootModel();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
BAlarmRecord bAlarmRecord = sourceTableModel.getRecord(nArray[i]);
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
String string = bOrd.toString();
|
||||
string = string.substring(0, string.indexOf("|station:|"));
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordForStation(BOrd.make((String)string));
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
BOrd bOrd2 = BOrd.make((String)"service:alarm:AlarmService");
|
||||
BAlarmService bAlarmService = (BAlarmService)bOrd2.resolve((BObject)bConsoleRecipient).get();
|
||||
bAlarmService.lease();
|
||||
BAlarmClass bAlarmClass = bAlarmService.lookupAlarmClass(bAlarmRecord.getAlarmClass());
|
||||
if (!(bAlarmClass == null ? !bAlarmService.getDefaultAlarmClass().getPermissions(this.ctx).hasOperatorWrite() : !bAlarmClass.getPermissions(this.ctx).hasOperatorWrite())) continue;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void hyperlink(BAlarmRecord bAlarmRecord) {
|
||||
BWbShell bWbShell = this.getWbShell();
|
||||
if (bWbShell != null) {
|
||||
BAlarmClassDef bAlarmClassDef;
|
||||
BAlarmClassMapping bAlarmClassMapping;
|
||||
BOrd bOrd = BOrd.make((String)bAlarmRecord.getAlarmData().get("hyperlinkOrd").toString());
|
||||
if (bOrd == null || bOrd.isNull()) {
|
||||
bAlarmClassMapping = this.options.getAlarmClassMapping();
|
||||
bAlarmClassDef = bAlarmClassMapping.getAlarmClassDefFor(bAlarmRecord.getAlarmClass());
|
||||
bOrd = bAlarmClassDef.getAlarmUrl();
|
||||
}
|
||||
if (!bOrd.isNull()) {
|
||||
bAlarmClassMapping = bAlarmRecord.getSource();
|
||||
bAlarmClassDef = bAlarmClassMapping.get(bAlarmClassMapping.size() - 1);
|
||||
String string = bAlarmClassDef.toString();
|
||||
string = string.substring(0, string.indexOf("|station:|"));
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordForStation(BOrd.make((String)string));
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
BOrd bOrd2 = BOrd.make((BOrd)bConsoleRecipient.getNavOrd(), (BOrd)bOrd);
|
||||
bWbShell.hyperlink(bOrd2);
|
||||
if (this.detailsDlg != null) {
|
||||
this.detailsDlg.close();
|
||||
}
|
||||
if (this.alarmReport != null) {
|
||||
this.alarmReport.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void soundAlarmFor(BAlarmRecord bAlarmRecord) {
|
||||
BOrd bOrd = BOrd.NULL;
|
||||
if (bAlarmRecord.getAlarmData().get("soundFile") != null) {
|
||||
bOrd = BOrd.make((BOrd)BOrd.toSpace((BObject)this.getRecipientForAlarm(bAlarmRecord)).getNavOrd(), (String)bAlarmRecord.getAlarmData().get("soundFile").toString());
|
||||
}
|
||||
if (bOrd == null || bOrd.isNull()) {
|
||||
BAlarmClassMapping bAlarmClassMapping;
|
||||
BAlarmClassDef bAlarmClassDef = null;
|
||||
if (this.options != null && (bAlarmClassMapping = this.options.getAlarmClassMapping()) != null && (bAlarmClassDef = bAlarmClassMapping.getAlarmClassDefFor(bAlarmRecord.getAlarmClass())) != null) {
|
||||
bOrd = bAlarmClassDef.getAlarmSound();
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (bOrd == null || bOrd.isNull()) {
|
||||
this.soundAlarm(bAlarmRecord);
|
||||
} else {
|
||||
this.soundAlarm(bAlarmRecord.getSource(), bOrd);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
||||
protected BConsoleRecipient getRecipientForAlarm(BAlarmRecord bAlarmRecord) {
|
||||
if (bAlarmRecord == null) {
|
||||
return null;
|
||||
}
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
String string = bOrd.toString();
|
||||
string = string.substring(0, string.indexOf("|station:|"));
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordForStation(BOrd.make((String)string));
|
||||
return this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
}
|
||||
|
||||
public BAlarmService getAlarmService(BAlarmRecord bAlarmRecord) {
|
||||
BConsoleRecipient bConsoleRecipient = this.getRecipientForAlarm(bAlarmRecord);
|
||||
BConsoleRecord bConsoleRecord = this.tool.getRecordForRecipient(bConsoleRecipient);
|
||||
if (bConsoleRecipient == null) {
|
||||
return null;
|
||||
}
|
||||
if (bConsoleRecord == null || !bConsoleRecord.isInitialLoadComplete()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (BAlarmService)BOrd.make((String)"service:alarm:AlarmService").resolve((BObject)bConsoleRecipient).get();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendUpdatedAlarm(BAlarmRecord bAlarmRecord) throws Exception {
|
||||
BOrdList bOrdList = bAlarmRecord.getSource();
|
||||
BOrd bOrd = bOrdList.get(bOrdList.size() - 1);
|
||||
BConsoleRecord bConsoleRecord = this.tool.getConsoleRecordFor(bOrd);
|
||||
BConsoleRecipient bConsoleRecipient = this.tool.getRecipientForRecord(bConsoleRecord);
|
||||
BAlarmRecord bAlarmRecord2 = (BAlarmRecord)bAlarmRecord.newCopy();
|
||||
bAlarmRecord2.setSource(BOrdList.remove((BOrdList)bOrdList, (int)(bOrdList.size() - 1)));
|
||||
this.channel(bConsoleRecipient).updateAlarm(bAlarmRecord2);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class AlarmPortalTableCellRenderer
|
||||
extends BAlarmConsole.AlarmTableCellRenderer {
|
||||
public BBrush getForeground(TableCellRenderer.Cell cell) {
|
||||
int n = cell.row;
|
||||
BAlarmRecord bAlarmRecord = BPortalAlarmConsole.this.sourceModel.getRecord(n);
|
||||
BOrd bOrd = bAlarmRecord.getSource().get(bAlarmRecord.getSource().size() - 1);
|
||||
BConsoleRecipient bConsoleRecipient = (BConsoleRecipient)((Object)BPortalAlarmConsole.this.tool.recipients.get(bOrd.toString()));
|
||||
return bConsoleRecipient != null && bConsoleRecipient.isMounted() ? super.getForeground(cell) : BBrush.makeSolid((BColor)BColor.gray);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SourceModCursor
|
||||
implements Cursor {
|
||||
Cursor inner;
|
||||
BOrd srcAdd;
|
||||
BAlarmRecord rec;
|
||||
|
||||
public SourceModCursor(BOrd bOrd, Cursor cursor) {
|
||||
this.srcAdd = bOrd;
|
||||
this.inner = cursor;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return this.inner.getContext();
|
||||
}
|
||||
|
||||
public BObject get() {
|
||||
if (this.rec == null) {
|
||||
this.rec = (BAlarmRecord)this.inner.get();
|
||||
BOrdList bOrdList = this.rec.getSource();
|
||||
bOrdList = BOrdList.add((BOrdList)bOrdList, (BOrd)this.srcAdd);
|
||||
this.rec.setSource(bOrdList);
|
||||
}
|
||||
return this.rec;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
this.rec = null;
|
||||
return this.inner.next();
|
||||
}
|
||||
|
||||
public boolean nextComponent() {
|
||||
this.rec = null;
|
||||
return this.inner.nextComponent();
|
||||
}
|
||||
|
||||
public boolean next(Class clazz) {
|
||||
this.rec = null;
|
||||
return this.inner.next(clazz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.util.BDynamicTimeRange
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.alarm.ui.portal;
|
||||
|
||||
import com.tridium.alarm.BConsoleRecipient;
|
||||
import com.tridium.alarm.ui.portal.BAlarmPortalTool;
|
||||
import com.tridium.bql.util.BDynamicTimeRange;
|
||||
import javax.baja.alarm.BAlarmRecord;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class BPortalConsoleRecipient
|
||||
extends BConsoleRecipient {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$portal$BPortalConsoleRecipient == null ? (class$com$tridium$alarm$ui$portal$BPortalConsoleRecipient = BPortalConsoleRecipient.class$("com.tridium.alarm.ui.portal.BPortalConsoleRecipient")) : class$com$tridium$alarm$ui$portal$BPortalConsoleRecipient));
|
||||
BAlarmPortalTool tool;
|
||||
static /* synthetic */ Class class$com$tridium$alarm$ui$portal$BPortalConsoleRecipient;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BPortalConsoleRecipient() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public BPortalConsoleRecipient(BAlarmPortalTool bAlarmPortalTool) {
|
||||
this.tool = bAlarmPortalTool;
|
||||
}
|
||||
|
||||
public void handleAlarm(BAlarmRecord bAlarmRecord) {
|
||||
this.tool.handleAlarm(bAlarmRecord);
|
||||
}
|
||||
|
||||
public boolean accept(BAlarmRecord bAlarmRecord) {
|
||||
return this.tool.accept(bAlarmRecord);
|
||||
}
|
||||
|
||||
public BDynamicTimeRange getDefaultTimeRange() {
|
||||
return this.tool.options.getDefaultTimeRange();
|
||||
}
|
||||
|
||||
public void setDefaultTimeRange(BDynamicTimeRange bDynamicTimeRange) {
|
||||
this.tool.options.setDefaultTimeRange(bDynamicTimeRange);
|
||||
this.tool.options.save();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user