178 lines
7.1 KiB
Java
178 lines
7.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.tridium.ui.BOptionDialog
|
|
* com.tridium.ui.theme.Theme
|
|
* javax.baja.gx.BBrush
|
|
* javax.baja.io.ValueDocEncoder
|
|
* javax.baja.sys.Action
|
|
* javax.baja.sys.BComponent
|
|
* javax.baja.sys.BObject
|
|
* javax.baja.sys.BValue
|
|
* javax.baja.sys.Slot
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
* javax.baja.ui.BCheckBox
|
|
* javax.baja.ui.BDialog
|
|
* javax.baja.ui.BLabel
|
|
* javax.baja.ui.BListDropDown
|
|
* javax.baja.ui.BNullWidget
|
|
* javax.baja.ui.BWidget
|
|
* javax.baja.ui.enums.BHalign
|
|
* javax.baja.ui.enums.BScrollBarPolicy
|
|
* javax.baja.ui.enums.BValign
|
|
* javax.baja.ui.pane.BBorderPane
|
|
* javax.baja.ui.pane.BEdgePane
|
|
* javax.baja.ui.pane.BGridPane
|
|
* javax.baja.ui.pane.BScrollPane
|
|
* javax.baja.util.Lexicon
|
|
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
|
*/
|
|
package com.tridium.program.ui.batch;
|
|
|
|
import com.tridium.program.ui.batch.BBatchEditor;
|
|
import com.tridium.ui.BOptionDialog;
|
|
import com.tridium.ui.theme.Theme;
|
|
import javax.baja.gx.BBrush;
|
|
import javax.baja.io.ValueDocEncoder;
|
|
import javax.baja.sys.Action;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Slot;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.ui.BCheckBox;
|
|
import javax.baja.ui.BDialog;
|
|
import javax.baja.ui.BLabel;
|
|
import javax.baja.ui.BListDropDown;
|
|
import javax.baja.ui.BNullWidget;
|
|
import javax.baja.ui.BWidget;
|
|
import javax.baja.ui.enums.BHalign;
|
|
import javax.baja.ui.enums.BScrollBarPolicy;
|
|
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.pane.BScrollPane;
|
|
import javax.baja.util.Lexicon;
|
|
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
|
|
|
public class BSetDialog
|
|
extends BOptionDialog {
|
|
public static final Action propertyChanged = BSetDialog.newAction((int)0, null, null);
|
|
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BSetDialog == null ? (class$com$tridium$program$ui$batch$BSetDialog = BSetDialog.class$("com.tridium.program.ui.batch.BSetDialog")) : class$com$tridium$program$ui$batch$BSetDialog));
|
|
private static Lexicon lex = Lexicon.make((String)"program");
|
|
private BBatchEditor parent;
|
|
private BListDropDown dropDown;
|
|
private BWbFieldEditor editor;
|
|
private BCheckBox add;
|
|
private BBorderPane content;
|
|
static /* synthetic */ Class class$com$tridium$program$ui$batch$BSetDialog;
|
|
|
|
public void propertyChanged() {
|
|
this.invoke(propertyChanged, null, null);
|
|
}
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public static String open(BBatchEditor bBatchEditor) {
|
|
BSetDialog bSetDialog = new BSetDialog(bBatchEditor);
|
|
bSetDialog.setBoundsCenteredOnOwner();
|
|
bSetDialog.open();
|
|
if (bSetDialog.getResult() == 1) {
|
|
try {
|
|
String string = (String)bSetDialog.dropDown.getList().getSelectedItem();
|
|
BValue bValue = (BValue)bSetDialog.editor.saveValue();
|
|
String string2 = ValueDocEncoder.marshal((BValue)bValue);
|
|
string2 = string2.replaceAll("\"", "'");
|
|
string2 = string2.replaceAll("\n", "");
|
|
StringBuffer stringBuffer = new StringBuffer("set(ord, ");
|
|
stringBuffer.append("\"").append(string).append("\", ");
|
|
stringBuffer.append("\"").append(bValue.getType().getTypeSpec()).append("\", ");
|
|
stringBuffer.append("\"").append(string2).append("\", true, true);");
|
|
return stringBuffer.toString();
|
|
}
|
|
catch (Exception exception) {
|
|
BDialog.error((BWidget)bBatchEditor, (String)"Error", (Object)"Failed", (Throwable)exception);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private BSetDialog(BBatchEditor bBatchEditor) {
|
|
super((BWidget)bBatchEditor, lex.getText("batchEditor.commands.slotEdit.label"), (BWidget)new BNullWidget(), 3, null, null);
|
|
this.parent = bBatchEditor;
|
|
this.editor = this.make(BComponent.TYPE);
|
|
this.add = new BCheckBox(lex.getText("batchEditor.addIfNotExist"));
|
|
this.add.setSelected(true);
|
|
this.dropDown = new BListDropDown();
|
|
String[] stringArray = bBatchEditor.table.model.getAllColumns();
|
|
for (int i = 0; i < stringArray.length; ++i) {
|
|
this.dropDown.getList().addItem((Object)stringArray[i]);
|
|
}
|
|
this.linkTo((BComponent)this.dropDown, (Slot)BListDropDown.listActionPerformed, (Slot)propertyChanged);
|
|
BGridPane bGridPane = new BGridPane(2);
|
|
bGridPane.setHalign(BHalign.left);
|
|
bGridPane.add(null, (BValue)new BLabel(lex.getText("batchEditor.property")));
|
|
bGridPane.add(null, (BValue)this.dropDown);
|
|
BGridPane bGridPane2 = new BGridPane(1);
|
|
bGridPane2.setValign(BValign.top);
|
|
bGridPane2.setHalign(BHalign.left);
|
|
this.content = new BBorderPane((BWidget)this.editor, 1.0, 1.0, 1.0, 1.0);
|
|
bGridPane2.add(null, (BValue)this.content);
|
|
BEdgePane bEdgePane = new BEdgePane();
|
|
bEdgePane.setTop((BWidget)new BBorderPane((BWidget)bGridPane, 0.0, 0.0, 10.0, 0.0));
|
|
BBrush bBrush = Theme.scrollPane().getControlBackground();
|
|
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)bGridPane2, lex.getText("batchEditor.newValue")));
|
|
bScrollPane.setBorderPolicy(BScrollBarPolicy.asNeeded);
|
|
bScrollPane.setViewportBackground(bBrush);
|
|
bEdgePane.setCenter((BWidget)bScrollPane);
|
|
this.setContent((BWidget)new BBorderPane((BWidget)bEdgePane, 10.0, 10.0, 10.0, 10.0));
|
|
this.dropDown.getList().setSelectedIndex(0);
|
|
this.doPropertyChanged();
|
|
}
|
|
|
|
private BWbFieldEditor make(Type type) {
|
|
BObject bObject = type.getInstance();
|
|
BWbFieldEditor bWbFieldEditor = BWbFieldEditor.makeFor((BObject)bObject);
|
|
bWbFieldEditor.loadValue(bObject);
|
|
return bWbFieldEditor;
|
|
}
|
|
|
|
public void computePreferredSize() {
|
|
super.computePreferredSize();
|
|
double d = Math.max(500.0, this.getPreferredWidth());
|
|
double d2 = Math.max(300.0, this.getPreferredHeight());
|
|
this.setPreferredSize(d, d2);
|
|
}
|
|
|
|
public void doPropertyChanged() {
|
|
try {
|
|
String string = (String)this.dropDown.getList().getSelectedItem();
|
|
this.editor = this.parent.table.model.getColumnEditor(string);
|
|
this.content.setContent((BWidget)this.editor);
|
|
this.editor.loadValue(this.editor.getCurrentValue(), this.editor.getCurrentContext());
|
|
this.computePreferredSize();
|
|
this.setSize(this.getPreferredWidth(), this.getPreferredHeight());
|
|
this.setBoundsCenteredOnOwner();
|
|
}
|
|
catch (Exception exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ Class class$(String string) {
|
|
try {
|
|
return Class.forName(string);
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|