159 lines
6.1 KiB
Java
159 lines
6.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.sys.BBoolean
|
|
* javax.baja.sys.BComponent
|
|
* javax.baja.sys.BObject
|
|
* javax.baja.sys.BString
|
|
* javax.baja.sys.BValue
|
|
* javax.baja.sys.Context
|
|
* javax.baja.sys.Slot
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
* javax.baja.ui.BCheckBox
|
|
* javax.baja.ui.BTextField
|
|
* javax.baja.ui.BWidget
|
|
* javax.baja.ui.pane.BGridPane
|
|
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
|
*/
|
|
package com.tridium.alarm.ui;
|
|
|
|
import javax.baja.alarm.BAlarmTransitionBits;
|
|
import javax.baja.sys.BBoolean;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.BString;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Slot;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.ui.BCheckBox;
|
|
import javax.baja.ui.BTextField;
|
|
import javax.baja.ui.BWidget;
|
|
import javax.baja.ui.pane.BGridPane;
|
|
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
|
|
|
public class BAlarmTransitionBitsFE
|
|
extends BWbFieldEditor {
|
|
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BAlarmTransitionBitsFE == null ? (class$com$tridium$alarm$ui$BAlarmTransitionBitsFE = BAlarmTransitionBitsFE.class$("com.tridium.alarm.ui.BAlarmTransitionBitsFE")) : class$com$tridium$alarm$ui$BAlarmTransitionBitsFE));
|
|
static final String offnormalText = BAlarmTransitionBits.ALL.getTag(1);
|
|
static final String faultText = BAlarmTransitionBits.ALL.getTag(2);
|
|
static final String normalText = BAlarmTransitionBits.ALL.getTag(4);
|
|
static final String alertText = BAlarmTransitionBits.ALL.getTag(8);
|
|
public static final String SHOW_OFF_NORMAL = "showOffNormal";
|
|
public static final String SHOW_NORMAL = "showNormal";
|
|
public static final String SHOW_FAULT = "showFault";
|
|
public static final String SHOW_ALERT = "showAlert";
|
|
public static final String OFF_NORMAL_LABEL = "offNormalLabel";
|
|
public static final String NORMAL_LABEL = "normalLabel";
|
|
public static final String FAULT_LABEL = "faultLabel";
|
|
public static final String ALERT_LABEL = "alertLabel";
|
|
private boolean init = false;
|
|
private BCheckBox offnormal;
|
|
private BCheckBox fault;
|
|
private BCheckBox normal;
|
|
private BCheckBox alert;
|
|
static /* synthetic */ Class class$com$tridium$alarm$ui$BAlarmTransitionBitsFE;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
protected void doSetReadonly(boolean bl) {
|
|
this.init = false;
|
|
if (bl) {
|
|
this.setContent((BWidget)new BTextField("", 45, false));
|
|
}
|
|
}
|
|
|
|
protected void doLoadValue(BObject bObject, Context context) {
|
|
BAlarmTransitionBits bAlarmTransitionBits = (BAlarmTransitionBits)bObject;
|
|
if (this.isReadonly()) {
|
|
((BTextField)this.getContent()).setText(bObject.toString(context));
|
|
} else {
|
|
if (!this.init) {
|
|
this.initCheckBoxes(context);
|
|
}
|
|
this.offnormal.setSelected(bAlarmTransitionBits.isToOffnormal());
|
|
this.fault.setSelected(bAlarmTransitionBits.isToFault());
|
|
this.normal.setSelected(bAlarmTransitionBits.isToNormal());
|
|
this.alert.setSelected(bAlarmTransitionBits.isToAlert());
|
|
}
|
|
}
|
|
|
|
protected BObject doSaveValue(BObject bObject, Context context) {
|
|
int n = 0;
|
|
if (this.offnormal.isSelected()) {
|
|
n |= 1;
|
|
}
|
|
if (this.fault.isSelected()) {
|
|
n |= 2;
|
|
}
|
|
if (this.normal.isSelected()) {
|
|
n |= 4;
|
|
}
|
|
if (this.alert.isSelected()) {
|
|
n |= 8;
|
|
}
|
|
return BAlarmTransitionBits.make(n);
|
|
}
|
|
|
|
private void initCheckBoxes(Context context) {
|
|
this.init = true;
|
|
int n = 4;
|
|
if (this.getBooleanFacetValue(context, "multiLine", false)) {
|
|
n = 1;
|
|
}
|
|
BGridPane bGridPane = new BGridPane(n);
|
|
this.offnormal = new BCheckBox(this.getStringFacetValue(context, OFF_NORMAL_LABEL, offnormalText));
|
|
this.fault = new BCheckBox(this.getStringFacetValue(context, FAULT_LABEL, faultText));
|
|
this.normal = new BCheckBox(this.getStringFacetValue(context, NORMAL_LABEL, normalText));
|
|
this.alert = new BCheckBox(this.getStringFacetValue(context, ALERT_LABEL, alertText));
|
|
if (this.getBooleanFacetValue(context, SHOW_OFF_NORMAL, true)) {
|
|
bGridPane.add("offNormal", (BValue)this.offnormal, null);
|
|
}
|
|
if (this.getBooleanFacetValue(context, SHOW_FAULT, true)) {
|
|
bGridPane.add("fault", (BValue)this.fault, null);
|
|
}
|
|
if (this.getBooleanFacetValue(context, SHOW_NORMAL, true)) {
|
|
bGridPane.add("normal", (BValue)this.normal, null);
|
|
}
|
|
if (this.getBooleanFacetValue(context, SHOW_ALERT, true)) {
|
|
bGridPane.add("alert", (BValue)this.alert, null);
|
|
}
|
|
this.setContent((BWidget)bGridPane);
|
|
this.linkTo("l0", (BComponent)this.offnormal, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
|
this.linkTo("l1", (BComponent)this.fault, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
|
this.linkTo("l2", (BComponent)this.normal, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
|
this.linkTo("l3", (BComponent)this.alert, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
|
|
}
|
|
|
|
private boolean getBooleanFacetValue(Context context, String string, boolean bl) {
|
|
if (context == null) {
|
|
return bl;
|
|
}
|
|
BBoolean bBoolean = (BBoolean)context.getFacet(string);
|
|
return bBoolean == null ? bl : bBoolean.getBoolean();
|
|
}
|
|
|
|
private String getStringFacetValue(Context context, String string, String string2) {
|
|
if (context == null) {
|
|
return string2;
|
|
}
|
|
BString bString = (BString)context.getFacet(string);
|
|
return bString == null ? string2 : bString.toString();
|
|
}
|
|
|
|
static /* synthetic */ Class class$(String string) {
|
|
try {
|
|
return Class.forName(string);
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|