link start!
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.BOptionDialog
|
||||
* com.tridium.ui.theme.Theme
|
||||
* com.tridium.workbench.fieldeditors.BTypeSpecFE
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.io.ValueDocEncoder
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BBoolean
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* 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.BNullWidget
|
||||
* javax.baja.ui.BTextField
|
||||
* 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.BTypeSpec
|
||||
* 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 com.tridium.workbench.fieldeditors.BTypeSpecFE;
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.io.ValueDocEncoder;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.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.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BNullWidget;
|
||||
import javax.baja.ui.BTextField;
|
||||
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.BTypeSpec;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BAddDialog
|
||||
extends BOptionDialog {
|
||||
public static final Action typeChanged = BAddDialog.newAction((int)0, null, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BAddDialog == null ? (class$com$tridium$program$ui$batch$BAddDialog = BAddDialog.class$("com.tridium.program.ui.batch.BAddDialog")) : class$com$tridium$program$ui$batch$BAddDialog));
|
||||
private static Lexicon lex = Lexicon.make((String)"program");
|
||||
private BTextField name = new BTextField("", 30);
|
||||
private BTypeSpecFE type;
|
||||
private BWbFieldEditor editor;
|
||||
private BCheckBox setIfExists = new BCheckBox(lex.getText("batchEditor.setIfExists"));
|
||||
private BBorderPane content;
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BAddDialog;
|
||||
|
||||
public void typeChanged() {
|
||||
this.invoke(typeChanged, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static String open(BBatchEditor bBatchEditor) {
|
||||
BAddDialog bAddDialog = new BAddDialog(bBatchEditor);
|
||||
bAddDialog.setBoundsCenteredOnOwner();
|
||||
bAddDialog.open();
|
||||
if (bAddDialog.getResult() == 1) {
|
||||
try {
|
||||
if (SlotPath.isValidName((String)bAddDialog.name.getText())) {
|
||||
String string = bAddDialog.name.getText();
|
||||
BValue bValue = (BValue)bAddDialog.editor.saveValue();
|
||||
boolean bl = bAddDialog.setIfExists.isSelected();
|
||||
String string2 = ValueDocEncoder.marshal((BValue)bValue);
|
||||
string2 = string2.replaceAll("\"", "'");
|
||||
string2 = string2.replaceAll("\n", "");
|
||||
StringBuffer stringBuffer = new StringBuffer("add(ord, ");
|
||||
stringBuffer.append("\"").append(string).append("\", ");
|
||||
stringBuffer.append("\"").append(bValue.getType().getTypeSpec()).append("\", ");
|
||||
stringBuffer.append("\"").append(string2).append("\", ");
|
||||
stringBuffer.append(bl ? "true" : "false").append(");");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
BDialog.error((BWidget)bBatchEditor, (String)lex.getText("batchEditor.commands.slotAdd.label"), (Object)lex.getText("batchEditor.invalidName"));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)bBatchEditor, (String)"Error", (Object)"Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BAddDialog(BBatchEditor bBatchEditor) {
|
||||
super((BWidget)bBatchEditor, lex.getText("batchEditor.commands.slotAdd.label"), (BWidget)new BNullWidget(), 3, null, null);
|
||||
BFacets bFacets = BFacets.make((String)"allowNull", (BIDataValue)BBoolean.FALSE);
|
||||
bFacets = BFacets.make((BFacets)bFacets, (String)"showAbstract", (BIDataValue)BBoolean.FALSE);
|
||||
this.type = new BTypeSpecFE();
|
||||
this.linkTo("link", (BComponent)this.type, (Slot)BTypeSpecFE.pluginModified, (Slot)typeChanged);
|
||||
this.type.loadValue((BObject)BComponent.TYPE.getTypeSpec(), (Context)bFacets);
|
||||
this.setIfExists.setSelected(true);
|
||||
this.editor = this.make(BComponent.TYPE);
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setValign(BValign.top);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
this.content = new BBorderPane((BWidget)this.editor, 1.0, 1.0, 1.0, 1.0);
|
||||
bGridPane.add(null, (BValue)this.content);
|
||||
BGridPane bGridPane2 = new BGridPane(2);
|
||||
bGridPane2.add(null, (BValue)new BLabel(lex.getText("batchEditor.newName")));
|
||||
bGridPane2.add(null, (BValue)this.name);
|
||||
bGridPane2.add(null, (BValue)new BLabel(lex.getText("batchEditor.newType")));
|
||||
bGridPane2.add(null, (BValue)this.type);
|
||||
BGridPane bGridPane3 = new BGridPane(1);
|
||||
bGridPane3.setHalign(BHalign.left);
|
||||
bGridPane3.add(null, (BValue)bGridPane2);
|
||||
bGridPane3.add(null, (BValue)this.setIfExists);
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setTop((BWidget)new BBorderPane((BWidget)bGridPane3, 0.0, 0.0, 10.0, 0.0));
|
||||
BBrush bBrush = Theme.scrollPane().getControlBackground();
|
||||
BScrollPane bScrollPane = new BScrollPane((BWidget)new BBorderPane((BWidget)bGridPane, 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));
|
||||
}
|
||||
|
||||
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 doTypeChanged() {
|
||||
try {
|
||||
BObject bObject = ((BTypeSpec)this.type.saveValue()).getInstance();
|
||||
this.editor = this.make(bObject.getType());
|
||||
this.content.setContent((BWidget)this.editor);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.ui.transfer.BTransferWidget
|
||||
* javax.baja.workbench.view.BWbView
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.program.BProgramService;
|
||||
import com.tridium.program.ui.batch.BBatchTable;
|
||||
import com.tridium.program.ui.batch.BatchCommands;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BBorder;
|
||||
import javax.baja.ui.BButton;
|
||||
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.enums.BHalign;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.ui.transfer.BTransferWidget;
|
||||
import javax.baja.workbench.view.BWbView;
|
||||
|
||||
public class BBatchEditor
|
||||
extends BWbView {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BBatchEditor == null ? (class$com$tridium$program$ui$batch$BBatchEditor = BBatchEditor.class$("com.tridium.program.ui.batch.BBatchEditor")) : class$com$tridium$program$ui$batch$BBatchEditor));
|
||||
private static BBatchTable.Model model;
|
||||
BBatchTable table = new BBatchTable(this);
|
||||
BatchCommands commands;
|
||||
BProgramService service;
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BBatchEditor;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BBatchEditor() {
|
||||
if (model != null) {
|
||||
this.table.setModel(model.makeCopy());
|
||||
}
|
||||
this.commands = new BatchCommands(this);
|
||||
BGridPane bGridPane = new BGridPane(4);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.findObjects));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.clearAll));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.rename));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.slotAdd));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.slotEdit));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.slotRename));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.slotRemove));
|
||||
bGridPane.add(null, (BValue)new BButton((Command)this.commands.slotFlags));
|
||||
BEdgePane bEdgePane = new BEdgePane();
|
||||
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)this.table, BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
bEdgePane.setBottom((BWidget)new BBorderPane((BWidget)bGridPane, 5.0, 0.0, 0.0, 0.0));
|
||||
this.setContent((BWidget)bEdgePane);
|
||||
this.setTransferWidget((BTransferWidget)this.table);
|
||||
}
|
||||
|
||||
public BMenu[] getViewMenus() {
|
||||
return new BMenu[]{this.commands.buildMenu()};
|
||||
}
|
||||
|
||||
public BToolBar getViewToolBar() {
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add(null, (Command)this.commands.findObjects);
|
||||
bToolBar.add(null, (Command)this.commands.clear);
|
||||
bToolBar.add(null, (Command)this.commands.selectCols);
|
||||
bToolBar.add(null, (BValue)new BSeparator());
|
||||
bToolBar.add(null, (Command)this.commands.rename);
|
||||
bToolBar.add(null, (Command)this.commands.slotAdd);
|
||||
bToolBar.add(null, (Command)this.commands.slotEdit);
|
||||
bToolBar.add(null, (Command)this.commands.slotRename);
|
||||
bToolBar.add(null, (Command)this.commands.slotRemove);
|
||||
bToolBar.add(null, (Command)this.commands.slotFlags);
|
||||
return bToolBar;
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) throws Exception {
|
||||
this.service = (BProgramService)bObject;
|
||||
this.table.refresh();
|
||||
this.commands.updateCommands();
|
||||
}
|
||||
|
||||
public void deactivated() {
|
||||
super.deactivated();
|
||||
model = this.table.model;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.script.PropertyField
|
||||
* com.tridium.script.ScriptField
|
||||
* com.tridium.script.ScriptUtil
|
||||
* com.tridium.workbench.user.BPermissionsMapFE
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.space.Mark
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.event.BKeyEvent
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.transfer.TransferContext
|
||||
* javax.baja.ui.transfer.TransferFormat
|
||||
* 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.program.ui.batch.BatchCommands;
|
||||
import com.tridium.script.PropertyField;
|
||||
import com.tridium.script.ScriptField;
|
||||
import com.tridium.script.ScriptUtil;
|
||||
import com.tridium.workbench.user.BPermissionsMapFE;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.space.Mark;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.event.BKeyEvent;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
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.transfer.TransferContext;
|
||||
import javax.baja.ui.transfer.TransferFormat;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BBatchTable
|
||||
extends BTable {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BBatchTable == null ? (class$com$tridium$program$ui$batch$BBatchTable = BBatchTable.class$("com.tridium.program.ui.batch.BBatchTable")) : class$com$tridium$program$ui$batch$BBatchTable));
|
||||
private Lexicon lex = Lexicon.make((String)"program");
|
||||
BBatchEditor editor;
|
||||
Model model;
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BBatchTable;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BBatchTable(BBatchEditor bBatchEditor) {
|
||||
this.editor = bBatchEditor;
|
||||
this.model = new Model();
|
||||
this.setModel(this.model);
|
||||
this.setSelection(new Selection());
|
||||
this.setController(new Controller());
|
||||
this.setPasteEnabled(true);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
BatchCommands.lease(this.model.kids.toArray(new BComponent[this.model.kids.size()]));
|
||||
this.relayout();
|
||||
}
|
||||
|
||||
public void setModel(TableModel tableModel) {
|
||||
super.setModel(tableModel);
|
||||
if (tableModel instanceof Model) {
|
||||
this.model = (Model)tableModel;
|
||||
}
|
||||
}
|
||||
|
||||
public int dragOver(TransferContext transferContext) {
|
||||
Mark mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark);
|
||||
BObject[] bObjectArray = mark.getValues();
|
||||
for (int i = 0; i < bObjectArray.length; ++i) {
|
||||
if (!(bObjectArray[i] instanceof BComponent)) continue;
|
||||
return 16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public CommandArtifact drop(TransferContext transferContext) throws Exception {
|
||||
Mark mark = (Mark)transferContext.getEnvelope().getData(TransferFormat.mark);
|
||||
BObject[] bObjectArray = mark.getValues();
|
||||
ArrayList<BObject> arrayList = new ArrayList<BObject>();
|
||||
for (int i = 0; i < bObjectArray.length; ++i) {
|
||||
if (!(bObjectArray[i] instanceof BComponent) || this.model.kids.contains(bObjectArray[i])) continue;
|
||||
arrayList.add(bObjectArray[i]);
|
||||
this.model.kids.add(bObjectArray[i]);
|
||||
}
|
||||
BatchCommands.lease(arrayList.toArray(new BComponent[arrayList.size()]));
|
||||
this.sizeColumnsToFit();
|
||||
this.relayout();
|
||||
this.editor.commands.updateCommands();
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommandArtifact insertTransferData(TransferContext transferContext) throws Exception {
|
||||
return this.drop(transferContext);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TableController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
public void keyPressed(BKeyEvent bKeyEvent) {
|
||||
if (bKeyEvent.getKeyCode() == 127) {
|
||||
bKeyEvent.consume();
|
||||
BBatchTable.this.editor.commands.clear.invoke();
|
||||
} else {
|
||||
super.keyPressed(bKeyEvent);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
BMenu bMenu = BBatchTable.this.editor.commands.buildMenu();
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void backgroundPopup(BMouseEvent bMouseEvent) {
|
||||
BMenu bMenu = BBatchTable.this.editor.commands.buildMenu();
|
||||
bMenu.open((BWidget)this.getTable(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
}
|
||||
|
||||
class Selection
|
||||
extends TableSelection {
|
||||
Selection() {
|
||||
}
|
||||
|
||||
public void updateTable() {
|
||||
super.updateTable();
|
||||
BBatchTable.this.editor.commands.updateCommands();
|
||||
}
|
||||
}
|
||||
|
||||
class Model
|
||||
extends TableModel {
|
||||
ArrayList cols = new ArrayList();
|
||||
ArrayList kids = new ArrayList();
|
||||
HashMap hash = new HashMap();
|
||||
|
||||
private Model() {
|
||||
this.cols.add(BBatchTable.this.lex.getText("batchEditor.object"));
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.cols.size();
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
return (String)this.cols.get(n);
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.kids.size();
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
BComponent bComponent = (BComponent)this.kids.get(n);
|
||||
if (n2 == 0) {
|
||||
return SlotPath.unescape((String)bComponent.getSlotPath().getBody());
|
||||
}
|
||||
BValue bValue = bComponent.get((String)this.cols.get(n2));
|
||||
return bValue == null ? "n/a" : String.valueOf(bValue);
|
||||
}
|
||||
|
||||
public BImage getRowIcon(int n) {
|
||||
BImage bImage = (BImage)this.hash.get(this.kids.get(n));
|
||||
if (bImage == null) {
|
||||
Object e = this.kids.get(n);
|
||||
bImage = BImage.make((BIcon)((BObject)e).getIcon());
|
||||
this.hash.put(e, bImage);
|
||||
}
|
||||
return bImage;
|
||||
}
|
||||
|
||||
public String[] getAllColumns() {
|
||||
return this.getAllColumns(true);
|
||||
}
|
||||
|
||||
public String[] getAllColumns(boolean bl) {
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
for (int i = 0; i < this.kids.size(); ++i) {
|
||||
ScriptField[] scriptFieldArray = ScriptUtil.scriptFields(this.kids.get(i));
|
||||
for (int j = 0; j < scriptFieldArray.length; ++j) {
|
||||
boolean bl2;
|
||||
if (!scriptFieldArray[j].isProperty() || arrayList.contains(scriptFieldArray[j].scriptName()) || (scriptFieldArray[j].scriptFlags(this.kids.get(i)) & 1) != 0 || (scriptFieldArray[j].scriptType().getModifiers() & 0x400) != 0) continue;
|
||||
boolean bl3 = bl2 = scriptFieldArray[j].isProperty() && ((PropertyField)scriptFieldArray[j]).getProperty().isFrozen();
|
||||
if (!bl && (bl || bl2)) continue;
|
||||
arrayList.add(scriptFieldArray[j].scriptName());
|
||||
}
|
||||
}
|
||||
Object[] objectArray = arrayList.toArray(new String[arrayList.size()]);
|
||||
Arrays.sort(objectArray);
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public Class getColumnType(String string) {
|
||||
for (int i = 0; i < this.kids.size(); ++i) {
|
||||
ScriptField[] scriptFieldArray = ScriptUtil.scriptFields(this.kids.get(i));
|
||||
for (int j = 0; j < scriptFieldArray.length; ++j) {
|
||||
if (!string.equals(scriptFieldArray[j].scriptName())) continue;
|
||||
return scriptFieldArray[j].scriptType();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BWbFieldEditor getColumnEditor(String string) {
|
||||
for (int i = 0; i < this.kids.size(); ++i) {
|
||||
ScriptField[] scriptFieldArray = ScriptUtil.scriptFields(this.kids.get(i));
|
||||
for (int j = 0; j < scriptFieldArray.length; ++j) {
|
||||
BWbFieldEditor bWbFieldEditor;
|
||||
if (!string.equals(scriptFieldArray[j].scriptName())) continue;
|
||||
Context context = null;
|
||||
BObject bObject = null;
|
||||
if (this.kids.get(i) instanceof BComponent && (bWbFieldEditor = ((BComponent)this.kids.get(i)).getSlot(scriptFieldArray[j].scriptName())) != null && bWbFieldEditor.isProperty()) {
|
||||
context = bWbFieldEditor.asProperty().getFacets();
|
||||
bObject = bWbFieldEditor.asProperty().getDefaultValue();
|
||||
}
|
||||
if (bObject == null) {
|
||||
bObject = Sys.getType((Class)scriptFieldArray[j].scriptType()).getInstance();
|
||||
}
|
||||
if ((bWbFieldEditor = BWbFieldEditor.makeFor(bObject, context)) instanceof BPermissionsMapFE && (context == null || context.getFacets().isNull())) {
|
||||
context = BBatchTable.this.editor.getCurrentContext();
|
||||
}
|
||||
bWbFieldEditor.loadValue(bObject, context);
|
||||
return bWbFieldEditor;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Model makeCopy() {
|
||||
int n;
|
||||
ArrayList<BComponent> arrayList = new ArrayList<BComponent>();
|
||||
Model model = new Model();
|
||||
for (n = 1; n < this.cols.size(); ++n) {
|
||||
model.cols.add(this.cols.get(n));
|
||||
}
|
||||
for (n = 0; n < this.kids.size(); ++n) {
|
||||
BComponent bComponent = (BComponent)this.kids.get(n);
|
||||
if (!bComponent.isMounted()) continue;
|
||||
arrayList.add(bComponent);
|
||||
model.kids.add(bComponent);
|
||||
}
|
||||
BatchCommands.lease(arrayList.toArray(new BComponent[arrayList.size()]));
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.BOptionDialog
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BListDropDown
|
||||
* javax.baja.ui.BNullWidget
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.program.ui.batch.BBatchEditor;
|
||||
import com.tridium.ui.BOptionDialog;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
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.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BRemoveDialog
|
||||
extends BOptionDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BRemoveDialog == null ? (class$com$tridium$program$ui$batch$BRemoveDialog = BRemoveDialog.class$("com.tridium.program.ui.batch.BRemoveDialog")) : class$com$tridium$program$ui$batch$BRemoveDialog));
|
||||
private static Lexicon lex = Lexicon.make((String)"program");
|
||||
BListDropDown dropDown = new BListDropDown();
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BRemoveDialog;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static String open(BBatchEditor bBatchEditor) {
|
||||
BRemoveDialog bRemoveDialog = new BRemoveDialog(bBatchEditor);
|
||||
bRemoveDialog.setBoundsCenteredOnOwner();
|
||||
bRemoveDialog.open();
|
||||
if (bRemoveDialog.getResult() == 1) {
|
||||
try {
|
||||
String string = (String)bRemoveDialog.dropDown.getSelectedItem();
|
||||
StringBuffer stringBuffer = new StringBuffer("remove(ord, ");
|
||||
stringBuffer.append("\"").append(string).append("\", true, true);");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)bBatchEditor, (String)"Error", (Object)"Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BRemoveDialog(BBatchEditor bBatchEditor) {
|
||||
super((BWidget)bBatchEditor, lex.getText("batchEditor.commands.slotRemove.label"), (BWidget)new BNullWidget(), 3, null, null);
|
||||
String[] stringArray = bBatchEditor.table.model.getAllColumns(false);
|
||||
for (int i = 0; i < stringArray.length; ++i) {
|
||||
this.dropDown.getList().addItem((Object)stringArray[i]);
|
||||
}
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add(null, (BValue)new BLabel(lex.getText("batchEditor.property")));
|
||||
bGridPane.add(null, (BValue)this.dropDown);
|
||||
this.setContent((BWidget)new BBorderPane((BWidget)bGridPane, 10.0, 10.0, 10.0, 10.0));
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.BOptionDialog
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BCheckBox
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BNullWidget
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.program.ui.batch.BBatchEditor;
|
||||
import com.tridium.ui.BOptionDialog;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BValue;
|
||||
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.BNullWidget;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BRenameDialog
|
||||
extends BOptionDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BRenameDialog == null ? (class$com$tridium$program$ui$batch$BRenameDialog = BRenameDialog.class$("com.tridium.program.ui.batch.BRenameDialog")) : class$com$tridium$program$ui$batch$BRenameDialog));
|
||||
private static Lexicon lex = Lexicon.make((String)"program");
|
||||
private BTextField find = new BTextField("", 30);
|
||||
private BTextField replace = new BTextField("", 30);
|
||||
private BCheckBox matchCase = new BCheckBox(lex.getText("batchEditor.matchCase"));
|
||||
private BCheckBox matchWord = new BCheckBox(lex.getText("batchEditor.matchWord"));
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BRenameDialog;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static String open(BBatchEditor bBatchEditor, boolean bl) {
|
||||
BRenameDialog bRenameDialog = new BRenameDialog(bBatchEditor, bl);
|
||||
bRenameDialog.setBoundsCenteredOnOwner();
|
||||
bRenameDialog.open();
|
||||
if (bRenameDialog.getResult() == 1) {
|
||||
try {
|
||||
String string = SlotPath.escape((String)bRenameDialog.find.getText());
|
||||
String string2 = SlotPath.escape((String)bRenameDialog.replace.getText());
|
||||
StringBuffer stringBuffer = new StringBuffer(bl ? "rename" : "componentRename");
|
||||
stringBuffer.append("(ord, ");
|
||||
stringBuffer.append("\"").append(string).append("\", ");
|
||||
stringBuffer.append("\"").append(string2).append("\", ");
|
||||
stringBuffer.append(bRenameDialog.matchCase.isSelected() ? "true" : "false").append(", ");
|
||||
stringBuffer.append(bRenameDialog.matchWord.isSelected() ? "true" : "false").append(");");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)bBatchEditor, (String)"Error", (Object)"Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BRenameDialog(BBatchEditor bBatchEditor, boolean bl) {
|
||||
super((BWidget)bBatchEditor, lex.getText(bl ? "batchEditor.commands.slotRename.label" : "batchEditor.commands.rename.label"), (BWidget)new BNullWidget(), 3, null, null);
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.add(null, (BValue)new BLabel(lex.getText("batchEditor.find")));
|
||||
bGridPane.add(null, (BValue)this.find);
|
||||
bGridPane.add(null, (BValue)new BLabel(lex.getText("batchEditor.replace")));
|
||||
bGridPane.add(null, (BValue)this.replace);
|
||||
BGridPane bGridPane2 = new BGridPane(1);
|
||||
bGridPane2.add(null, (BValue)this.matchCase);
|
||||
bGridPane2.add(null, (BValue)this.matchWord);
|
||||
BGridPane bGridPane3 = new BGridPane(1);
|
||||
bGridPane3.add(null, (BValue)bGridPane);
|
||||
bGridPane3.add(null, (BValue)bGridPane2);
|
||||
this.setContent((BWidget)new BBorderPane((BWidget)bGridPane3, 10.0, 10.0, 10.0, 10.0));
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.BOptionDialog
|
||||
* com.tridium.workbench.util.BFlagConfig
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BIPropertyContainer
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Flags
|
||||
* javax.baja.sys.Flags$Flag
|
||||
* javax.baja.sys.Property
|
||||
* 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.BRadioButton
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.ToggleCommandGroup
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.program.ui.batch.BBatchEditor;
|
||||
import com.tridium.ui.BOptionDialog;
|
||||
import com.tridium.workbench.util.BFlagConfig;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIPropertyContainer;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Flags;
|
||||
import javax.baja.sys.Property;
|
||||
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.BRadioButton;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.ToggleCommandGroup;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BSetFlagsDialog
|
||||
extends BOptionDialog {
|
||||
public static final Action propertyChanged = BSetFlagsDialog.newAction((int)0, null, null);
|
||||
public static final Action useSelectionChanged = BSetFlagsDialog.newAction((int)0, null, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$program$ui$batch$BSetFlagsDialog == null ? (class$com$tridium$program$ui$batch$BSetFlagsDialog = BSetFlagsDialog.class$("com.tridium.program.ui.batch.BSetFlagsDialog")) : class$com$tridium$program$ui$batch$BSetFlagsDialog));
|
||||
private static Lexicon lex = Lexicon.make((String)"program");
|
||||
private static final FlagWrapper[] FLAGS;
|
||||
private static final Object USE_SELECTED_COMPONENTS;
|
||||
private BBatchEditor parent;
|
||||
private BListDropDown dropDown;
|
||||
private BListDropDown flagDropDown;
|
||||
private BCheckBox useSelection = new BCheckBox(lex.getText("batchEditor.setFlagsOnSelectedObjects"));
|
||||
private SetFlag setFlag;
|
||||
private RemoveFlag removeFlag;
|
||||
private Hashtable validFlags;
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BSetFlagsDialog;
|
||||
|
||||
public void propertyChanged() {
|
||||
this.invoke(propertyChanged, null, null);
|
||||
}
|
||||
|
||||
public void useSelectionChanged() {
|
||||
this.invoke(useSelectionChanged, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static String open(BBatchEditor bBatchEditor) {
|
||||
BSetFlagsDialog bSetFlagsDialog = new BSetFlagsDialog(bBatchEditor);
|
||||
bSetFlagsDialog.setBoundsCenteredOnOwner();
|
||||
bSetFlagsDialog.open();
|
||||
if (bSetFlagsDialog.getResult() == 1) {
|
||||
try {
|
||||
boolean bl = bSetFlagsDialog.useSelection.isSelected();
|
||||
String string = bl ? "null" : (String)bSetFlagsDialog.dropDown.getList().getSelectedItem();
|
||||
int n = ((FlagWrapper)bSetFlagsDialog.flagDropDown.getList().getSelectedItem()).flag.getMask();
|
||||
boolean bl2 = bSetFlagsDialog.setFlag.isSelected();
|
||||
StringBuffer stringBuffer = new StringBuffer("setFlag(ord, ");
|
||||
stringBuffer.append("\"").append(string).append("\", ").append(n);
|
||||
stringBuffer.append(bl ? ", true" : ", false");
|
||||
stringBuffer.append(bl2 ? ", true);" : ", false);");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)bBatchEditor, (String)"Error", (Object)"Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BSetFlagsDialog(BBatchEditor bBatchEditor) {
|
||||
super((BWidget)bBatchEditor, lex.getText("batchEditor.commands.slotFlags.label"), (BWidget)new BNullWidget(), 3, null, null);
|
||||
Object object;
|
||||
Object object2;
|
||||
Object object3;
|
||||
this.useSelection.setSelected(false);
|
||||
this.linkTo((BComponent)this.useSelection, (Slot)BCheckBox.actionPerformed, (Slot)useSelectionChanged);
|
||||
int n = bBatchEditor.table.model.kids.size();
|
||||
this.validFlags = new Hashtable();
|
||||
String string = null;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
Object object4;
|
||||
Slot slot;
|
||||
Property property;
|
||||
object3 = (BComponent)bBatchEditor.table.model.kids.get(i);
|
||||
object2 = object3.getParent();
|
||||
if (object2 instanceof BComponent && (property = object3.getPropertyInParent()) != null) {
|
||||
int n2;
|
||||
slot = new BFlagConfig((BIPropertyContainer)((BComponent)object2), new Slot[]{property});
|
||||
object4 = (boolean[])this.validFlags.get(USE_SELECTED_COMPONENTS);
|
||||
if (object4 == null) {
|
||||
object4 = new boolean[FLAGS.length];
|
||||
for (n2 = 0; n2 < FLAGS.length; ++n2) {
|
||||
object4[n2] = slot.isEnabled(BSetFlagsDialog.FLAGS[n2].flag);
|
||||
}
|
||||
} else {
|
||||
for (n2 = 0; n2 < FLAGS.length; ++n2) {
|
||||
object4[n2] = object4[n2] != false && slot.isEnabled(BSetFlagsDialog.FLAGS[n2].flag);
|
||||
}
|
||||
}
|
||||
this.validFlags.put(USE_SELECTED_COMPONENTS, object4);
|
||||
}
|
||||
property = object3.getSlots();
|
||||
while (property.next()) {
|
||||
int n3;
|
||||
slot = property.slot();
|
||||
object4 = slot.getName();
|
||||
if (string == null) {
|
||||
string = object4;
|
||||
}
|
||||
BFlagConfig bFlagConfig = new BFlagConfig((BIPropertyContainer)object3, new Slot[]{slot});
|
||||
object = (boolean[])this.validFlags.get(object4);
|
||||
if (object == null) {
|
||||
object = new boolean[FLAGS.length];
|
||||
for (n3 = 0; n3 < FLAGS.length; ++n3) {
|
||||
object[n3] = bFlagConfig.isEnabled(BSetFlagsDialog.FLAGS[n3].flag);
|
||||
}
|
||||
} else {
|
||||
for (n3 = 0; n3 < FLAGS.length; ++n3) {
|
||||
object[n3] = object[n3] && bFlagConfig.isEnabled(BSetFlagsDialog.FLAGS[n3].flag);
|
||||
}
|
||||
}
|
||||
this.validFlags.put(object4, object);
|
||||
}
|
||||
}
|
||||
this.dropDown = new BListDropDown();
|
||||
ArrayList<String> arrayList = new ArrayList<String>();
|
||||
object3 = this.validFlags.keys();
|
||||
while (object3.hasMoreElements()) {
|
||||
object2 = object3.nextElement();
|
||||
if (object2 == USE_SELECTED_COMPONENTS) continue;
|
||||
arrayList.add((String)object2);
|
||||
}
|
||||
object2 = arrayList.toArray(new String[arrayList.size()]);
|
||||
Arrays.sort((Object[])object2);
|
||||
for (int i = 0; i < ((Object[])object2).length; ++i) {
|
||||
this.dropDown.getList().addItem(object2[i]);
|
||||
}
|
||||
if (((Object[])object2).length > 0) {
|
||||
this.dropDown.getList().setSelectedIndex(0);
|
||||
}
|
||||
this.linkTo((BComponent)this.dropDown, (Slot)BListDropDown.listActionPerformed, (Slot)propertyChanged);
|
||||
this.flagDropDown = new BListDropDown();
|
||||
if (string != null) {
|
||||
boolean[] blArray = (boolean[])this.validFlags.get(string);
|
||||
boolean bl = false;
|
||||
for (int i = 0; i < FLAGS.length; ++i) {
|
||||
if (!blArray[i]) continue;
|
||||
this.flagDropDown.getList().addItem((Object)FLAGS[i]);
|
||||
bl = true;
|
||||
}
|
||||
if (bl) {
|
||||
this.flagDropDown.getList().setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
BGridPane bGridPane = new BGridPane(1);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
bGridPane.add(null, (BValue)this.useSelection);
|
||||
BGridPane bGridPane2 = new BGridPane(2);
|
||||
bGridPane2.setHalign(BHalign.left);
|
||||
bGridPane2.add(null, (BValue)new BLabel(lex.getText("batchEditor.slot")));
|
||||
bGridPane2.add(null, (BValue)this.dropDown);
|
||||
bGridPane2.add(null, (BValue)new BLabel(lex.getText("batchEditor.flag")));
|
||||
bGridPane2.add(null, (BValue)this.flagDropDown);
|
||||
ToggleCommandGroup toggleCommandGroup = new ToggleCommandGroup();
|
||||
this.setFlag = new SetFlag((BWidget)this);
|
||||
toggleCommandGroup.add((ToggleCommand)this.setFlag);
|
||||
this.removeFlag = new RemoveFlag((BWidget)this);
|
||||
toggleCommandGroup.add((ToggleCommand)this.removeFlag);
|
||||
this.setFlag.setSelected(true);
|
||||
BGridPane bGridPane3 = new BGridPane(2);
|
||||
bGridPane3.setHalign(BHalign.left);
|
||||
bGridPane3.add(null, (BValue)new BRadioButton((ToggleCommand)this.setFlag));
|
||||
bGridPane3.add(null, (BValue)new BRadioButton((ToggleCommand)this.removeFlag));
|
||||
object = new BGridPane(1);
|
||||
object.setHalign(BHalign.left);
|
||||
object.add(null, (BValue)bGridPane);
|
||||
object.add(null, (BValue)bGridPane2);
|
||||
object.add(null, (BValue)bGridPane3);
|
||||
this.setContent((BWidget)new BBorderPane((BWidget)object, 10.0, 10.0, 10.0, 10.0));
|
||||
}
|
||||
|
||||
public void doPropertyChanged() {
|
||||
try {
|
||||
String string = (String)this.dropDown.getList().getSelectedItem();
|
||||
if (string == null) {
|
||||
this.flagDropDown.getList().removeAllItems();
|
||||
this.flagDropDown.getList().setSelectedIndex(0);
|
||||
return;
|
||||
}
|
||||
boolean[] blArray = (boolean[])this.validFlags.get(string);
|
||||
Object object = this.flagDropDown.getSelectedItem();
|
||||
FlagWrapper flagWrapper = null;
|
||||
this.flagDropDown.getList().removeAllItems();
|
||||
for (int i = 0; i < FLAGS.length; ++i) {
|
||||
if (!blArray[i]) continue;
|
||||
this.flagDropDown.getList().addItem((Object)FLAGS[i]);
|
||||
if (FLAGS[i] != object) continue;
|
||||
flagWrapper = FLAGS[i];
|
||||
}
|
||||
if (flagWrapper != null) {
|
||||
this.flagDropDown.getList().setSelectedItem(flagWrapper);
|
||||
} else {
|
||||
this.flagDropDown.getList().setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void doUseSelectionChanged() {
|
||||
boolean bl = !this.useSelection.isSelected();
|
||||
this.dropDown.setEnabled(bl);
|
||||
if (!bl) {
|
||||
boolean[] blArray = (boolean[])this.validFlags.get(USE_SELECTED_COMPONENTS);
|
||||
Object object = this.flagDropDown.getSelectedItem();
|
||||
FlagWrapper flagWrapper = null;
|
||||
this.flagDropDown.getList().removeAllItems();
|
||||
for (int i = 0; i < FLAGS.length; ++i) {
|
||||
if (!blArray[i]) continue;
|
||||
this.flagDropDown.getList().addItem((Object)FLAGS[i]);
|
||||
if (FLAGS[i] != object) continue;
|
||||
flagWrapper = FLAGS[i];
|
||||
}
|
||||
if (flagWrapper != null) {
|
||||
this.flagDropDown.getList().setSelectedItem(flagWrapper);
|
||||
} else {
|
||||
this.flagDropDown.getList().setSelectedIndex(0);
|
||||
}
|
||||
} else {
|
||||
this.doPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Flags.Flag[] flagArray = Flags.getFlags();
|
||||
FLAGS = new FlagWrapper[flagArray.length];
|
||||
for (int i = 0; i < flagArray.length; ++i) {
|
||||
BSetFlagsDialog.FLAGS[i] = new FlagWrapper(flagArray[i]);
|
||||
}
|
||||
USE_SELECTED_COMPONENTS = new Object();
|
||||
}
|
||||
|
||||
static class RemoveFlag
|
||||
extends ToggleCommand {
|
||||
RemoveFlag(BWidget bWidget) {
|
||||
super(bWidget, lex.getText("batchEditor.removeFlag"));
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static class SetFlag
|
||||
extends ToggleCommand {
|
||||
SetFlag(BWidget bWidget) {
|
||||
super(bWidget, lex.getText("batchEditor.setFlag"));
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static class FlagWrapper {
|
||||
Flags.Flag flag;
|
||||
|
||||
public FlagWrapper(Flags.Flag flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.flag.getDisplayName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,441 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.bql.BSelect
|
||||
* com.tridium.bql.SelectQuery
|
||||
* com.tridium.bql.expression.BPath
|
||||
* com.tridium.workbench.bql.builder.BBqlQueryBuilder
|
||||
* javax.baja.collection.BICollection
|
||||
* javax.baja.collection.BITable
|
||||
* javax.baja.collection.ColumnList
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.query.BExpression
|
||||
* javax.baja.query.BProjectionColumn
|
||||
* javax.baja.query.util.Columns
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BModule
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.commands.PasteCommand
|
||||
* javax.baja.ui.list.BCheckList
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BConstrainedPane
|
||||
* javax.baja.ui.transfer.BTransferWidget
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.bql.BSelect;
|
||||
import com.tridium.bql.SelectQuery;
|
||||
import com.tridium.bql.expression.BPath;
|
||||
import com.tridium.program.ui.batch.BAddDialog;
|
||||
import com.tridium.program.ui.batch.BBatchEditor;
|
||||
import com.tridium.program.ui.batch.BBatchTable;
|
||||
import com.tridium.program.ui.batch.BRemoveDialog;
|
||||
import com.tridium.program.ui.batch.BRenameDialog;
|
||||
import com.tridium.program.ui.batch.BSetDialog;
|
||||
import com.tridium.program.ui.batch.BSetFlagsDialog;
|
||||
import com.tridium.program.ui.batch.BatchCompiler;
|
||||
import com.tridium.workbench.bql.builder.BBqlQueryBuilder;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.collection.BICollection;
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.collection.ColumnList;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.query.BExpression;
|
||||
import javax.baja.query.BProjectionColumn;
|
||||
import javax.baja.query.util.Columns;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.ui.BBorder;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.commands.PasteCommand;
|
||||
import javax.baja.ui.list.BCheckList;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BConstrainedPane;
|
||||
import javax.baja.ui.transfer.BTransferWidget;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BatchCommands {
|
||||
private static BModule module = Sys.getModuleForClass((Class)(class$com$tridium$program$ui$batch$BBatchEditor == null ? (class$com$tridium$program$ui$batch$BBatchEditor = BatchCommands.class$("com.tridium.program.ui.batch.BBatchEditor")) : class$com$tridium$program$ui$batch$BBatchEditor));
|
||||
private static Lexicon lex = Lexicon.make((String)"program");
|
||||
private BBatchEditor editor;
|
||||
private BBqlQueryBuilder builder;
|
||||
FindObjects findObjects;
|
||||
Clear clear;
|
||||
ClearAll clearAll;
|
||||
SelectColumns selectCols;
|
||||
Rename rename;
|
||||
SlotAdd slotAdd;
|
||||
SlotEdit slotEdit;
|
||||
SlotRename slotRename;
|
||||
SlotRemove slotRemove;
|
||||
SlotFlags slotFlags;
|
||||
Hyperlink hyperlink;
|
||||
static /* synthetic */ Class class$com$tridium$program$ui$batch$BBatchEditor;
|
||||
|
||||
public BatchCommands(BBatchEditor bBatchEditor) {
|
||||
this.editor = bBatchEditor;
|
||||
this.findObjects = new FindObjects();
|
||||
this.clear = new Clear();
|
||||
this.clearAll = new ClearAll();
|
||||
this.selectCols = new SelectColumns();
|
||||
this.rename = new Rename();
|
||||
this.slotAdd = new SlotAdd();
|
||||
this.slotEdit = new SlotEdit();
|
||||
this.slotRename = new SlotRename();
|
||||
this.slotRemove = new SlotRemove();
|
||||
this.slotFlags = new SlotFlags();
|
||||
this.hyperlink = new Hyperlink();
|
||||
}
|
||||
|
||||
public void updateCommands() {
|
||||
boolean bl = this.editor.table.getModel().getRowCount() > 0;
|
||||
boolean bl2 = this.editor.table.getSelection().getRows().length > 0;
|
||||
boolean bl3 = this.editor.table.getSelection().getRows().length == 1;
|
||||
this.clear.setEnabled(bl && bl2);
|
||||
this.clearAll.setEnabled(bl);
|
||||
this.selectCols.setEnabled(bl);
|
||||
this.rename.setEnabled(bl);
|
||||
this.slotAdd.setEnabled(bl);
|
||||
this.slotEdit.setEnabled(bl);
|
||||
this.slotRename.setEnabled(bl);
|
||||
this.slotRemove.setEnabled(bl);
|
||||
this.slotFlags.setEnabled(bl);
|
||||
this.hyperlink.setEnabled(bl && bl3);
|
||||
}
|
||||
|
||||
public BMenu buildMenu() {
|
||||
BMenu bMenu = new BMenu(lex.getText("batchEditor"));
|
||||
bMenu.add(null, (Command)this.findObjects);
|
||||
bMenu.add(null, (Command)this.clear);
|
||||
bMenu.add(null, (Command)this.clearAll);
|
||||
bMenu.add(null, (Command)this.selectCols);
|
||||
bMenu.add(null, (BValue)new BSeparator());
|
||||
bMenu.add(null, (Command)new PasteCommand((BTransferWidget)this.editor.table));
|
||||
bMenu.add(null, (BValue)new BSeparator());
|
||||
bMenu.add(null, (Command)this.rename);
|
||||
bMenu.add(null, (Command)this.slotAdd);
|
||||
bMenu.add(null, (Command)this.slotEdit);
|
||||
bMenu.add(null, (Command)this.slotRename);
|
||||
bMenu.add(null, (Command)this.slotRemove);
|
||||
bMenu.add(null, (Command)this.slotFlags);
|
||||
bMenu.add(null, (BValue)new BSeparator());
|
||||
bMenu.add(null, (Command)this.hyperlink);
|
||||
return bMenu;
|
||||
}
|
||||
|
||||
static void lease(BComponent[] bComponentArray) {
|
||||
try {
|
||||
BComponent.lease((BComponent[])bComponentArray, (int)0, (long)60000L);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
System.out.println("Error leasing Components...");
|
||||
throwable.printStackTrace();
|
||||
for (int i = 0; i < bComponentArray.length; ++i) {
|
||||
try {
|
||||
bComponentArray[i].lease(0, 60000L);
|
||||
continue;
|
||||
}
|
||||
catch (Throwable throwable2) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Hyperlink
|
||||
extends BatchCommand {
|
||||
public Hyperlink() {
|
||||
super("hyperlink");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int[] nArray = ((BatchCommands)BatchCommands.this).editor.table.getSelection().getRows();
|
||||
BComponent bComponent = (BComponent)((BatchCommands)BatchCommands.this).editor.table.model.kids.get(nArray[0]);
|
||||
BOrd bOrd = BOrd.make((String)("station:|" + bComponent.getSlotPath()));
|
||||
BatchCommands.this.editor.getWbShell().hyperlink(bOrd);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SlotFlags
|
||||
extends BatchCommand {
|
||||
public SlotFlags() {
|
||||
super("slotFlags");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BSetFlagsDialog.open(BatchCommands.this.editor);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SlotRemove
|
||||
extends BatchCommand {
|
||||
public SlotRemove() {
|
||||
super("slotRemove");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BRemoveDialog.open(BatchCommands.this.editor);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SlotRename
|
||||
extends BatchCommand {
|
||||
public SlotRename() {
|
||||
super("slotRename");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BRenameDialog.open(BatchCommands.this.editor, true);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SlotEdit
|
||||
extends BatchCommand {
|
||||
public SlotEdit() {
|
||||
super("slotEdit");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BSetDialog.open(BatchCommands.this.editor);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SlotAdd
|
||||
extends BatchCommand {
|
||||
public SlotAdd() {
|
||||
super("slotAdd");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BAddDialog.open(BatchCommands.this.editor);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Rename
|
||||
extends BatchCommand {
|
||||
public Rename() {
|
||||
super("rename");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
String string = BRenameDialog.open(BatchCommands.this.editor, false);
|
||||
if (string != null) {
|
||||
try {
|
||||
BatchCompiler batchCompiler = new BatchCompiler(BatchCommands.this.editor, string);
|
||||
batchCompiler.compile();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
BDialog.error((BWidget)BatchCommands.this.editor, (String)"Error", (Object)"Commit Failed", (Throwable)exception);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class SelectColumns
|
||||
extends BatchCommand {
|
||||
public SelectColumns() {
|
||||
super("selectColumns");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int n;
|
||||
BBatchTable.Model model = ((BatchCommands)BatchCommands.this).editor.table.model;
|
||||
BCheckList bCheckList = new BCheckList();
|
||||
String[] stringArray = model.getAllColumns();
|
||||
for (n = 0; n < stringArray.length; ++n) {
|
||||
bCheckList.getModel().addItem((Object)stringArray[n]);
|
||||
}
|
||||
for (n = 1; n < model.cols.size(); ++n) {
|
||||
int n2 = bCheckList.indexOfItem(model.cols.get(n));
|
||||
if (n2 < 0) continue;
|
||||
bCheckList.getSelection().select(n2);
|
||||
}
|
||||
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)new BBorderPane((BWidget)bCheckList, BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
bConstrainedPane.setMinWidth(300.0);
|
||||
bConstrainedPane.setMaxWidth(300.0);
|
||||
bConstrainedPane.setMinHeight(300.0);
|
||||
bConstrainedPane.setMaxHeight(400.0);
|
||||
if (1 == BDialog.open((BWidget)BatchCommands.this.editor, (String)lex.getText("batchEditor.commands.selectColumns.label"), (Object)bConstrainedPane, (int)3)) {
|
||||
String string = (String)((BatchCommands)BatchCommands.this).editor.table.model.cols.get(0);
|
||||
model.cols.clear();
|
||||
model.cols.add(string);
|
||||
int[] nArray = bCheckList.getSelection().getItems();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
model.cols.add(bCheckList.getItem(nArray[i]));
|
||||
}
|
||||
((BatchCommands)BatchCommands.this).editor.table.sizeColumnsToFit();
|
||||
((BatchCommands)BatchCommands.this).editor.table.relayout();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class ClearAll
|
||||
extends BatchCommand {
|
||||
public ClearAll() {
|
||||
super("clearAll");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
while (!((BatchCommands)BatchCommands.this).editor.table.model.kids.isEmpty()) {
|
||||
((BatchCommands)BatchCommands.this).editor.table.model.kids.remove(0);
|
||||
}
|
||||
BatchCommands.this.updateCommands();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Clear
|
||||
extends BatchCommand {
|
||||
public Clear() {
|
||||
super("clear");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
int[] nArray = ((BatchCommands)BatchCommands.this).editor.table.getSelection().getRows();
|
||||
((BatchCommands)BatchCommands.this).editor.table.getSelection().deselectAll();
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
((BatchCommands)BatchCommands.this).editor.table.getSelection().deselectAll();
|
||||
((BatchCommands)BatchCommands.this).editor.table.model.kids.remove(nArray[i] - i);
|
||||
}
|
||||
BatchCommands.this.updateCommands();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class FindObjects
|
||||
extends BatchCommand {
|
||||
public FindObjects() {
|
||||
super("findObjects");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BOrd bOrd;
|
||||
if (BatchCommands.this.builder == null) {
|
||||
BatchCommands.this.builder = new BBqlQueryBuilder((BObject)((BatchCommands)BatchCommands.this).editor.service, BOrd.NULL, false);
|
||||
}
|
||||
if ((bOrd = BatchCommands.this.builder.open((BWidget)BatchCommands.this.editor)) != null && !bOrd.isNull()) {
|
||||
OrdQuery[] ordQueryArray = bOrd.parse();
|
||||
SelectQuery selectQuery = (SelectQuery)ordQueryArray[ordQueryArray.length - 1];
|
||||
BSelect bSelect = selectQuery.getSelect();
|
||||
BPath bPath = new BPath("toPathString");
|
||||
if (bSelect.hasProjection() && bSelect.getProjection().isDistinct()) {
|
||||
bSelect.select(Columns.distinctProjection().add(Columns.make((BExpression)bPath)));
|
||||
} else {
|
||||
bSelect.select(Columns.projection((BProjectionColumn)Columns.make((BExpression)bPath)));
|
||||
}
|
||||
ordQueryArray[ordQueryArray.length - 1] = new SelectQuery(bSelect);
|
||||
bOrd = BOrd.make((OrdQuery[])ordQueryArray);
|
||||
BICollection bICollection = (BICollection)bOrd.resolve((BObject)((BatchCommands)BatchCommands.this).editor.service).get();
|
||||
BITable bITable = bICollection.toTable();
|
||||
ColumnList columnList = bITable.getColumns();
|
||||
ArrayList<BObject> arrayList = new ArrayList<BObject>();
|
||||
for (int i = 0; i < bITable.size(); ++i) {
|
||||
BOrd bOrd2 = BOrd.make((String)("station:|slot:" + bITable.get(i, columnList.get(0))));
|
||||
bOrd2 = BOrd.make((BOrd)BatchCommands.this.editor.getWbShell().getActiveOrd(), (BOrd)bOrd2).normalize();
|
||||
BObject bObject = bOrd2.resolve().get();
|
||||
if (!(bObject instanceof BComponent) || ((BatchCommands)BatchCommands.this).editor.table.model.kids.contains(bObject)) continue;
|
||||
arrayList.add(bObject);
|
||||
((BatchCommands)BatchCommands.this).editor.table.model.kids.add(bObject);
|
||||
}
|
||||
BatchCommands.lease(arrayList.toArray(new BComponent[arrayList.size()]));
|
||||
((BatchCommands)BatchCommands.this).editor.table.sizeColumnsToFit();
|
||||
((BatchCommands)BatchCommands.this).editor.table.relayout();
|
||||
BatchCommands.this.updateCommands();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class BatchCommand
|
||||
extends Command {
|
||||
public BatchCommand(String string) {
|
||||
super((BWidget)BatchCommands.this.editor, module, "batchEditor.commands." + string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.workbench.console.BConsole
|
||||
* com.tridium.workbench.shell.BNiagaraWbShell
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BTextEditorPane
|
||||
* javax.baja.ui.text.BTextEditor
|
||||
*/
|
||||
package com.tridium.program.ui.batch;
|
||||
|
||||
import com.tridium.program.BCode;
|
||||
import com.tridium.program.BRobotCode;
|
||||
import com.tridium.program.BRobotResult;
|
||||
import com.tridium.program.ui.Compiler;
|
||||
import com.tridium.program.ui.batch.BBatchEditor;
|
||||
import com.tridium.workbench.console.BConsole;
|
||||
import com.tridium.workbench.shell.BNiagaraWbShell;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BTextEditorPane;
|
||||
import javax.baja.ui.text.BTextEditor;
|
||||
|
||||
class BatchCompiler
|
||||
extends Compiler {
|
||||
private BBatchEditor editor;
|
||||
private String method;
|
||||
private BRobotCode code = new BRobotCode();
|
||||
String source;
|
||||
|
||||
BatchCompiler(BBatchEditor bBatchEditor, String string) {
|
||||
super((BWidget)bBatchEditor);
|
||||
this.editor = bBatchEditor;
|
||||
this.method = string;
|
||||
}
|
||||
|
||||
public void generateCode(String string) throws Exception {
|
||||
String string2 = "import java.util.*;\nimport javax.baja.data.*;\nimport javax.baja.io.*;\nimport javax.baja.naming.*;\nimport javax.baja.sys.*;\nimport javax.baja.util.*;\nimport com.tridium.program.*;\nimport com.tridium.program.ui.batch.*;\n\npublic class " + string + "\n" + " extends BatchRobot\n" + "{\n" + "\n" + " public void run()\n" + " throws Exception\n" + " {\n" + " for (int i=0; i<ords.length; i++)\n" + " {\n" + " BOrd ord = BOrd.make(ords[i]);\n";
|
||||
string2 = string2 + this.method + "\n";
|
||||
string2 = string2 + " }\n }\n\n String[] ords = {\n";
|
||||
int n = this.editor.table.model.getRowCount();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
BComponent bComponent = (BComponent)this.editor.table.model.kids.get(i);
|
||||
string2 = string2 + " \"station:|slot:" + bComponent.getSlotPath().getBody() + "\"";
|
||||
if (i < n - 1) {
|
||||
string2 = string2 + ",";
|
||||
}
|
||||
string2 = string2 + "\n";
|
||||
}
|
||||
this.source = string2 = string2 + " };\n}\n";
|
||||
}
|
||||
|
||||
public void compile() throws Exception {
|
||||
String string = BCode.generateClassName();
|
||||
this.generateCode(string);
|
||||
this.code.setDependencies("baja;program");
|
||||
this.compile(string, this.code, this.source);
|
||||
}
|
||||
|
||||
public BConsole openConsole() {
|
||||
return ((BNiagaraWbShell)this.editor.getShell()).getConsole();
|
||||
}
|
||||
|
||||
public void compileSuccess(BConsole bConsole) throws Exception {
|
||||
super.compileSuccess(bConsole);
|
||||
this.run();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
BRobotResult bRobotResult = this.editor.service.runRobot(this.code);
|
||||
this.editor.table.refresh();
|
||||
BTextEditor bTextEditor = new BTextEditor(bRobotResult.getLog(), false);
|
||||
BTextEditorPane bTextEditorPane = new BTextEditorPane(bTextEditor, 20, 100);
|
||||
BDialog.open((BWidget)this.editor, (String)"BatchEditor Results", (Object)bTextEditorPane, (int)1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user