2026-03-17 13:31:18 -07:00

128 lines
4.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.gx.BImage
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BObject
* javax.baja.sys.BString
* javax.baja.sys.BVector
* javax.baja.sys.Context
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextDropDown
* javax.baja.ui.BWidget
* javax.baja.workbench.BWbEditor
* javax.baja.workbench.fieldeditor.BWbFieldEditor
*/
package com.tridium.alarm.ui;
import com.tridium.alarm.print.BPrinterRecipient;
import javax.baja.gx.BImage;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BObject;
import javax.baja.sys.BString;
import javax.baja.sys.BVector;
import javax.baja.sys.Context;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextDropDown;
import javax.baja.ui.BWidget;
import javax.baja.workbench.BWbEditor;
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
public class BPrinterFE
extends BWbFieldEditor {
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$alarm$ui$BPrinterFE == null ? (class$com$tridium$alarm$ui$BPrinterFE = BPrinterFE.class$("com.tridium.alarm.ui.BPrinterFE")) : class$com$tridium$alarm$ui$BPrinterFE));
BTextDropDown field = new BTextDropDown("", 20, true);
String[] options;
static /* synthetic */ Class class$com$tridium$alarm$ui$BPrinterFE;
public Type getType() {
return TYPE;
}
public BPrinterFE() {
this.setContent((BWidget)this.field);
this.linkTo("la", (BComponent)this.field, (Slot)BTextDropDown.valueModified, (Slot)setModified);
this.linkTo("lb", (BComponent)this.field, (Slot)BTextDropDown.actionPerformed, (Slot)actionPerformed);
}
protected void doSetReadonly(boolean bl) {
this.field.getEditor().setEditable(!bl);
this.field.setDropDownEnabled(!bl);
}
protected void doLoadValue(BObject bObject, Context context) {
this.loadName(bObject.toString());
}
protected String[] list() {
BComplex bComplex;
BPrinterRecipient bPrinterRecipient = null;
for (bComplex = this.getParent(); bComplex != null && !(bComplex instanceof BWbEditor); bComplex = bComplex.getParent()) {
}
if (bComplex != null) {
bPrinterRecipient = (BPrinterRecipient)((BWbEditor)bComplex).getCurrentValue();
}
if (bPrinterRecipient != null) {
BVector bVector = bPrinterRecipient.getPrinters();
Slot[] slotArray = bVector.getSlotsArray();
String[] stringArray = new String[slotArray.length];
for (int i = 0; i < stringArray.length; ++i) {
stringArray[i] = bVector.get(slotArray[i].asProperty()).toString();
}
return stringArray;
}
return new String[0];
}
public void loadName(String string) {
this.field.setText(string);
this.field.getList().removeAllItems();
this.options = this.list();
String string2 = null;
if (this.options != null) {
for (int i = 0; i < this.options.length; ++i) {
if (this.options[i].equals(string)) {
string2 = this.options[i];
}
this.field.getList().addItem(BImage.make((BIcon)BIcon.std((String)"print.png")), (Object)this.options[i]);
}
}
if (string2 != null) {
this.field.setText(string2);
}
}
protected BObject doSaveValue(BObject bObject, Context context) {
return BString.make((String)this.saveName());
}
public String saveName() {
String string = this.field.getText();
for (int i = 0; i < this.options.length; ++i) {
if (!this.options[i].equals(string)) continue;
string = this.options[i];
break;
}
return string;
}
static /* synthetic */ Class class$(String string) {
try {
return Class.forName(string);
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
}