link start!
This commit is contained in:
@@ -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