link start!
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.sys.BModule
|
||||
* javax.baja.ui.BAccelerator
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.AsyncGroup;
|
||||
import java.util.Properties;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.ui.BAccelerator;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public abstract class AsyncCommand
|
||||
extends Command
|
||||
implements AsyncGroup.AsyncGroupMember {
|
||||
private AsyncGroup group = null;
|
||||
private boolean restoreEnabled = false;
|
||||
private boolean isActive;
|
||||
|
||||
public AsyncCommand(BWidget bWidget, BModule bModule, String string) {
|
||||
super(bWidget, bModule, string);
|
||||
}
|
||||
|
||||
public AsyncCommand(BWidget bWidget, Properties properties, String string) {
|
||||
super(bWidget, properties, string);
|
||||
}
|
||||
|
||||
public AsyncCommand(BWidget bWidget, Lexicon lexicon, String string) {
|
||||
super(bWidget, lexicon, string);
|
||||
}
|
||||
|
||||
public AsyncCommand(BWidget bWidget, String string) {
|
||||
super(bWidget, string);
|
||||
}
|
||||
|
||||
public AsyncCommand(BWidget bWidget, String string, BImage bImage, BAccelerator bAccelerator, String string2) {
|
||||
super(bWidget, string, bImage, bAccelerator, string2);
|
||||
}
|
||||
|
||||
public final CommandArtifact doInvoke() throws Exception {
|
||||
if (this.doInvocationStarted()) {
|
||||
new Thread("AsyncCommand:doInvoke"){
|
||||
|
||||
public void run() {
|
||||
BWbShell bWbShell = BWbShell.getWbShell((BWidget)AsyncCommand.this.getOwner());
|
||||
try {
|
||||
if (AsyncCommand.this.group != null) {
|
||||
AsyncCommand.this.group.startActive();
|
||||
}
|
||||
if (bWbShell != null) {
|
||||
bWbShell.enterBusy();
|
||||
}
|
||||
AsyncCommand.this.doInvokeAsync();
|
||||
}
|
||||
finally {
|
||||
if (bWbShell != null) {
|
||||
bWbShell.exitBusy();
|
||||
}
|
||||
if (AsyncCommand.this.group != null) {
|
||||
AsyncCommand.this.group.stopActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean doInvocationStarted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setGroup(Group group) {
|
||||
this.setAsyncGroup(group);
|
||||
}
|
||||
|
||||
public void setAsyncGroup(AsyncGroup asyncGroup) {
|
||||
this.group = asyncGroup;
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return (Group)this.getAsyncGroup();
|
||||
}
|
||||
|
||||
public AsyncGroup getAsyncGroup() {
|
||||
return this.group;
|
||||
}
|
||||
|
||||
public synchronized void startActive() {
|
||||
this.restoreEnabled = this.isEnabled();
|
||||
this.isActive = true;
|
||||
super.setEnabled(false);
|
||||
}
|
||||
|
||||
public final synchronized void setEnabled(boolean bl) {
|
||||
if (this.isActive) {
|
||||
this.restoreEnabled = bl;
|
||||
} else {
|
||||
super.setEnabled(bl);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stopActive() {
|
||||
if (this.restoreEnabled) {
|
||||
super.setEnabled(true);
|
||||
}
|
||||
this.isActive = false;
|
||||
}
|
||||
|
||||
public abstract void doInvokeAsync();
|
||||
|
||||
public static class Group
|
||||
extends AsyncGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.nre.util.Array;
|
||||
|
||||
public class AsyncGroup {
|
||||
private Array members = new Array(class$com$tridium$platform$ui$util$AsyncGroup$AsyncGroupMember == null ? (class$com$tridium$platform$ui$util$AsyncGroup$AsyncGroupMember = AsyncGroup.class$("com.tridium.platform.ui.util.AsyncGroup$AsyncGroupMember")) : class$com$tridium$platform$ui$util$AsyncGroup$AsyncGroupMember);
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$AsyncGroup$AsyncGroupMember;
|
||||
|
||||
public synchronized void add(AsyncGroupMember asyncGroupMember) {
|
||||
this.members.add((Object)asyncGroupMember);
|
||||
asyncGroupMember.setAsyncGroup(this);
|
||||
}
|
||||
|
||||
public synchronized void remove(AsyncGroupMember asyncGroupMember) {
|
||||
this.members.remove((Object)asyncGroupMember);
|
||||
asyncGroupMember.setAsyncGroup(null);
|
||||
}
|
||||
|
||||
public synchronized void startActive() {
|
||||
for (int i = 0; i < this.members.size(); ++i) {
|
||||
((AsyncGroupMember)this.members.get(i)).startActive();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stopActive() {
|
||||
for (int i = 0; i < this.members.size(); ++i) {
|
||||
((AsyncGroupMember)this.members.get(i)).stopActive();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static interface AsyncGroupMember {
|
||||
public void startActive();
|
||||
|
||||
public void stopActive();
|
||||
|
||||
public void setAsyncGroup(AsyncGroup var1);
|
||||
|
||||
public AsyncGroup getAsyncGroup();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.io.ValueDocDecoder
|
||||
* javax.baja.io.ValueDocEncoder
|
||||
* javax.baja.naming.BHost
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.util.BFolder
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.io.ValueDocDecoder;
|
||||
import javax.baja.io.ValueDocEncoder;
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.util.BFolder;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public class AuditUtil {
|
||||
private static FilePath userHomePath;
|
||||
private static SimpleDateFormat timestampFormat;
|
||||
|
||||
public static void audit(String string, BHost bHost, Type type, BComponent bComponent, BComponent bComponent2) throws Exception {
|
||||
AuditUtil.audit(string, bHost, type.toString(), bComponent, bComponent2);
|
||||
}
|
||||
|
||||
public static void audit(String string, BHost bHost, String string2, BComponent bComponent, BComponent bComponent2) throws Exception {
|
||||
BFolder bFolder = new BFolder();
|
||||
if (bHost != null) {
|
||||
bFolder.add("host", (BValue)BString.make((String)bHost.getNavDisplayName(null)), 1);
|
||||
}
|
||||
bFolder.add("editor", (BValue)BString.make((String)string2), 1);
|
||||
bFolder.add("modTime", (BValue)BAbsTime.make(), 1);
|
||||
bFolder.add("priorValue", bComponent.newCopy(), 1);
|
||||
bFolder.add("newValue", bComponent2.newCopy(), 1);
|
||||
BIFile bIFile = BFileSystem.INSTANCE.findFile(AuditUtil.getUserHomePath().merge(string + ".bog"));
|
||||
BFolder bFolder2 = new BFolder();
|
||||
if (bIFile == null) {
|
||||
bIFile = BFileSystem.INSTANCE.makeFile(AuditUtil.getUserHomePath().merge(string + ".bog"));
|
||||
} else {
|
||||
bFolder2 = (BFolder)new ValueDocDecoder(bIFile).decodeDocument();
|
||||
}
|
||||
bFolder2.add(timestampFormat.format(new Date()), (BValue)bFolder);
|
||||
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(bIFile.getOutputStream());
|
||||
valueDocEncoder.setEncodeTransients(true);
|
||||
valueDocEncoder.encodeDocument((BValue)bFolder2);
|
||||
}
|
||||
|
||||
private static FilePath getUserHomePath() {
|
||||
if (userHomePath == null) {
|
||||
userHomePath = BFileSystem.INSTANCE.localFileToPath(Sys.getUserHome());
|
||||
}
|
||||
return userHomePath;
|
||||
}
|
||||
|
||||
static {
|
||||
timestampFormat = new SimpleDateFormat("'d'yyyyMMddkkmmss");
|
||||
}
|
||||
|
||||
public static class ViewAuditCommand
|
||||
extends Command {
|
||||
private BWbShell wbShell;
|
||||
private String auditName;
|
||||
|
||||
public ViewAuditCommand(String string, BWidget bWidget) {
|
||||
super(bWidget, Sys.loadModule((String)"platform"), "AuditUtil.command");
|
||||
this.setEnabled(false);
|
||||
if (bWidget.getShell() instanceof BWbShell) {
|
||||
this.wbShell = (BWbShell)bWidget.getShell();
|
||||
}
|
||||
this.auditName = string;
|
||||
}
|
||||
|
||||
public boolean auditFileExists() {
|
||||
return BFileSystem.INSTANCE.findFile(AuditUtil.getUserHomePath().merge(this.auditName + ".bog")) != null;
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
if (this.wbShell != null) {
|
||||
this.wbShell.hyperlink(BOrd.make((String)("local:|" + AuditUtil.getUserHomePath().merge(this.auditName + ".bog") + "|bog:|slot:/|view:workbench:PropertySheet")));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BSize
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.gx.BSize;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
|
||||
public class BBox
|
||||
extends BWidget {
|
||||
public static final Property fixedSize = BBox.newProperty((int)0, (BValue)BSize.DEFAULT, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BBox == null ? (class$com$tridium$platform$ui$util$BBox = BBox.class$("com.tridium.platform.ui.util.BBox")) : class$com$tridium$platform$ui$util$BBox));
|
||||
private static final BIcon icon = BIcon.std((String)"widgets/nullWidget.png");
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BBox;
|
||||
|
||||
public BSize getFixedSize() {
|
||||
return (BSize)this.get(fixedSize);
|
||||
}
|
||||
|
||||
public void setFixedSize(BSize bSize) {
|
||||
this.set(fixedSize, (BValue)bSize, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BBox() {
|
||||
}
|
||||
|
||||
public BBox(double d, double d2) {
|
||||
this.setFixedSize(BSize.make((double)d, (double)d2));
|
||||
}
|
||||
|
||||
public void computePreferredSize() {
|
||||
this.setPreferredSize(this.getFixedSize().width(), this.getFixedSize().height());
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics) {
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BAbstractButton
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.enums.BButtonStyle
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.workbench.BWbShell
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BAbstractButton;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.enums.BButtonStyle;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.workbench.BWbShell;
|
||||
|
||||
public class BButtonPane
|
||||
extends BGridPane {
|
||||
public static final Property buttonStyle = BButtonPane.newProperty((int)0, (BValue)BButtonStyle.normal, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BButtonPane == null ? (class$com$tridium$platform$ui$util$BButtonPane = BButtonPane.class$("com.tridium.platform.ui.util.BButtonPane")) : class$com$tridium$platform$ui$util$BButtonPane));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BButtonPane;
|
||||
|
||||
public BButtonStyle getButtonStyle() {
|
||||
return (BButtonStyle)this.get(buttonStyle);
|
||||
}
|
||||
|
||||
public void setButtonStyle(BButtonStyle bButtonStyle) {
|
||||
this.set(buttonStyle, (BValue)bButtonStyle, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BButtonPane() {
|
||||
super(0);
|
||||
this.setUniformColumnWidth(true);
|
||||
this.setColumnAlign(BHalign.fill);
|
||||
}
|
||||
|
||||
public BButtonPane(Command[] commandArray) {
|
||||
this(BButtonStyle.normal, commandArray, true, true);
|
||||
}
|
||||
|
||||
public BButtonPane(Command[] commandArray, boolean bl, boolean bl2) {
|
||||
this(BButtonStyle.normal, commandArray, bl, bl2);
|
||||
}
|
||||
|
||||
public BButtonPane(BButtonStyle bButtonStyle, Command[] commandArray, boolean bl, boolean bl2) {
|
||||
this();
|
||||
this.setButtonStyle(bButtonStyle);
|
||||
for (int i = 0; i < commandArray.length; ++i) {
|
||||
this.add(commandArray[i], bl, bl2);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Command command) {
|
||||
this.add(command, true, true);
|
||||
}
|
||||
|
||||
public void add(Command command, boolean bl, boolean bl2) {
|
||||
this.setColumnCount(this.getColumnCount() + 1);
|
||||
BAbstractButton bAbstractButton = BAbstractButton.make((Command)command, (boolean)bl, (boolean)bl2);
|
||||
if (this.getButtonStyle() != BButtonStyle.normal) {
|
||||
bAbstractButton.setButtonStyle(this.getButtonStyle());
|
||||
}
|
||||
this.add(null, (BValue)bAbstractButton);
|
||||
}
|
||||
|
||||
public void add(BWidget bWidget) {
|
||||
this.setColumnCount(this.getColumnCount() + 1);
|
||||
this.add(null, (BValue)bWidget);
|
||||
}
|
||||
|
||||
public void addWorkbenchButtons(BWidget bWidget) {
|
||||
BWbShell bWbShell = BWbShell.getWbShell((BWidget)bWidget);
|
||||
if (bWbShell != null) {
|
||||
this.add(bWbShell.getRefreshCommand(), true, true);
|
||||
this.add(bWbShell.getSaveCommand(), true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static BButtonPane makeWorkbenchButtonPane(BWidget bWidget) {
|
||||
BWbShell bWbShell = BWbShell.getWbShell((BWidget)bWidget);
|
||||
if (bWbShell == null) {
|
||||
return null;
|
||||
}
|
||||
return new BButtonPane(new Command[]{bWbShell.getRefreshCommand(), bWbShell.getSaveCommand()}, true, true);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.table.BTable
|
||||
* javax.baja.ui.table.DefaultTableModel
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableModel
|
||||
* javax.baja.ui.table.TableSelection
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandEnablePolicy;
|
||||
import com.tridium.platform.ui.util.CommandBindings;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.table.BTable;
|
||||
import javax.baja.ui.table.DefaultTableModel;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableModel;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
|
||||
public class BCommandBoundTable
|
||||
extends BTable {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BCommandBoundTable == null ? (class$com$tridium$platform$ui$util$BCommandBoundTable = BCommandBoundTable.class$("com.tridium.platform.ui.util.BCommandBoundTable")) : class$com$tridium$platform$ui$util$BCommandBoundTable));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BCommandBoundTable;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BCommandBoundTable(TableModel tableModel, CommandBindings.TableController tableController) {
|
||||
super(tableModel, (TableController)tableController);
|
||||
this.setSelection(new CommandBindings.TableSelection(tableController.getCommandBindings()));
|
||||
}
|
||||
|
||||
public BCommandBoundTable(TableModel tableModel) {
|
||||
this(tableModel, new CommandBindings.TableController());
|
||||
}
|
||||
|
||||
public BCommandBoundTable() {
|
||||
this((TableModel)new DefaultTableModel(), new CommandBindings.TableController());
|
||||
}
|
||||
|
||||
public void setDoubleClickCommand(Command command) {
|
||||
this.getCommandBindings().setDoubleClickCommand(command);
|
||||
}
|
||||
|
||||
public void addCommand(Command command, BCommandEnablePolicy bCommandEnablePolicy) {
|
||||
this.getCommandBindings().addCommand(command, bCommandEnablePolicy);
|
||||
}
|
||||
|
||||
public void setCommandSupport(CommandBindings.Support support) {
|
||||
this.getCommandBindings().setSupport(support);
|
||||
}
|
||||
|
||||
public CommandBindings.Support getCommandSupport() {
|
||||
return this.getCommandBindings().getSupport();
|
||||
}
|
||||
|
||||
public Command[] getCommands() {
|
||||
return this.getCommandBindings().getCommands();
|
||||
}
|
||||
|
||||
public void setCommandEnabledStates() {
|
||||
this.getCBTSelection().setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.getCBTSelection().getCommandBindings();
|
||||
}
|
||||
|
||||
public CommandBindings.TableSelection getCBTSelection() {
|
||||
return (CommandBindings.TableSelection)this.getSelection();
|
||||
}
|
||||
|
||||
public void setController(TableController tableController) {
|
||||
if (tableController instanceof CommandBindings.TableController) {
|
||||
super.setController((TableController)((CommandBindings.TableController)tableController));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelection(TableSelection tableSelection) {
|
||||
if (tableSelection instanceof CommandBindings.TableSelection) {
|
||||
super.setSelection((TableSelection)((CommandBindings.TableSelection)tableSelection));
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.treetable.BTreeTable
|
||||
* javax.baja.ui.treetable.TreeTableController
|
||||
* javax.baja.ui.treetable.TreeTableModel
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandEnablePolicy;
|
||||
import com.tridium.platform.ui.util.CommandBindings;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.table.TableController;
|
||||
import javax.baja.ui.table.TableSelection;
|
||||
import javax.baja.ui.treetable.BTreeTable;
|
||||
import javax.baja.ui.treetable.TreeTableController;
|
||||
import javax.baja.ui.treetable.TreeTableModel;
|
||||
|
||||
public class BCommandBoundTreeTable
|
||||
extends BTreeTable {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BCommandBoundTreeTable == null ? (class$com$tridium$platform$ui$util$BCommandBoundTreeTable = BCommandBoundTreeTable.class$("com.tridium.platform.ui.util.BCommandBoundTreeTable")) : class$com$tridium$platform$ui$util$BCommandBoundTreeTable));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BCommandBoundTreeTable;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BCommandBoundTreeTable() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public BCommandBoundTreeTable(TreeTableModel treeTableModel, CommandBindings.TreeTableController treeTableController) {
|
||||
super(treeTableModel, (TreeTableController)treeTableController);
|
||||
this.setSelection(new CommandBindings.TreeTableSelection(treeTableController.getCommandBindings()));
|
||||
}
|
||||
|
||||
public BCommandBoundTreeTable(TreeTableModel treeTableModel) {
|
||||
this(treeTableModel, new CommandBindings.TreeTableController());
|
||||
}
|
||||
|
||||
public void setDoubleClickCommand(Command command) {
|
||||
this.getCommandBindings().setDoubleClickCommand(command);
|
||||
}
|
||||
|
||||
public void addCommand(Command command, BCommandEnablePolicy bCommandEnablePolicy) {
|
||||
this.getCommandBindings().addCommand(command, bCommandEnablePolicy);
|
||||
}
|
||||
|
||||
public void setCommandSupport(CommandBindings.Support support) {
|
||||
this.getCommandBindings().setSupport(support);
|
||||
}
|
||||
|
||||
public CommandBindings.Support getCommandSupport() {
|
||||
return this.getCommandBindings().getSupport();
|
||||
}
|
||||
|
||||
public Command[] getCommands() {
|
||||
return this.getCommandBindings().getCommands();
|
||||
}
|
||||
|
||||
public void setCommandEnabledStates() {
|
||||
this.getCBTSelection().setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.getCBTSelection().getCommandBindings();
|
||||
}
|
||||
|
||||
public CommandBindings.TreeTableSelection getCBTSelection() {
|
||||
return (CommandBindings.TreeTableSelection)this.getSelection();
|
||||
}
|
||||
|
||||
public void setController(CommandBindings.TreeTableController treeTableController) {
|
||||
if (treeTableController instanceof CommandBindings.TreeTableController) {
|
||||
super.setController((TableController)treeTableController);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelection(CommandBindings.TreeTableSelection treeTableSelection) {
|
||||
if (treeTableSelection instanceof CommandBindings.TreeTableSelection) {
|
||||
super.setSelection((TableSelection)treeTableSelection);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BButton
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BNullWidget
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BWindowEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.DialogCommand;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BButton;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BNullWidget;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BWindowEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
|
||||
public class BCommandDialog
|
||||
extends BDialog {
|
||||
public static final Topic buttonPressed = BCommandDialog.newTopic((int)0, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BCommandDialog == null ? (class$com$tridium$platform$ui$util$BCommandDialog = BCommandDialog.class$("com.tridium.platform.ui.util.BCommandDialog")) : class$com$tridium$platform$ui$util$BCommandDialog));
|
||||
private DialogCommand[] commands;
|
||||
private BButton[] buttons;
|
||||
private DialogCommand closingCommand = null;
|
||||
public static final int CLOSE = 16;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BCommandDialog;
|
||||
|
||||
public void fireButtonPressed(BValue bValue) {
|
||||
this.fire(buttonPressed, bValue, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
protected BCommandDialog(BWidget bWidget, String string, boolean bl, BWidget bWidget2, DialogCommand[] dialogCommandArray, BImage bImage) {
|
||||
super(bWidget, string, bl);
|
||||
BWidget bWidget3 = bWidget2;
|
||||
if (bImage != null) {
|
||||
bWidget3 = new BEdgePane(null, null, (BWidget)new BLabel(bImage), null, bWidget2);
|
||||
}
|
||||
BGridPane bGridPane = new BGridPane(dialogCommandArray.length);
|
||||
bGridPane.setUniformColumnWidth(true);
|
||||
bGridPane.setColumnAlign(BHalign.fill);
|
||||
this.commands = dialogCommandArray;
|
||||
BButton bButton = null;
|
||||
this.buttons = new BButton[dialogCommandArray.length];
|
||||
for (int i = 0; i < dialogCommandArray.length; ++i) {
|
||||
dialogCommandArray[i].setDialog(this);
|
||||
this.buttons[i] = new BButton((Command)dialogCommandArray[i]);
|
||||
bGridPane.add("button?", (BValue)this.buttons[i]);
|
||||
this.linkTo("lkButton?", (BComponent)this.buttons[i], (Slot)BButton.actionPerformed, (Slot)buttonPressed);
|
||||
if (dialogCommandArray[i].getResult() == 1) {
|
||||
bButton = this.buttons[i];
|
||||
continue;
|
||||
}
|
||||
if (bButton == null && dialogCommandArray[i].getResult() == 16) {
|
||||
bButton = this.buttons[i];
|
||||
continue;
|
||||
}
|
||||
if (bButton != null || dialogCommandArray[i].getResult() != 2) continue;
|
||||
bButton = this.buttons[i];
|
||||
}
|
||||
this.setContent((BWidget)new BEdgePane(null, (BWidget)new BBorderPane((BWidget)bGridPane, 0.0, 4.0, 4.0, 4.0), null, null, (BWidget)new BBorderPane(bWidget3, 4.0, 4.0, 4.0, 4.0)));
|
||||
if (bButton != null) {
|
||||
this.setDefaultButton(bButton);
|
||||
}
|
||||
}
|
||||
|
||||
public BCommandDialog() {
|
||||
}
|
||||
|
||||
public static int open(BWidget bWidget, String string, Object object, int n) {
|
||||
return BCommandDialog.open(bWidget, string, object, DialogCommand.make(bWidget, n));
|
||||
}
|
||||
|
||||
public static int open(BWidget bWidget, String string, Object object, DialogCommand[] dialogCommandArray) {
|
||||
return BCommandDialog.open(bWidget, string, object, dialogCommandArray, null);
|
||||
}
|
||||
|
||||
public static int open(BWidget bWidget, String string, Object object, int n, BImage bImage) {
|
||||
return BCommandDialog.open(bWidget, string, object, DialogCommand.make(bWidget, n), bImage);
|
||||
}
|
||||
|
||||
public static int open(BWidget bWidget, String string, Object object, DialogCommand[] dialogCommandArray, BImage bImage) {
|
||||
BWidget bWidget2;
|
||||
BCommandDialog bCommandDialog = BCommandDialog.make(bWidget, string, true, object, dialogCommandArray, bImage);
|
||||
bCommandDialog.setBoundsCenteredOnOwner();
|
||||
bCommandDialog.open();
|
||||
if (object instanceof BWidget && (bWidget2 = (BWidget)object).getPropertyInParent() != null) {
|
||||
BWidget bWidget3 = bWidget2.getParentWidget();
|
||||
bWidget3.set(bWidget2.getPropertyInParent(), (BValue)new BNullWidget());
|
||||
}
|
||||
return bCommandDialog.getResult();
|
||||
}
|
||||
|
||||
public static BCommandDialog make(BWidget bWidget, String string, boolean bl, Object object, DialogCommand[] dialogCommandArray, BImage bImage) {
|
||||
Object object2 = null;
|
||||
object2 = object instanceof BWidget ? (BWidget)object : new BLabel(String.valueOf(object), BHalign.left);
|
||||
return new BCommandDialog(bWidget, string, bl, (BWidget)object2, dialogCommandArray, bImage);
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return this.closingCommand == null ? -1 : this.closingCommand.getResult();
|
||||
}
|
||||
|
||||
public void replaceCommand(int n, DialogCommand dialogCommand) {
|
||||
this.commands[n] = dialogCommand;
|
||||
this.buttons[n].setCommand((Command)dialogCommand, true, false);
|
||||
this.commands[n].setDialog(this);
|
||||
}
|
||||
|
||||
public void close(DialogCommand dialogCommand) {
|
||||
this.closingCommand = dialogCommand;
|
||||
this.close();
|
||||
}
|
||||
|
||||
public Command getButtonCommand(int n) {
|
||||
for (int i = 0; i < this.commands.length; ++i) {
|
||||
if (this.commands[i].getResult() != n) continue;
|
||||
return this.commands[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void windowClosing(BWindowEvent bWindowEvent) {
|
||||
Command command = this.getButtonCommand(2);
|
||||
if (command == null) {
|
||||
command = this.getButtonCommand(1);
|
||||
}
|
||||
if (command == null) {
|
||||
command = this.getButtonCommand(16);
|
||||
}
|
||||
if (command == null) {
|
||||
command = this.getButtonCommand(8);
|
||||
}
|
||||
if (command == null) {
|
||||
command = this.getButtonCommand(4);
|
||||
}
|
||||
if (command != null) {
|
||||
command.invoke();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public final class BCommandEnablePolicy
|
||||
extends BFrozenEnum {
|
||||
public static final int EMPTY = 0;
|
||||
public static final int SINGLE_SELECTION = 1;
|
||||
public static final int DOUBLE_SELECTION = 2;
|
||||
public static final int MULTI_SELECTION = 3;
|
||||
public static final int ANY_SELECTION = 4;
|
||||
public static final int ALWAYS = 5;
|
||||
public static final BCommandEnablePolicy empty = new BCommandEnablePolicy(0);
|
||||
public static final BCommandEnablePolicy singleSelection = new BCommandEnablePolicy(1);
|
||||
public static final BCommandEnablePolicy doubleSelection = new BCommandEnablePolicy(2);
|
||||
public static final BCommandEnablePolicy multiSelection = new BCommandEnablePolicy(3);
|
||||
public static final BCommandEnablePolicy anySelection = new BCommandEnablePolicy(4);
|
||||
public static final BCommandEnablePolicy always = new BCommandEnablePolicy(5);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BCommandEnablePolicy == null ? (class$com$tridium$platform$ui$util$BCommandEnablePolicy = BCommandEnablePolicy.class$("com.tridium.platform.ui.util.BCommandEnablePolicy")) : class$com$tridium$platform$ui$util$BCommandEnablePolicy));
|
||||
public static final BCommandEnablePolicy DEFAULT = empty;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BCommandEnablePolicy;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BCommandEnablePolicy make(int n) {
|
||||
return (BCommandEnablePolicy)empty.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static BCommandEnablePolicy make(String string) {
|
||||
return (BCommandEnablePolicy)empty.getRange().get(string);
|
||||
}
|
||||
|
||||
private BCommandEnablePolicy(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.data.BIDataValue
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BFacets
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BInteger
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.pane.BPane
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.data.BIDataValue;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.enums.BValign;
|
||||
import javax.baja.ui.pane.BPane;
|
||||
|
||||
public class BCoordinatedGridPane
|
||||
extends BPane {
|
||||
public static final Property columnCount = BCoordinatedGridPane.newProperty((int)0, (int)2, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)1)));
|
||||
public static final Property valign = BCoordinatedGridPane.newProperty((int)0, (BValue)BValign.center, null);
|
||||
public static final Property halign = BCoordinatedGridPane.newProperty((int)0, (BValue)BHalign.center, null);
|
||||
public static final Property rowAlign = BCoordinatedGridPane.newProperty((int)0, (BValue)BValign.center, null);
|
||||
public static final Property columnAlign = BCoordinatedGridPane.newProperty((int)0, (BValue)BHalign.left, null);
|
||||
public static final Property rowGap = BCoordinatedGridPane.newProperty((int)0, (int)3, null);
|
||||
public static final Property columnGap = BCoordinatedGridPane.newProperty((int)0, (int)3, null);
|
||||
public static final Property uniformRowHeight = BCoordinatedGridPane.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property uniformColumnWidth = BCoordinatedGridPane.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property stretchRow = BCoordinatedGridPane.newProperty((int)0, (int)-1, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)-1)));
|
||||
public static final Property stretchColumn = BCoordinatedGridPane.newProperty((int)0, (int)-1, (BFacets)BFacets.make((String)"min", (BIDataValue)BInteger.make((int)-1)));
|
||||
public static final Property colorRows = BCoordinatedGridPane.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property colorEvenRows = BCoordinatedGridPane.newProperty((int)0, (boolean)false, null);
|
||||
public static final Property bandBrush = BCoordinatedGridPane.newProperty((int)0, (BValue)BColor.make((int)190, (int)190, (int)190).toBrush(), null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BCoordinatedGridPane == null ? (class$com$tridium$platform$ui$util$BCoordinatedGridPane = BCoordinatedGridPane.class$("com.tridium.platform.ui.util.BCoordinatedGridPane")) : class$com$tridium$platform$ui$util$BCoordinatedGridPane));
|
||||
private static final BIcon icon = BIcon.std((String)"widgets/gridPane.png");
|
||||
double xo;
|
||||
double yo;
|
||||
double[] rh = new double[0];
|
||||
double[] cw = new double[0];
|
||||
ColumnSupport colSupport = new ColumnSupport(this);
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BCoordinatedGridPane;
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.getInt(columnCount);
|
||||
}
|
||||
|
||||
public void setColumnCount(int n) {
|
||||
this.setInt(columnCount, n, null);
|
||||
}
|
||||
|
||||
public BValign getValign() {
|
||||
return (BValign)this.get(valign);
|
||||
}
|
||||
|
||||
public void setValign(BValign bValign) {
|
||||
this.set(valign, (BValue)bValign, null);
|
||||
}
|
||||
|
||||
public BHalign getHalign() {
|
||||
return (BHalign)this.get(halign);
|
||||
}
|
||||
|
||||
public void setHalign(BHalign bHalign) {
|
||||
this.set(halign, (BValue)bHalign, null);
|
||||
}
|
||||
|
||||
public BValign getRowAlign() {
|
||||
return (BValign)this.get(rowAlign);
|
||||
}
|
||||
|
||||
public void setRowAlign(BValign bValign) {
|
||||
this.set(rowAlign, (BValue)bValign, null);
|
||||
}
|
||||
|
||||
public BHalign getColumnAlign() {
|
||||
return (BHalign)this.get(columnAlign);
|
||||
}
|
||||
|
||||
public void setColumnAlign(BHalign bHalign) {
|
||||
this.set(columnAlign, (BValue)bHalign, null);
|
||||
}
|
||||
|
||||
public double getRowGap() {
|
||||
return this.getDouble(rowGap);
|
||||
}
|
||||
|
||||
public void setRowGap(double d) {
|
||||
this.setDouble(rowGap, d, null);
|
||||
}
|
||||
|
||||
public double getColumnGap() {
|
||||
return this.getDouble(columnGap);
|
||||
}
|
||||
|
||||
public void setColumnGap(double d) {
|
||||
this.setDouble(columnGap, d, null);
|
||||
}
|
||||
|
||||
public boolean getUniformRowHeight() {
|
||||
return this.getBoolean(uniformRowHeight);
|
||||
}
|
||||
|
||||
public void setUniformRowHeight(boolean bl) {
|
||||
this.setBoolean(uniformRowHeight, bl, null);
|
||||
}
|
||||
|
||||
public boolean getUniformColumnWidth() {
|
||||
return this.getBoolean(uniformColumnWidth);
|
||||
}
|
||||
|
||||
public void setUniformColumnWidth(boolean bl) {
|
||||
this.setBoolean(uniformColumnWidth, bl, null);
|
||||
}
|
||||
|
||||
public int getStretchRow() {
|
||||
return this.getInt(stretchRow);
|
||||
}
|
||||
|
||||
public void setStretchRow(int n) {
|
||||
this.setInt(stretchRow, n, null);
|
||||
}
|
||||
|
||||
public int getStretchColumn() {
|
||||
return this.getInt(stretchColumn);
|
||||
}
|
||||
|
||||
public void setStretchColumn(int n) {
|
||||
this.setInt(stretchColumn, n, null);
|
||||
}
|
||||
|
||||
public boolean getColorRows() {
|
||||
return this.getBoolean(colorRows);
|
||||
}
|
||||
|
||||
public void setColorRows(boolean bl) {
|
||||
this.setBoolean(colorRows, bl, null);
|
||||
}
|
||||
|
||||
public boolean getColorEvenRows() {
|
||||
return this.getBoolean(colorEvenRows);
|
||||
}
|
||||
|
||||
public void setColorEvenRows(boolean bl) {
|
||||
this.setBoolean(colorEvenRows, bl, null);
|
||||
}
|
||||
|
||||
public BBrush getBandBrush() {
|
||||
return (BBrush)this.get(bandBrush);
|
||||
}
|
||||
|
||||
public void setBandBrush(BBrush bBrush) {
|
||||
this.set(bandBrush, (BValue)bBrush, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BCoordinatedGridPane(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
this.setMaster(bCoordinatedGridPane);
|
||||
}
|
||||
|
||||
public BCoordinatedGridPane(int n) {
|
||||
this.setColumnCount(n);
|
||||
}
|
||||
|
||||
public BCoordinatedGridPane() {
|
||||
}
|
||||
|
||||
public BCoordinatedGridPane(int n, BWidget[] bWidgetArray) {
|
||||
this.setColumnCount(n);
|
||||
for (int i = 0; i < bWidgetArray.length; ++i) {
|
||||
this.add(null, (BValue)bWidgetArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public BCoordinatedGridPane(BWidget[] bWidgetArray) {
|
||||
for (int i = 0; i < bWidgetArray.length; ++i) {
|
||||
this.add(null, (BValue)bWidgetArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaster(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
this.setColumnCount(bCoordinatedGridPane.getColumnCount());
|
||||
this.setColumnGap(bCoordinatedGridPane.getColumnGap());
|
||||
this.setStretchColumn(bCoordinatedGridPane.getStretchColumn());
|
||||
this.setColumnSupport(bCoordinatedGridPane.getColumnSupport());
|
||||
this.setUniformColumnWidth(bCoordinatedGridPane.getUniformColumnWidth());
|
||||
}
|
||||
|
||||
public ColumnSupport getColumnSupport() {
|
||||
return this.colSupport;
|
||||
}
|
||||
|
||||
public void setColumnSupport(ColumnSupport columnSupport) {
|
||||
if (this.colSupport != columnSupport) {
|
||||
this.colSupport.removePane(this);
|
||||
this.colSupport = columnSupport;
|
||||
this.colSupport.addPane(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void computePreferredSize() {
|
||||
int n;
|
||||
BWidget[] bWidgetArray = this.getChildWidgets();
|
||||
double d = this.colSupport.getColumnGap();
|
||||
double d2 = this.getRowGap();
|
||||
this.cw = this.colSupport.computeColumnWidths(this);
|
||||
if (this.cw == null) {
|
||||
return;
|
||||
}
|
||||
int n2 = this.cw.length;
|
||||
int n3 = bWidgetArray.length / n2;
|
||||
if (bWidgetArray.length % n2 > 0) {
|
||||
++n3;
|
||||
}
|
||||
this.rh = new double[n3];
|
||||
double d3 = 0.0;
|
||||
int n4 = 0;
|
||||
block0: for (n = 0; n < this.rh.length; ++n) {
|
||||
for (int i = 0; i < this.cw.length; ++i) {
|
||||
BWidget bWidget;
|
||||
if (n4 >= bWidgetArray.length) break block0;
|
||||
if (!(bWidget = bWidgetArray[n4++]).isVisible()) continue;
|
||||
bWidget.computePreferredSize();
|
||||
this.rh[n] = Math.max(this.rh[n], bWidget.getPreferredHeight());
|
||||
d3 = Math.max(this.rh[n], d3);
|
||||
}
|
||||
}
|
||||
if (this.getUniformRowHeight()) {
|
||||
for (n = 0; n < this.rh.length; ++n) {
|
||||
this.rh[n] = d3;
|
||||
}
|
||||
}
|
||||
double d4 = 0.0;
|
||||
double d5 = 0.0;
|
||||
for (n4 = 0; n4 < this.cw.length; ++n4) {
|
||||
if (n4 > 0) {
|
||||
d4 += d;
|
||||
}
|
||||
d4 += this.cw[n4];
|
||||
}
|
||||
for (n4 = 0; n4 < this.rh.length; ++n4) {
|
||||
if (n4 > 0) {
|
||||
d5 += d2;
|
||||
}
|
||||
d5 += this.rh[n4];
|
||||
}
|
||||
this.setPreferredSize(d4, d5);
|
||||
}
|
||||
|
||||
private double[] computeColumnWidths(double[] dArray) {
|
||||
BWidget[] bWidgetArray = this.getChildWidgets();
|
||||
int n = dArray.length;
|
||||
int n2 = bWidgetArray.length / n;
|
||||
if (bWidgetArray.length % n > 0) {
|
||||
++n2;
|
||||
}
|
||||
double[] dArray2 = new double[n];
|
||||
System.arraycopy(dArray, 0, dArray2, 0, n);
|
||||
int n3 = 0;
|
||||
block0: for (int i = 0; i < n2; ++i) {
|
||||
for (int j = 0; j < dArray2.length; ++j) {
|
||||
BWidget bWidget;
|
||||
if (n3 >= bWidgetArray.length) break block0;
|
||||
if (!(bWidget = bWidgetArray[n3++]).isVisible()) continue;
|
||||
bWidget.computePreferredSize();
|
||||
dArray2[j] = Math.max(dArray2[j], bWidget.getPreferredWidth());
|
||||
}
|
||||
}
|
||||
return dArray2;
|
||||
}
|
||||
|
||||
public void doLayout(BWidget[] bWidgetArray) {
|
||||
int n;
|
||||
this.computePreferredSize();
|
||||
if (this.cw == null) {
|
||||
return;
|
||||
}
|
||||
double d = this.getPreferredWidth();
|
||||
double d2 = this.getPreferredHeight();
|
||||
double d3 = this.getWidth();
|
||||
double d4 = this.getHeight();
|
||||
double d5 = this.colSupport.getColumnGap();
|
||||
double d6 = this.getRowGap();
|
||||
int n2 = this.getColumnAlign().getOrdinal();
|
||||
int n3 = this.getRowAlign().getOrdinal();
|
||||
int n4 = this.getStretchRow();
|
||||
int n5 = this.colSupport.getStretchColumn();
|
||||
this.xo = 0.0;
|
||||
if (d3 > d && n5 < 0) {
|
||||
n = this.getHalign().getOrdinal();
|
||||
if (n == 1) {
|
||||
this.xo = (d3 - d) / 2.0;
|
||||
}
|
||||
if (n == 2) {
|
||||
this.xo = d3 - d;
|
||||
}
|
||||
}
|
||||
this.yo = 0.0;
|
||||
if (d4 > d2 && n4 < 0) {
|
||||
n = this.getValign().getOrdinal();
|
||||
if (n == 1) {
|
||||
this.yo = (d4 - d2) / 2.0;
|
||||
}
|
||||
if (n == 2) {
|
||||
this.yo = d4 - d2;
|
||||
}
|
||||
}
|
||||
if (n5 >= 0 && n5 < this.cw.length && d3 > d) {
|
||||
int n6 = n5;
|
||||
this.cw[n6] = this.cw[n6] + (d3 - d);
|
||||
}
|
||||
if (n4 >= 0 && n4 < this.rh.length && d4 > d2) {
|
||||
int n7 = n4;
|
||||
this.rh[n7] = this.rh[n7] + (d4 - d2);
|
||||
}
|
||||
n = 0;
|
||||
double d7 = 0.0;
|
||||
double d8 = 0.0;
|
||||
block0: for (int i = 0; i < this.rh.length; ++i) {
|
||||
d7 = 0.0;
|
||||
for (int j = 0; j < this.cw.length; ++j) {
|
||||
if (n >= bWidgetArray.length) break block0;
|
||||
BWidget bWidget = bWidgetArray[n++];
|
||||
double d9 = this.cw[j];
|
||||
double d10 = this.rh[i];
|
||||
double d11 = this.xo + d7;
|
||||
double d12 = this.yo + d8;
|
||||
double d13 = d9;
|
||||
double d14 = d10;
|
||||
if (n2 != 3) {
|
||||
d13 = bWidget.getPreferredWidth();
|
||||
if (n2 == 1) {
|
||||
d11 = this.xo + d7 + (d9 - d13) / 2.0;
|
||||
}
|
||||
if (n2 == 2) {
|
||||
d11 = this.xo + d7 + d9 - d13;
|
||||
}
|
||||
}
|
||||
if (n3 != 3) {
|
||||
d14 = bWidget.getPreferredHeight();
|
||||
if (n3 == 1) {
|
||||
d12 = this.yo + d8 + (d10 - d14) / 2.0;
|
||||
}
|
||||
if (n3 == 2) {
|
||||
d12 = this.yo + d8 + d10 - d14;
|
||||
}
|
||||
}
|
||||
bWidget.setBounds((double)((int)d11), (double)((int)d12), (double)((int)d13), (double)((int)d14));
|
||||
d7 += this.cw[j] + d5;
|
||||
}
|
||||
d8 += this.rh[i] + d6;
|
||||
}
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics) {
|
||||
double d = this.getRowGap();
|
||||
double d2 = this.getWidth();
|
||||
if (this.getColorRows()) {
|
||||
graphics.setBrush(this.getBandBrush());
|
||||
double d3 = d / 2.0;
|
||||
double d4 = this.yo;
|
||||
int n = this.getColorEvenRows() ? 1 : 0;
|
||||
for (int i = 0; i < this.rh.length; ++i) {
|
||||
if (i % 2 == n) {
|
||||
graphics.fillRect(0.0, d4 - d3, d2, this.rh[i] + d);
|
||||
}
|
||||
d4 += this.rh[i] + d;
|
||||
}
|
||||
}
|
||||
super.paint(graphics);
|
||||
}
|
||||
|
||||
public void changed(Property property, Context context) {
|
||||
this.relayout();
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class ColumnSupport {
|
||||
private double[] cw;
|
||||
private Array panes = new Array(class$com$tridium$platform$ui$util$BCoordinatedGridPane == null ? (class$com$tridium$platform$ui$util$BCoordinatedGridPane = BCoordinatedGridPane.class$("com.tridium.platform.ui.util.BCoordinatedGridPane")) : class$com$tridium$platform$ui$util$BCoordinatedGridPane);
|
||||
|
||||
public ColumnSupport(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
this.panes.add((Object)bCoordinatedGridPane);
|
||||
}
|
||||
|
||||
public void addPane(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
if (!this.panes.contains((Object)bCoordinatedGridPane)) {
|
||||
this.panes.add((Object)bCoordinatedGridPane);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePane(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
this.panes.remove((Object)bCoordinatedGridPane);
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
BCoordinatedGridPane bCoordinatedGridPane = (BCoordinatedGridPane)((Object)this.panes.get(0));
|
||||
return bCoordinatedGridPane.getColumnCount();
|
||||
}
|
||||
|
||||
public double getColumnGap() {
|
||||
BCoordinatedGridPane bCoordinatedGridPane = (BCoordinatedGridPane)((Object)this.panes.get(0));
|
||||
return bCoordinatedGridPane.getColumnGap();
|
||||
}
|
||||
|
||||
public int getStretchColumn() {
|
||||
BCoordinatedGridPane bCoordinatedGridPane = (BCoordinatedGridPane)((Object)this.panes.get(0));
|
||||
return bCoordinatedGridPane.getStretchColumn();
|
||||
}
|
||||
|
||||
public boolean getUniformColumnWidth() {
|
||||
BCoordinatedGridPane bCoordinatedGridPane = (BCoordinatedGridPane)((Object)this.panes.get(0));
|
||||
return bCoordinatedGridPane.getUniformColumnWidth();
|
||||
}
|
||||
|
||||
public double[] computeColumnWidths(BCoordinatedGridPane bCoordinatedGridPane) {
|
||||
BCoordinatedGridPane bCoordinatedGridPane2 = (BCoordinatedGridPane)((Object)this.panes.get(0));
|
||||
if (bCoordinatedGridPane == bCoordinatedGridPane2) {
|
||||
int n;
|
||||
int n2 = bCoordinatedGridPane2.getColumnCount();
|
||||
if (n2 < 0) {
|
||||
n2 = 1;
|
||||
}
|
||||
this.cw = new double[n2];
|
||||
for (n = 0; n < n2; ++n) {
|
||||
this.cw[n] = 0.0;
|
||||
}
|
||||
for (n = 0; n < this.panes.size(); ++n) {
|
||||
this.cw = ((BCoordinatedGridPane)((Object)this.panes.get(n))).computeColumnWidths(this.cw);
|
||||
}
|
||||
if (bCoordinatedGridPane2.getUniformColumnWidth()) {
|
||||
int n3;
|
||||
double d = 0.0;
|
||||
for (n3 = 0; n3 < this.cw.length; ++n3) {
|
||||
d = Math.max(this.cw[n3], d);
|
||||
}
|
||||
for (n3 = 0; n3 < this.cw.length; ++n3) {
|
||||
this.cw[n3] = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.cw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.event.BWidgetEvent
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BDirectoryTree;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.event.BWidgetEvent;
|
||||
|
||||
public class BDirectoryNodeEvent
|
||||
extends BWidgetEvent {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BDirectoryNodeEvent == null ? (class$com$tridium$platform$ui$util$BDirectoryNodeEvent = BDirectoryNodeEvent.class$("com.tridium.platform.ui.util.BDirectoryNodeEvent")) : class$com$tridium$platform$ui$util$BDirectoryNodeEvent));
|
||||
private ArrayList nodes = new ArrayList();
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BDirectoryNodeEvent;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDirectoryNodeEvent(BWidget bWidget, BDirectoryTree.DirectoryTreeNode directoryTreeNode) {
|
||||
this(bWidget);
|
||||
this.nodes.add(directoryTreeNode);
|
||||
}
|
||||
|
||||
public BDirectoryNodeEvent(BWidget bWidget, BDirectoryTree.DirectoryTreeNode[] directoryTreeNodeArray) {
|
||||
this(bWidget);
|
||||
for (int i = 0; i < directoryTreeNodeArray.length; ++i) {
|
||||
this.nodes.add(directoryTreeNodeArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public BDirectoryNodeEvent() {
|
||||
}
|
||||
|
||||
public BDirectoryNodeEvent(BWidget bWidget) {
|
||||
super(1, bWidget);
|
||||
}
|
||||
|
||||
public void addNode(BDirectoryTree.DirectoryTreeNode directoryTreeNode) {
|
||||
this.nodes.add(directoryTreeNode);
|
||||
}
|
||||
|
||||
public BDirectoryTree.DirectoryTreeNode[] getNodes() {
|
||||
BDirectoryTree.DirectoryTreeNode[] directoryTreeNodeArray = new BDirectoryTree.DirectoryTreeNode[this.nodes.size()];
|
||||
this.nodes.toArray(directoryTreeNodeArray);
|
||||
return directoryTreeNodeArray;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.gx.BBrush
|
||||
* javax.baja.gx.BColor
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Topic
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.tree.BTree
|
||||
* javax.baja.ui.tree.TreeController
|
||||
* javax.baja.ui.tree.TreeModel
|
||||
* javax.baja.ui.tree.TreeNode
|
||||
* javax.baja.ui.tree.TreeNodeRenderer
|
||||
* javax.baja.ui.tree.TreeSelection
|
||||
* javax.baja.util.PatternFilter
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BDirectoryNodeEvent;
|
||||
import com.tridium.platform.ui.util.BTreeCascadePolicy;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.gx.BBrush;
|
||||
import javax.baja.gx.BColor;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Topic;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.tree.BTree;
|
||||
import javax.baja.ui.tree.TreeController;
|
||||
import javax.baja.ui.tree.TreeModel;
|
||||
import javax.baja.ui.tree.TreeNode;
|
||||
import javax.baja.ui.tree.TreeNodeRenderer;
|
||||
import javax.baja.ui.tree.TreeSelection;
|
||||
import javax.baja.util.PatternFilter;
|
||||
|
||||
public class BDirectoryTree
|
||||
extends BTree {
|
||||
public static final Topic nodeChecked = BDirectoryTree.newTopic((int)0, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BDirectoryTree == null ? (class$com$tridium$platform$ui$util$BDirectoryTree = BDirectoryTree.class$("com.tridium.platform.ui.util.BDirectoryTree")) : class$com$tridium$platform$ui$util$BDirectoryTree));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BDirectoryTree;
|
||||
|
||||
public void fireNodeChecked(BDirectoryNodeEvent bDirectoryNodeEvent) {
|
||||
this.fire(nodeChecked, (BValue)bDirectoryNodeEvent, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BDirectoryTree() {
|
||||
this(new DirectoryTreeModel(), new DirectoryTreeController());
|
||||
}
|
||||
|
||||
public BDirectoryTree(TreeModel treeModel) {
|
||||
this(treeModel, new DirectoryTreeController());
|
||||
}
|
||||
|
||||
public BDirectoryTree(TreeModel treeModel, TreeController treeController) {
|
||||
super(treeModel, treeController);
|
||||
this.setNodeRenderer(new DirectoryTreeNodeRenderer());
|
||||
this.setSelection(new TreeSelection());
|
||||
}
|
||||
|
||||
public void setModel(TreeModel treeModel) {
|
||||
super.setModel((TreeModel)((DirectoryTreeModel)treeModel));
|
||||
}
|
||||
|
||||
public DirectoryTreeModel getDirectoryTreeModel() {
|
||||
return (DirectoryTreeModel)this.getModel();
|
||||
}
|
||||
|
||||
public void setController(TreeController treeController) {
|
||||
super.setController((TreeController)((DirectoryTreeController)treeController));
|
||||
}
|
||||
|
||||
public DirectoryTreeController getDirectoryTreeController() {
|
||||
return (DirectoryTreeController)this.getController();
|
||||
}
|
||||
|
||||
public DirectoryTreeNodeRenderer getDirectoryTreeNodeRenderer() {
|
||||
return (DirectoryTreeNodeRenderer)this.getNodeRenderer();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectoryTreeNodeRenderer
|
||||
extends TreeNodeRenderer {
|
||||
public double getWidth(TreeNode treeNode) {
|
||||
return super.getWidth(treeNode) + 10.0 + 2.0;
|
||||
}
|
||||
|
||||
public BBrush getForeground(TreeNode treeNode) {
|
||||
DirectoryTreeNode directoryTreeNode = (DirectoryTreeNode)treeNode;
|
||||
return directoryTreeNode.isCheckEnabled() ? super.getForeground((TreeNode)directoryTreeNode) : BColor.gray.toBrush();
|
||||
}
|
||||
|
||||
public void paintNode(Graphics graphics, TreeNode treeNode, double d, double d2) {
|
||||
DirectoryTreeNode directoryTreeNode = (DirectoryTreeNode)treeNode;
|
||||
double d3 = d;
|
||||
double d4 = d2 + this.getHeight() / 2.0 - 5.0;
|
||||
double d5 = 10.0;
|
||||
double d6 = 10.0;
|
||||
graphics.setBrush(this.getForeground(treeNode));
|
||||
graphics.strokeRect(d3, d4, d5, d6);
|
||||
if (directoryTreeNode.isChecked()) {
|
||||
graphics.strokeLine(d3, d4, d3 + d5, d4 + d6);
|
||||
graphics.strokeLine(d3, d4 + d5, d3 + d5, d4);
|
||||
}
|
||||
super.paintNode(graphics, treeNode, d + 12.0, d2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectoryTreeNode
|
||||
extends TreeNode {
|
||||
private BIDirectory dir;
|
||||
private boolean checked = true;
|
||||
private boolean checkEnabled = true;
|
||||
private ArrayList childNodes;
|
||||
public static final BImage icon = BImage.make((String)"module://icons/x16/folder.png");
|
||||
public static final BImage disabledIcon = icon.getDisabledImage();
|
||||
|
||||
public DirectoryTreeNode(DirectoryTreeModel directoryTreeModel, BIDirectory bIDirectory) {
|
||||
super((TreeModel)directoryTreeModel);
|
||||
this.init(bIDirectory);
|
||||
}
|
||||
|
||||
public DirectoryTreeNode(BIDirectory bIDirectory, DirectoryTreeNode directoryTreeNode) {
|
||||
super((TreeNode)directoryTreeNode);
|
||||
this.init(bIDirectory);
|
||||
}
|
||||
|
||||
private void init(BIDirectory bIDirectory) {
|
||||
this.dir = bIDirectory;
|
||||
this.childNodes = new ArrayList();
|
||||
try {
|
||||
BIFile[] bIFileArray = bIDirectory.listFiles();
|
||||
for (int i = 0; i < bIFileArray.length; ++i) {
|
||||
if (!bIFileArray[i].isDirectory()) continue;
|
||||
this.childNodes.add(new DirectoryTreeNode((BIDirectory)bIFileArray[i], this));
|
||||
}
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
this.setExpanded(true);
|
||||
}
|
||||
|
||||
public BIFile getFile() {
|
||||
return (BIFile)this.getDirectory();
|
||||
}
|
||||
|
||||
public BIDirectory getDirectory() {
|
||||
return this.dir;
|
||||
}
|
||||
|
||||
public boolean inCheckBox(double d, double d2) {
|
||||
double d3 = this.getX() + Theme.tree().getExpanderWidth() + 4.0;
|
||||
return d >= d3 && d <= d3 + 10.0;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return this.checked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean bl) {
|
||||
this.setChecked(bl, BTreeCascadePolicy.never, BTreeCascadePolicy.never, false);
|
||||
}
|
||||
|
||||
public void setChecked(boolean bl, BTreeCascadePolicy bTreeCascadePolicy) {
|
||||
this.setChecked(bl, bTreeCascadePolicy, BTreeCascadePolicy.never, false);
|
||||
}
|
||||
|
||||
public void setChecked(boolean bl, BTreeCascadePolicy bTreeCascadePolicy, BTreeCascadePolicy bTreeCascadePolicy2, boolean bl2) {
|
||||
BDirectoryNodeEvent bDirectoryNodeEvent = new BDirectoryNodeEvent();
|
||||
this.setChecked(bl, bTreeCascadePolicy, bTreeCascadePolicy2, bDirectoryNodeEvent, bl2);
|
||||
((DirectoryTreeModel)this.getModel()).fireNodeChecked(bDirectoryNodeEvent);
|
||||
}
|
||||
|
||||
private void setChecked(boolean bl, BTreeCascadePolicy bTreeCascadePolicy, BTreeCascadePolicy bTreeCascadePolicy2, BDirectoryNodeEvent bDirectoryNodeEvent, boolean bl2) {
|
||||
TreeNode treeNode;
|
||||
if (this.checked != bl && (this.isCheckEnabled() || !bl2)) {
|
||||
this.checked = bl;
|
||||
bDirectoryNodeEvent.addNode(this);
|
||||
}
|
||||
if (bTreeCascadePolicy.cascade(bl)) {
|
||||
for (int i = 0; i < this.getChildCount(); ++i) {
|
||||
((DirectoryTreeNode)this.getChild(i)).setChecked(bl, BTreeCascadePolicy.always, BTreeCascadePolicy.never, bDirectoryNodeEvent, bl2);
|
||||
}
|
||||
}
|
||||
if (bTreeCascadePolicy2.cascade(bl) && (treeNode = this.getParent()) != null && treeNode instanceof DirectoryTreeNode) {
|
||||
((DirectoryTreeNode)treeNode).setChecked(bl, BTreeCascadePolicy.never, BTreeCascadePolicy.always, bDirectoryNodeEvent, bl2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCheckEnabled() {
|
||||
return this.checkEnabled;
|
||||
}
|
||||
|
||||
public void setCheckEnabled(boolean bl) {
|
||||
this.setCheckEnabled(bl, false);
|
||||
}
|
||||
|
||||
public void setCheckEnabled(boolean bl, boolean bl2) {
|
||||
this.checkEnabled = bl;
|
||||
if (bl2) {
|
||||
for (int i = 0; i < this.getChildCount(); ++i) {
|
||||
((DirectoryTreeNode)this.getChild(i)).setCheckEnabled(bl, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleChecked() {
|
||||
this.toggleChecked(BTreeCascadePolicy.never, BTreeCascadePolicy.never);
|
||||
}
|
||||
|
||||
public void toggleChecked(BTreeCascadePolicy bTreeCascadePolicy) {
|
||||
this.toggleChecked(bTreeCascadePolicy, BTreeCascadePolicy.never);
|
||||
}
|
||||
|
||||
public void toggleChecked(BTreeCascadePolicy bTreeCascadePolicy, BTreeCascadePolicy bTreeCascadePolicy2) {
|
||||
this.setChecked(!this.isChecked(), bTreeCascadePolicy, bTreeCascadePolicy2, true);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return ((BIFile)this.dir).getFileName();
|
||||
}
|
||||
|
||||
public BImage getIcon() {
|
||||
return this.checkEnabled ? icon : disabledIcon;
|
||||
}
|
||||
|
||||
public int getChildCount() {
|
||||
return this.childNodes.size();
|
||||
}
|
||||
|
||||
public TreeNode getChild(int n) {
|
||||
return (TreeNode)this.childNodes.get(n);
|
||||
}
|
||||
|
||||
public TreeNode getChild(String string) {
|
||||
for (int i = 0; i < this.getChildCount(); ++i) {
|
||||
if (!((BIFile)((DirectoryTreeNode)this.getChild(i)).getDirectory()).getFileName().equals(string)) continue;
|
||||
return this.getChild(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectoryTreeModel
|
||||
extends TreeModel {
|
||||
private DirectoryTreeNode root;
|
||||
|
||||
public void setRootDirectory(BIDirectory bIDirectory) {
|
||||
if (bIDirectory == null) {
|
||||
this.root = null;
|
||||
} else {
|
||||
this.root = new DirectoryTreeNode(this, bIDirectory);
|
||||
this.root.setCheckEnabled(false);
|
||||
}
|
||||
this.updateTree();
|
||||
}
|
||||
|
||||
public void fireNodeChecked(BDirectoryNodeEvent bDirectoryNodeEvent) {
|
||||
if (this.getTree() instanceof BDirectoryTree) {
|
||||
((BDirectoryTree)this.getTree()).fireNodeChecked(bDirectoryNodeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRootCount() {
|
||||
return this.root == null ? 0 : 1;
|
||||
}
|
||||
|
||||
public Iterator getCheckedDirectories() {
|
||||
return this.getCheckedDirectories(true);
|
||||
}
|
||||
|
||||
public Iterator getCheckedDirectories(boolean bl) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
this.getCheckedDirectories(this.root, bl, arrayList);
|
||||
return arrayList.iterator();
|
||||
}
|
||||
|
||||
private void getCheckedDirectories(DirectoryTreeNode directoryTreeNode, boolean bl, Collection collection) {
|
||||
if (directoryTreeNode.isChecked() == bl) {
|
||||
collection.add(directoryTreeNode.getDirectory());
|
||||
}
|
||||
for (int i = 0; i < directoryTreeNode.getChildCount(); ++i) {
|
||||
this.getCheckedDirectories((DirectoryTreeNode)directoryTreeNode.getChild(i), bl, collection);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDirectoryStates(DirectoryTreeNode directoryTreeNode, PatternFilter[] patternFilterArray, boolean bl, boolean bl2, boolean bl3) {
|
||||
if (directoryTreeNode != null) {
|
||||
int n;
|
||||
String string = ((BIFile)directoryTreeNode.getDirectory()).getFileName();
|
||||
for (n = 0; n < patternFilterArray.length; ++n) {
|
||||
if (!patternFilterArray[n].accept(string)) continue;
|
||||
directoryTreeNode.setChecked(bl);
|
||||
directoryTreeNode.setCheckEnabled(bl2);
|
||||
directoryTreeNode.setExpanded(bl3);
|
||||
}
|
||||
for (n = 0; n < directoryTreeNode.getChildCount(); ++n) {
|
||||
this.setDirectoryStates((DirectoryTreeNode)directoryTreeNode.getChild(n), patternFilterArray, bl, bl2, bl3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TreeNode getRoot(int n) {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public TreeNode findNode(FilePath filePath) {
|
||||
FilePath filePath2 = ((BIFile)this.root.getDirectory()).getFilePath();
|
||||
if (filePath.getAbsoluteMode() != filePath2.getAbsoluteMode() || filePath.depth() < filePath2.depth()) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < filePath2.depth(); ++i) {
|
||||
if (filePath2.nameAt(i).equals(filePath.nameAt(i))) continue;
|
||||
return null;
|
||||
}
|
||||
DirectoryTreeNode directoryTreeNode = this.root;
|
||||
for (int i = filePath2.depth(); i < filePath.depth(); ++i) {
|
||||
if ((directoryTreeNode = (DirectoryTreeNode)directoryTreeNode.getChild(filePath.nameAt(i))) != null) continue;
|
||||
return null;
|
||||
}
|
||||
return directoryTreeNode;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectoryTreeController
|
||||
extends TreeController {
|
||||
private BTreeCascadePolicy cascadeAncestorPolicy = BTreeCascadePolicy.never;
|
||||
private BTreeCascadePolicy cascadeDescendantPolicy = BTreeCascadePolicy.always;
|
||||
|
||||
public void mousePressed(BMouseEvent bMouseEvent) {
|
||||
this.getTree().requestFocus();
|
||||
double d = bMouseEvent.getX();
|
||||
double d2 = bMouseEvent.getY();
|
||||
DirectoryTreeNode directoryTreeNode = (DirectoryTreeNode)this.getTree().yToTreeNode(d2);
|
||||
if (directoryTreeNode != null) {
|
||||
if (directoryTreeNode.inExpander(d, d2)) {
|
||||
this.getTree().toggleExpanded((TreeNode)directoryTreeNode);
|
||||
} else if (directoryTreeNode.inCheckBox(d, d2)) {
|
||||
if (directoryTreeNode.isCheckEnabled()) {
|
||||
directoryTreeNode.toggleChecked(this.getCascadeDescendantPolicy(), this.getCascadeAncestorPolicy());
|
||||
this.getTree().relayout();
|
||||
}
|
||||
} else if (directoryTreeNode.isSelection(d, d2)) {
|
||||
this.mouseSelection(directoryTreeNode, bMouseEvent);
|
||||
if (!bMouseEvent.isButton3Down() && bMouseEvent.getClickCount() == 2) {
|
||||
this.doSelectAction(directoryTreeNode, bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
} else {
|
||||
directoryTreeNode = null;
|
||||
this.mouseSelection(null, bMouseEvent);
|
||||
}
|
||||
} else {
|
||||
this.mouseSelection(null, bMouseEvent);
|
||||
}
|
||||
if (bMouseEvent.isPopupTrigger()) {
|
||||
this.popup(bMouseEvent, directoryTreeNode);
|
||||
}
|
||||
}
|
||||
|
||||
public BTreeCascadePolicy getCascadeAncestorPolicy() {
|
||||
return this.cascadeAncestorPolicy;
|
||||
}
|
||||
|
||||
public void setCascadeAncestorPolicy(BTreeCascadePolicy bTreeCascadePolicy) {
|
||||
this.cascadeAncestorPolicy = bTreeCascadePolicy;
|
||||
}
|
||||
|
||||
public BTreeCascadePolicy getCascadeDescendantPolicy() {
|
||||
return this.cascadeDescendantPolicy;
|
||||
}
|
||||
|
||||
public void setCascadeDescendantPolicy(BTreeCascadePolicy bTreeCascadePolicy) {
|
||||
this.cascadeDescendantPolicy = bTreeCascadePolicy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.agent.AgentFilter
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.RectGeom
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BFrame
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BScrollBarPolicy
|
||||
* javax.baja.ui.pane.BConstrainedPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BScrollPane
|
||||
* javax.baja.workbench.BWbEditor
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BButtonPane;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import javax.baja.agent.AgentFilter;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.RectGeom;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BFrame;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BScrollBarPolicy;
|
||||
import javax.baja.ui.pane.BConstrainedPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BScrollPane;
|
||||
import javax.baja.workbench.BWbEditor;
|
||||
|
||||
public class BEditorWindow
|
||||
extends BFrame {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BEditorWindow == null ? (class$com$tridium$platform$ui$util$BEditorWindow = BEditorWindow.class$("com.tridium.platform.ui.util.BEditorWindow")) : class$com$tridium$platform$ui$util$BEditorWindow));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BEditorWindow;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BEditorWindow() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public BEditorWindow(BObject bObject, Type type) {
|
||||
this.init((BWbEditor)type.getInstance(), bObject);
|
||||
}
|
||||
|
||||
public BEditorWindow(BObject bObject) {
|
||||
BWbEditor bWbEditor = (BWbEditor)bObject.getAgents().filter(AgentFilter.is((Type)BWbEditor.TYPE)).getDefault().getInstance();
|
||||
this.init(bWbEditor, bObject);
|
||||
}
|
||||
|
||||
private void init(BWbEditor bWbEditor, BObject bObject) {
|
||||
bWbEditor.loadValue(bObject);
|
||||
BButtonPane bButtonPane = new BButtonPane();
|
||||
bButtonPane.add(new CloseCommand(), true, true);
|
||||
BScrollPane bScrollPane = new BScrollPane((BWidget)bWbEditor);
|
||||
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)bScrollPane);
|
||||
bScrollPane.setViewportBackground(Theme.scrollPane().getControlBackground());
|
||||
bScrollPane.setBorderPolicy(BScrollBarPolicy.never);
|
||||
bConstrainedPane.setMaxHeight(350.0);
|
||||
bConstrainedPane.setMinWidth(350.0);
|
||||
this.setContent((BWidget)new BEdgePane(null, (BWidget)bButtonPane, null, null, (BWidget)bConstrainedPane));
|
||||
if (bObject instanceof BINavNode) {
|
||||
this.setTitle(((BINavNode)bObject).getNavDescription(null));
|
||||
}
|
||||
this.setIconImage(BImage.make((BIcon)bObject.getIcon()));
|
||||
this.setBoundsCenteredOnScreen();
|
||||
}
|
||||
|
||||
public void setBoundsCenteredOnScreen() {
|
||||
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setBoundsCenteredOn(new RectGeom(0.0, 0.0, (double)dimension.width, (double)dimension.height));
|
||||
}
|
||||
|
||||
public void setBoundsCenteredOn(RectGeom rectGeom) {
|
||||
this.computePreferredSize();
|
||||
double d = this.getPreferredWidth() + 8.0;
|
||||
double d2 = this.getPreferredHeight() + 27.0;
|
||||
double d3 = rectGeom.x + (rectGeom.width - d) / 2.0;
|
||||
double d4 = rectGeom.y + (rectGeom.height - d2) / 2.0;
|
||||
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
double d5 = dimension.width;
|
||||
double d6 = dimension.height;
|
||||
if (d3 + d > d5) {
|
||||
d3 = d5 - d;
|
||||
}
|
||||
if (d4 + d2 > d6) {
|
||||
d4 = d6 - d2;
|
||||
}
|
||||
if (d3 < 0.0) {
|
||||
d3 = 0.0;
|
||||
}
|
||||
if (d4 < 0.0) {
|
||||
d4 = 0.0;
|
||||
}
|
||||
this.setScreenBounds(d3, d4, d, d2);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private class CloseCommand
|
||||
extends Command {
|
||||
public CloseCommand() {
|
||||
super((BWidget)BEditorWindow.this, TYPE.getModule(), "EditorWindow.command.close");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
BEditorWindow.this.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,391 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.file.BTreeView
|
||||
* com.tridium.ui.file.FileChooserModel
|
||||
* com.tridium.ui.file.FileChooserModel$Support
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.IFileFilter
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BConstrainedPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.ui.pane.BScrollPane
|
||||
* javax.baja.ui.pane.BSplitPane
|
||||
* javax.baja.ui.text.TextModel
|
||||
* javax.baja.ui.tree.TreeController
|
||||
* javax.baja.ui.tree.TreeNode
|
||||
* javax.baja.ui.wizard.BWizardHeader
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandDialog;
|
||||
import com.tridium.platform.ui.util.BFileChooserListView;
|
||||
import com.tridium.platform.ui.util.CommandUtil;
|
||||
import com.tridium.platform.ui.util.IFilePathFilter;
|
||||
import com.tridium.ui.file.BTreeView;
|
||||
import com.tridium.ui.file.FileChooserModel;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.IFileFilter;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BIcon;
|
||||
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.BLabel;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BConstrainedPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.ui.pane.BScrollPane;
|
||||
import javax.baja.ui.pane.BSplitPane;
|
||||
import javax.baja.ui.text.TextModel;
|
||||
import javax.baja.ui.tree.TreeController;
|
||||
import javax.baja.ui.tree.TreeNode;
|
||||
import javax.baja.ui.wizard.BWizardHeader;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BFileChooserDialog
|
||||
extends BEdgePane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BFileChooserDialog == null ? (class$com$tridium$platform$ui$util$BFileChooserDialog = BFileChooserDialog.class$("com.tridium.platform.ui.util.BFileChooserDialog")) : class$com$tridium$platform$ui$util$BFileChooserDialog));
|
||||
private BCommandDialog dialog = null;
|
||||
private FileChooserModel model;
|
||||
private BFileChooserListView listView;
|
||||
private BTreeView treeView;
|
||||
private IFilePathFilter selectionPathFilter;
|
||||
private IFileFilter selectionFileFilter;
|
||||
private BLabel currentDirectoryLabel;
|
||||
private BTextField fileNameTextField;
|
||||
private static Lexicon lex = null;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BFileChooserDialog;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private BFileChooserDialog(BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2, IFilePathFilter iFilePathFilter, BFileChooserListView.ListModel listModel, boolean bl, boolean bl2, String string3) {
|
||||
this.model = bIFile == null ? new FileChooserModel((BSpace)BFileSystem.INSTANCE) : new FileChooserModel((BSpace)bIFile.getFileSpace());
|
||||
this.model.setFilter(iFileFilter);
|
||||
this.model.setSupport((FileChooserModel.Support)new FileBrowserSupport());
|
||||
this.listView = new BFileChooserListView(this.model);
|
||||
if (listModel == null) {
|
||||
this.listView.setDetailsView();
|
||||
} else {
|
||||
this.listView.setView(listModel, true);
|
||||
}
|
||||
this.listView.setMultipleSelection(bl);
|
||||
this.treeView = new BTreeView(this.model);
|
||||
this.treeView.setController((TreeController)new Controller());
|
||||
this.selectionPathFilter = iFilePathFilter == null ? new IFilePathFilter(){
|
||||
|
||||
public boolean accept(FilePath filePath) {
|
||||
return true;
|
||||
}
|
||||
} : iFilePathFilter;
|
||||
this.selectionFileFilter = iFileFilter2 == null ? new IFileFilter(){
|
||||
|
||||
public boolean accept(BIFile bIFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription(Context context) {
|
||||
return "";
|
||||
}
|
||||
} : iFileFilter2;
|
||||
BSplitPane bSplitPane = new BSplitPane();
|
||||
bSplitPane.setDividerPosition(33.0);
|
||||
bSplitPane.setWidget1((BWidget)new BBorderPane((BWidget)new BScrollPane((BWidget)this.treeView), BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
BFlowPane bFlowPane = new BFlowPane(BHalign.left);
|
||||
this.currentDirectoryLabel = new BLabel();
|
||||
bFlowPane.add(null, (BValue)this.currentDirectoryLabel);
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add(null, (BValue)new BSeparator());
|
||||
bToolBar.add(null, (Command)new HomeCommand());
|
||||
bToolBar.add(null, (Command)new UpLevelCommand());
|
||||
bFlowPane.add(null, (BValue)bToolBar);
|
||||
BEdgePane bEdgePane = null;
|
||||
this.fileNameTextField = new BTextField("", 32);
|
||||
this.fileNameTextField.setModel(new TextModel(){
|
||||
|
||||
protected void textModified() {
|
||||
BFileChooserDialog.this.checkDialogButtonState();
|
||||
}
|
||||
});
|
||||
if (bl2) {
|
||||
bEdgePane = new BEdgePane(null, null, (BWidget)new BBorderPane((BWidget)new BLabel(this.getLexicon().getText("FileChooserDialog.fileName")), BInsets.make((double)4.0, (double)4.0, (double)0.0, (double)0.0)), null, (BWidget)new BBorderPane((BWidget)this.fileNameTextField, BInsets.make((double)4.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
}
|
||||
bSplitPane.setWidget2((BWidget)new BEdgePane((BWidget)bFlowPane, bEdgePane, null, null, (BWidget)new BBorderPane((BWidget)this.listView, BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0))));
|
||||
this.setTop((BWidget)new BWizardHeader(bImage, string, string2 == null ? "" : string2));
|
||||
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)new BBorderPane((BWidget)bSplitPane, 6.0, 4.0, 4.0, 4.0));
|
||||
bConstrainedPane.setFixedSize(550.0, 330.0);
|
||||
this.setCenter((BWidget)bConstrainedPane);
|
||||
if (bIFile != null && bIFile.isDirectory()) {
|
||||
this.model.setDirectory((BINavNode)bIFile);
|
||||
this.treeView.scrollToVisible((BINavNode)bIFile);
|
||||
this.currentDirectoryLabel.setImage(BImage.make((BIcon)bIFile.getNavIcon()));
|
||||
this.currentDirectoryLabel.setText(bIFile.getNavDisplayName(null));
|
||||
}
|
||||
if (string3 != null) {
|
||||
this.fileNameTextField.setText(string3);
|
||||
}
|
||||
}
|
||||
|
||||
public static BIFile[] chooseFiles(BWidget bWidget, BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2) {
|
||||
return BFileChooserDialog.chooseFiles(bWidget, bImage, string, string2, bIFile, iFileFilter, iFileFilter2, null);
|
||||
}
|
||||
|
||||
public static BIFile[] chooseFiles(BWidget bWidget, BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2, BFileChooserListView.ListModel listModel) {
|
||||
BFileChooserDialog bFileChooserDialog = new BFileChooserDialog(bImage, string, string2, bIFile, iFileFilter, iFileFilter2, null, listModel, true, false, null);
|
||||
if (1 == BCommandDialog.open(bWidget, string, (Object)bFileChooserDialog, 3)) {
|
||||
return bFileChooserDialog.getSelectedFiles();
|
||||
}
|
||||
return new BIFile[0];
|
||||
}
|
||||
|
||||
public static BIFile chooseFile(BWidget bWidget, BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2) {
|
||||
return BFileChooserDialog.chooseFile(bWidget, bImage, string, string2, bIFile, iFileFilter, iFileFilter2, null);
|
||||
}
|
||||
|
||||
public static BIFile chooseFile(BWidget bWidget, BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2, BFileChooserListView.ListModel listModel) {
|
||||
BFileChooserDialog bFileChooserDialog = new BFileChooserDialog(bImage, string, string2, bIFile, iFileFilter, iFileFilter2, null, listModel, false, false, null);
|
||||
if (1 == BCommandDialog.open(bWidget, string, (Object)bFileChooserDialog, 3)) {
|
||||
return bFileChooserDialog.getSelectedFile();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FilePath chooseFilePath(BWidget bWidget, BImage bImage, String string, String string2, BIFile bIFile, IFileFilter iFileFilter, IFilePathFilter iFilePathFilter, BFileChooserListView.ListModel listModel, String string3) {
|
||||
BFileChooserDialog bFileChooserDialog = new BFileChooserDialog(bImage, string, string2, bIFile, iFileFilter, null, iFilePathFilter, listModel, false, true, string3);
|
||||
if (1 == BCommandDialog.open(bWidget, string, (Object)bFileChooserDialog, 3)) {
|
||||
return bFileChooserDialog.getSelectedFilePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BIFile[] chooseFiles(BWidget bWidget, String string) {
|
||||
return BFileChooserDialog.chooseFiles(bWidget, BImage.make((String)BFileChooserDialog.lex().getText("FileChooserDialog.file.icon")), BFileChooserDialog.lex().getText("FileChooserDialog.files.title"), string, null, IFileFilter.all, new IFileFilter(){
|
||||
|
||||
public boolean accept(BIFile bIFile) {
|
||||
return !(bIFile instanceof BIDirectory);
|
||||
}
|
||||
|
||||
public String getDescription(Context context) {
|
||||
return "TODO";
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
public static BIFile chooseFile(BWidget bWidget, String string) {
|
||||
return BFileChooserDialog.chooseFile(bWidget, BImage.make((String)BFileChooserDialog.lex().getText("FileChooserDialog.file.icon")), BFileChooserDialog.lex().getText("FileChooserDialog.file.title"), string, null, IFileFilter.all, new IFileFilter(){
|
||||
|
||||
public boolean accept(BIFile bIFile) {
|
||||
return !(bIFile instanceof BIDirectory);
|
||||
}
|
||||
|
||||
public String getDescription(Context context) {
|
||||
return "TODO";
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
public static FilePath chooseFilePath(BWidget bWidget, String string) {
|
||||
return BFileChooserDialog.chooseFilePath(bWidget, BImage.make((String)BFileChooserDialog.lex().getText("FileChooserDialog.file.icon")), BFileChooserDialog.lex().getText("FileChooserDialog.file.title"), string, null, IFileFilter.all, null, null, null);
|
||||
}
|
||||
|
||||
public static BIFile[] chooseDirectories(BWidget bWidget, String string) {
|
||||
return BFileChooserDialog.chooseFiles(bWidget, BImage.make((String)BFileChooserDialog.lex().getText("FileChooserDialog.dir.icon")), BFileChooserDialog.lex().getText("FileChooserDialog.dirs.title"), string, null, IFileFilter.directory, null, null);
|
||||
}
|
||||
|
||||
public static BIFile chooseDirectory(BWidget bWidget, String string) {
|
||||
return BFileChooserDialog.chooseFile(bWidget, BImage.make((String)BFileChooserDialog.lex().getText("FileChooserDialog.dir.icon")), BFileChooserDialog.lex().getText("FileChooserDialog.dir.title"), string, null, IFileFilter.directory, null, null);
|
||||
}
|
||||
|
||||
public void setDialog(BCommandDialog bCommandDialog) {
|
||||
this.dialog = bCommandDialog;
|
||||
this.checkDialogButtonState();
|
||||
}
|
||||
|
||||
public BCommandDialog getDialog() {
|
||||
if (this.dialog == null) {
|
||||
for (BComplex bComplex = this.getParent(); bComplex != null; bComplex = bComplex.getParent()) {
|
||||
if (!(bComplex instanceof BCommandDialog)) continue;
|
||||
this.dialog = (BCommandDialog)bComplex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this.dialog;
|
||||
}
|
||||
|
||||
public BIFile[] getSelectedFiles() {
|
||||
return this.model.getSelectedFiles();
|
||||
}
|
||||
|
||||
public FilePath getSelectedFilePath() {
|
||||
return ((BIFile)this.model.getDirectory()).getFilePath().merge(this.fileNameTextField.getText());
|
||||
}
|
||||
|
||||
public BIFile getSelectedFile() {
|
||||
BIFile[] bIFileArray = this.getSelectedFiles();
|
||||
return bIFileArray.length == 0 ? null : bIFileArray[0];
|
||||
}
|
||||
|
||||
public void started() {
|
||||
this.checkDialogButtonState();
|
||||
}
|
||||
|
||||
protected void checkDialogButtonState() {
|
||||
Command command;
|
||||
if (this.getDialog() != null && (command = this.getDialog().getButtonCommand(1)) != null) {
|
||||
command.setEnabled(this.fileNameTextField.getText().trim().length() > 0 && this.model.getDirectory() != null && this.model.getDirectory() instanceof BDirectory && this.selectionPathFilter.accept(((BDirectory)this.model.getDirectory()).getFilePath().merge(this.fileNameTextField.getText().trim())));
|
||||
}
|
||||
}
|
||||
|
||||
private static Lexicon lex() {
|
||||
if (lex == null) {
|
||||
lex = TYPE.getModule().getLexicon();
|
||||
}
|
||||
return lex;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class Controller
|
||||
extends TreeController {
|
||||
Controller() {
|
||||
}
|
||||
|
||||
protected void mouseSelection(TreeNode treeNode, BMouseEvent bMouseEvent) {
|
||||
super.mouseSelection(treeNode, bMouseEvent);
|
||||
BFileChooserDialog.this.listView.getSelection().deselectAll();
|
||||
}
|
||||
|
||||
protected void doSelectAction(TreeNode treeNode, double d, double d2) {
|
||||
BINavNode bINavNode = BFileChooserDialog.this.treeView.getFileForNode(treeNode);
|
||||
if (bINavNode != null) {
|
||||
BFileChooserDialog.this.model.setDirectory(bINavNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class HomeCommand
|
||||
extends Command {
|
||||
public HomeCommand() {
|
||||
super((BWidget)BFileChooserDialog.this, TYPE.getModule(), "FileChooserDialog.home");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BDirectory bDirectory = BFileSystem.INSTANCE.getSysHome();
|
||||
BFileChooserDialog.this.model.setDirectory((BINavNode)bDirectory);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
CommandUtil.error(this, throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class UpLevelCommand
|
||||
extends Command {
|
||||
public UpLevelCommand() {
|
||||
super((BWidget)BFileChooserDialog.this, TYPE.getModule(), "FileChooserDialog.upLevel");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BFileChooserDialog.this.model.moveUpDirectory();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
CommandUtil.error(this, throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class FileBrowserSupport
|
||||
extends FileChooserModel.Support {
|
||||
FileBrowserSupport() {
|
||||
}
|
||||
|
||||
public void pathModified() {
|
||||
BFileChooserDialog.this.listView.populateChildren();
|
||||
BFileChooserDialog.this.listView.relayout();
|
||||
BIFile bIFile = (BIFile)BFileChooserDialog.this.model.getDirectory();
|
||||
if (bIFile != null) {
|
||||
BFileChooserDialog.this.treeView.scrollToVisible((BINavNode)bIFile);
|
||||
BFileChooserDialog.this.currentDirectoryLabel.setImage(BImage.make((BIcon)bIFile.getNavIcon()));
|
||||
BFileChooserDialog.this.currentDirectoryLabel.setText(bIFile.getNavDisplayName(null));
|
||||
BFileChooserDialog.this.currentDirectoryLabel.relayout();
|
||||
}
|
||||
BFileChooserDialog.this.checkDialogButtonState();
|
||||
}
|
||||
|
||||
public void selectionModified() {
|
||||
BIFile[] bIFileArray = BFileChooserDialog.this.model.getSelectedFiles();
|
||||
if (bIFileArray.length == 0) {
|
||||
return;
|
||||
}
|
||||
BFileChooserDialog.this.treeView.getSelection().deselectAll();
|
||||
for (int i = 0; i < bIFileArray.length; ++i) {
|
||||
if (BFileChooserDialog.this.selectionPathFilter.accept(bIFileArray[i].getFilePath()) && BFileChooserDialog.this.selectionFileFilter.accept(bIFileArray[i])) continue;
|
||||
return;
|
||||
}
|
||||
BFileChooserDialog.this.fileNameTextField.setText(bIFileArray[0].getFileName());
|
||||
}
|
||||
|
||||
public void chooseSelectedFiles() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.sys.module.BModuleNavNode
|
||||
* com.tridium.sys.registry.NModuleInfo
|
||||
* com.tridium.ui.file.FileChooserModel
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSpace
|
||||
* javax.baja.file.BIDirectory
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nav.BNavContainer
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* 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.util.UiLexicon
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.sys.module.BModuleNavNode;
|
||||
import com.tridium.sys.registry.NModuleInfo;
|
||||
import com.tridium.ui.file.FileChooserModel;
|
||||
import java.util.ArrayList;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSpace;
|
||||
import javax.baja.file.BIDirectory;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nav.BNavContainer;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
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.util.UiLexicon;
|
||||
|
||||
public class BFileChooserListView
|
||||
extends BTable {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BFileChooserListView == null ? (class$com$tridium$platform$ui$util$BFileChooserListView = BFileChooserListView.class$("com.tridium.platform.ui.util.BFileChooserListView")) : class$com$tridium$platform$ui$util$BFileChooserListView));
|
||||
protected FileChooserModel fileModel;
|
||||
protected ListModel model;
|
||||
protected boolean showDirs;
|
||||
protected boolean showFiles;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BFileChooserListView;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BFileChooserListView() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public BFileChooserListView(FileChooserModel fileChooserModel) {
|
||||
this.model = new ListModel();
|
||||
this.fileModel = fileChooserModel;
|
||||
this.setShowDirectories(true);
|
||||
this.setShowFiles(true);
|
||||
this.populateChildren();
|
||||
this.setModel(this.model);
|
||||
this.setController(new Controller());
|
||||
this.setSelection(new Selection());
|
||||
this.setHeaderVisible(false);
|
||||
this.setHgridVisible(false);
|
||||
this.setVgridVisible(false);
|
||||
}
|
||||
|
||||
public boolean getShowDirectories() {
|
||||
return this.showDirs;
|
||||
}
|
||||
|
||||
public void setShowDirectories(boolean bl) {
|
||||
this.showDirs = bl;
|
||||
}
|
||||
|
||||
public boolean getShowFiles() {
|
||||
return this.showFiles;
|
||||
}
|
||||
|
||||
public void setShowFiles(boolean bl) {
|
||||
this.showFiles = bl;
|
||||
}
|
||||
|
||||
public void populateChildren() {
|
||||
BINavNode[] bINavNodeArray = this.fileModel.getChildren();
|
||||
this.model.kids = this.sort(this.filter(bINavNodeArray));
|
||||
}
|
||||
|
||||
private BINavNode[] filter(BINavNode[] bINavNodeArray) {
|
||||
if (!(this.fileModel.getSpace() instanceof BFileSpace)) {
|
||||
return bINavNodeArray;
|
||||
}
|
||||
ArrayList<BIFile> arrayList = new ArrayList<BIFile>();
|
||||
for (int i = 0; i < bINavNodeArray.length; ++i) {
|
||||
BIFile bIFile = (BIFile)bINavNodeArray[i];
|
||||
if ((!this.showDirs || !(bIFile instanceof BIDirectory)) && (!this.showFiles || bIFile instanceof BIDirectory)) continue;
|
||||
arrayList.add(bIFile);
|
||||
}
|
||||
BIFile[] bIFileArray = new BIFile[arrayList.size()];
|
||||
return (BINavNode[])arrayList.toArray(bIFileArray);
|
||||
}
|
||||
|
||||
private BINavNode[] sort(BINavNode[] bINavNodeArray) {
|
||||
if (!this.showDirs || !this.showFiles) {
|
||||
return bINavNodeArray;
|
||||
}
|
||||
for (int i = 1; i < bINavNodeArray.length; ++i) {
|
||||
if (!(bINavNodeArray[i] instanceof BIDirectory)) continue;
|
||||
for (int j = i; j > 0 && !(bINavNodeArray[j - 1] instanceof BIDirectory); --j) {
|
||||
BINavNode bINavNode = bINavNodeArray[j - 1];
|
||||
bINavNodeArray[j - 1] = bINavNodeArray[j];
|
||||
bINavNodeArray[j] = bINavNode;
|
||||
}
|
||||
}
|
||||
return bINavNodeArray;
|
||||
}
|
||||
|
||||
public void select(BIFile bIFile) {
|
||||
for (int i = 0; i < this.model.kids.length; ++i) {
|
||||
if (!bIFile.getNavName().equals(this.model.kids[i].getNavName())) continue;
|
||||
if (this.getSelection().isSelected(i)) break;
|
||||
this.getSelection().select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setListView() {
|
||||
this.model = new ListModel();
|
||||
this.setModel(this.model);
|
||||
this.setHeaderVisible(false);
|
||||
this.populateChildren();
|
||||
}
|
||||
|
||||
public void setDetailsView() {
|
||||
this.model = new DetailsModel();
|
||||
this.setModel(this.model);
|
||||
this.setHeaderVisible(true);
|
||||
this.populateChildren();
|
||||
}
|
||||
|
||||
public void setView(ListModel listModel, boolean bl) {
|
||||
this.model = listModel;
|
||||
this.setModel(this.model);
|
||||
this.setHeaderVisible(bl);
|
||||
this.populateChildren();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class DetailsModel
|
||||
extends ListModel {
|
||||
public int getColumnCount() {
|
||||
if (this.kids.length == 0 || this.kids[0] instanceof BIFile) {
|
||||
return 3;
|
||||
}
|
||||
if (this.kids[0] instanceof BModuleNavNode) {
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
if (this.kids.length == 0 || this.kids[0] instanceof BIFile) {
|
||||
switch (n) {
|
||||
case 0: {
|
||||
return UiLexicon.bajaui.getText("fileChooser.name");
|
||||
}
|
||||
case 1: {
|
||||
return UiLexicon.bajaui.getText("fileChooser.size");
|
||||
}
|
||||
case 2: {
|
||||
return UiLexicon.bajaui.getText("fileChooser.lastModified");
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
if (this.kids[0] instanceof BModuleNavNode) {
|
||||
switch (n) {
|
||||
case 0: {
|
||||
return "Name";
|
||||
}
|
||||
case 1: {
|
||||
return "Vendor";
|
||||
}
|
||||
case 2: {
|
||||
return "Version";
|
||||
}
|
||||
case 3: {
|
||||
return "Description";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
return UiLexicon.bajaui.getText("fileChooser.name");
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
if (this.kids[n] instanceof BIFile) {
|
||||
return this.getFileDetail(n, n2);
|
||||
}
|
||||
if (this.kids[n] instanceof BModuleNavNode) {
|
||||
return this.getModuleDetail(n, n2);
|
||||
}
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
|
||||
private Object getFileDetail(int n, int n2) {
|
||||
BIFile bIFile = (BIFile)this.kids[n];
|
||||
switch (n2) {
|
||||
case 0: {
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
case 1: {
|
||||
if (bIFile instanceof BIDirectory) {
|
||||
return "";
|
||||
}
|
||||
long l = bIFile.getSize();
|
||||
String string = l < 1024L ? "1 KB" : String.valueOf(l / 1024L) + " KB";
|
||||
return string;
|
||||
}
|
||||
case 2: {
|
||||
if (bIFile instanceof BDirectory || bIFile.getLastModified().getMillis() == 0L) {
|
||||
return "";
|
||||
}
|
||||
return String.valueOf(bIFile.getLastModified());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object getModuleDetail(int n, int n2) {
|
||||
BModuleNavNode bModuleNavNode = (BModuleNavNode)this.kids[n];
|
||||
NModuleInfo nModuleInfo = bModuleNavNode.info;
|
||||
switch (n2) {
|
||||
case 0: {
|
||||
return super.getValueAt(n, n2);
|
||||
}
|
||||
case 1: {
|
||||
return nModuleInfo.getVendor();
|
||||
}
|
||||
case 2: {
|
||||
return nModuleInfo.getVendorVersion();
|
||||
}
|
||||
case 3: {
|
||||
return nModuleInfo.getDescription();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListModel
|
||||
extends TableModel {
|
||||
protected BINavNode[] kids;
|
||||
|
||||
public int getRowCount() {
|
||||
return this.kids.length;
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public String getColumnName(int n) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public Object getValueAt(int n, int n2) {
|
||||
return this.kids[n].getNavDisplayName(null);
|
||||
}
|
||||
|
||||
public BImage getRowIcon(int n) {
|
||||
return BImage.make((BIcon)this.kids[n].getNavIcon());
|
||||
}
|
||||
|
||||
public BINavNode get(int n) {
|
||||
return this.kids[n];
|
||||
}
|
||||
}
|
||||
|
||||
public class Selection
|
||||
extends TableSelection {
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, bl);
|
||||
if (bl) {
|
||||
BFileChooserListView.this.fileModel.deselectAll();
|
||||
}
|
||||
if (n < BFileChooserListView.this.model.getRowCount()) {
|
||||
this.handleSelect(n);
|
||||
}
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
int n3;
|
||||
int n4;
|
||||
int n5;
|
||||
super.select(n, n2, bl);
|
||||
if (bl) {
|
||||
BFileChooserListView.this.fileModel.deselectAll();
|
||||
}
|
||||
if ((n5 = n2) < (n4 = n)) {
|
||||
n3 = n4;
|
||||
n4 = n5;
|
||||
n5 = n3;
|
||||
}
|
||||
for (n3 = n4; n3 <= n5; ++n3) {
|
||||
this.handleSelect(n3);
|
||||
}
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray);
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
this.handleSelect(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void deselect(int n) {
|
||||
super.deselect(n);
|
||||
BINavNode bINavNode = BFileChooserListView.this.model.get(n);
|
||||
if (bINavNode instanceof BIFile) {
|
||||
BFileChooserListView.this.fileModel.deselect((BIFile)bINavNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void deselectAll() {
|
||||
super.deselectAll();
|
||||
BFileChooserListView.this.fileModel.deselectAll();
|
||||
}
|
||||
|
||||
private void handleSelect(int n) {
|
||||
BINavNode bINavNode = BFileChooserListView.this.model.get(n);
|
||||
if (bINavNode instanceof BIFile) {
|
||||
BFileChooserListView.this.fileModel.select((BIFile)bINavNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Controller
|
||||
extends TableController {
|
||||
public void handleEnter(BKeyEvent bKeyEvent) {
|
||||
int n = this.getTable().getSelection().getRow();
|
||||
if (n >= 0) {
|
||||
this.handleSelection(BFileChooserListView.this.model.kids[n]);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cellDoubleClicked(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
this.handleSelection(BFileChooserListView.this.model.kids[n]);
|
||||
}
|
||||
|
||||
void handleSelection(BINavNode bINavNode) {
|
||||
if (bINavNode instanceof BIDirectory || bINavNode instanceof BNavContainer) {
|
||||
BFileChooserListView.this.fileModel.setDirectory(bINavNode);
|
||||
} else {
|
||||
BFileChooserListView.this.fileModel.chooseSelectedFiles();
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(BKeyEvent bKeyEvent) {
|
||||
super.keyPressed(bKeyEvent);
|
||||
if (bKeyEvent.getKeyCode() == 38 && bKeyEvent.isAltDown()) {
|
||||
BFileChooserListView.this.fileModel.moveUpDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
public int getTextSearchColumn() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.file.BTreeView
|
||||
* com.tridium.ui.file.FileChooserModel
|
||||
* com.tridium.ui.file.FileChooserModel$Support
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.BIFile
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.IFileFilter
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.nav.BINavNode
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.space.BSpace
|
||||
* javax.baja.sys.BIcon
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BBorder
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BSeparator
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.BToolBar
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.pane.BBorderPane
|
||||
* javax.baja.ui.pane.BConstrainedPane
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
* javax.baja.ui.pane.BFlowPane
|
||||
* javax.baja.ui.pane.BScrollPane
|
||||
* javax.baja.ui.pane.BSplitPane
|
||||
* javax.baja.ui.text.TextModel
|
||||
* javax.baja.ui.tree.TreeController
|
||||
* javax.baja.ui.tree.TreeNode
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BFileChooserListView;
|
||||
import com.tridium.platform.ui.util.CommandUtil;
|
||||
import com.tridium.platform.ui.util.IFilePathFilter;
|
||||
import com.tridium.ui.file.BTreeView;
|
||||
import com.tridium.ui.file.FileChooserModel;
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.BIFile;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.IFileFilter;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.space.BSpace;
|
||||
import javax.baja.sys.BIcon;
|
||||
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.BLabel;
|
||||
import javax.baja.ui.BSeparator;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.BToolBar;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
import javax.baja.ui.pane.BBorderPane;
|
||||
import javax.baja.ui.pane.BConstrainedPane;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
import javax.baja.ui.pane.BFlowPane;
|
||||
import javax.baja.ui.pane.BScrollPane;
|
||||
import javax.baja.ui.pane.BSplitPane;
|
||||
import javax.baja.ui.text.TextModel;
|
||||
import javax.baja.ui.tree.TreeController;
|
||||
import javax.baja.ui.tree.TreeNode;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class BFileChooserPane
|
||||
extends BEdgePane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BFileChooserPane == null ? (class$com$tridium$platform$ui$util$BFileChooserPane = BFileChooserPane.class$("com.tridium.platform.ui.util.BFileChooserPane")) : class$com$tridium$platform$ui$util$BFileChooserPane));
|
||||
private FileChooserModel model;
|
||||
private BFileChooserListView listView;
|
||||
private BTreeView treeView;
|
||||
private IFilePathFilter selectionPathFilter;
|
||||
private IFileFilter selectionFileFilter;
|
||||
private BLabel currentDirectoryLabel;
|
||||
private BTextField fileNameTextField;
|
||||
private Array listeners = new Array(class$com$tridium$platform$ui$util$BFileChooserPane$Listener == null ? (class$com$tridium$platform$ui$util$BFileChooserPane$Listener = BFileChooserPane.class$("com.tridium.platform.ui.util.BFileChooserPane$Listener")) : class$com$tridium$platform$ui$util$BFileChooserPane$Listener);
|
||||
private static final Lexicon LEX = Lexicon.make((String)"platform");
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BFileChooserPane;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BFileChooserPane$Listener;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BFileChooserPane() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public BFileChooserPane(BIFile bIFile, IFileFilter iFileFilter, IFileFilter iFileFilter2, IFilePathFilter iFilePathFilter, BFileChooserListView.ListModel listModel, boolean bl, boolean bl2, String string) {
|
||||
this(bIFile, null, iFileFilter, iFileFilter2, iFilePathFilter, listModel, bl, bl2, string);
|
||||
}
|
||||
|
||||
public BFileChooserPane(BIFile bIFile, BIFile bIFile2, IFileFilter iFileFilter, IFileFilter iFileFilter2, IFilePathFilter iFilePathFilter, BFileChooserListView.ListModel listModel, boolean bl, boolean bl2, String string) {
|
||||
this.model = bIFile == null ? new FileChooserModel((BSpace)BFileSystem.INSTANCE) : new FileChooserModel((BSpace)bIFile.getFileSpace());
|
||||
if (bIFile2 != null) {
|
||||
this.model.select(bIFile2);
|
||||
}
|
||||
this.model.setFilter(iFileFilter);
|
||||
this.model.setSupport((FileChooserModel.Support)new FileBrowserSupport());
|
||||
this.listView = new BFileChooserListView(this.model);
|
||||
if (listModel == null) {
|
||||
this.listView.setDetailsView();
|
||||
} else {
|
||||
this.listView.setView(listModel, true);
|
||||
}
|
||||
this.listView.setMultipleSelection(bl);
|
||||
this.treeView = new BTreeView(this.model);
|
||||
this.treeView.setController((TreeController)new Controller());
|
||||
this.selectionPathFilter = iFilePathFilter == null ? new IFilePathFilter(){
|
||||
|
||||
public boolean accept(FilePath filePath) {
|
||||
return true;
|
||||
}
|
||||
} : iFilePathFilter;
|
||||
this.selectionFileFilter = iFileFilter2 == null ? new IFileFilter(){
|
||||
|
||||
public boolean accept(BIFile bIFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription(Context context) {
|
||||
return "";
|
||||
}
|
||||
} : iFileFilter2;
|
||||
BSplitPane bSplitPane = new BSplitPane();
|
||||
bSplitPane.setDividerPosition(33.0);
|
||||
bSplitPane.setWidget1((BWidget)new BBorderPane((BWidget)new BScrollPane((BWidget)this.treeView), BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
BFlowPane bFlowPane = new BFlowPane(BHalign.left);
|
||||
this.currentDirectoryLabel = new BLabel();
|
||||
bFlowPane.add(null, (BValue)this.currentDirectoryLabel);
|
||||
BToolBar bToolBar = new BToolBar();
|
||||
bToolBar.add(null, (BValue)new BSeparator());
|
||||
bToolBar.add(null, (Command)new HomeCommand());
|
||||
bToolBar.add(null, (Command)new UpLevelCommand());
|
||||
bFlowPane.add(null, (BValue)bToolBar);
|
||||
BEdgePane bEdgePane = null;
|
||||
this.fileNameTextField = new BTextField("", 32);
|
||||
this.fileNameTextField.setModel(new TextModel(){
|
||||
|
||||
protected void textModified() {
|
||||
BFileChooserPane.this.notifyFileSelected();
|
||||
}
|
||||
});
|
||||
if (bl2) {
|
||||
bEdgePane = new BEdgePane(null, null, (BWidget)new BBorderPane((BWidget)new BLabel(LEX.getText("FileChooserPane.fileName")), BInsets.make((double)4.0, (double)4.0, (double)0.0, (double)0.0)), null, (BWidget)new BBorderPane((BWidget)this.fileNameTextField, BInsets.make((double)4.0, (double)0.0, (double)0.0, (double)0.0)));
|
||||
}
|
||||
bSplitPane.setWidget2((BWidget)new BEdgePane((BWidget)bFlowPane, bEdgePane, null, null, (BWidget)new BBorderPane((BWidget)this.listView, BBorder.inset, BInsets.make((double)0.0, (double)0.0, (double)0.0, (double)0.0))));
|
||||
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)new BBorderPane((BWidget)bSplitPane, 6.0, 4.0, 4.0, 4.0));
|
||||
bConstrainedPane.setFixedSize(550.0, 330.0);
|
||||
this.setCenter((BWidget)bConstrainedPane);
|
||||
if (bIFile != null && bIFile.isDirectory()) {
|
||||
this.model.setDirectory((BINavNode)bIFile);
|
||||
this.treeView.scrollToVisible((BINavNode)bIFile);
|
||||
this.currentDirectoryLabel.setImage(BImage.make((BIcon)bIFile.getNavIcon()));
|
||||
this.currentDirectoryLabel.setText(bIFile.getNavDisplayName(null));
|
||||
}
|
||||
if (string != null) {
|
||||
this.fileNameTextField.setText(string);
|
||||
}
|
||||
}
|
||||
|
||||
public BIFile[] getSelectedFiles() {
|
||||
return this.model.getSelectedFiles();
|
||||
}
|
||||
|
||||
public FilePath getSelectedFilePath() {
|
||||
return ((BIFile)this.model.getDirectory()).getFilePath().merge(this.fileNameTextField.getText());
|
||||
}
|
||||
|
||||
public BIFile getSelectedFile() {
|
||||
BIFile[] bIFileArray = this.getSelectedFiles();
|
||||
return bIFileArray.length == 0 ? null : bIFileArray[0];
|
||||
}
|
||||
|
||||
public BDirectory getDirectory() {
|
||||
BINavNode bINavNode = this.model.getDirectory();
|
||||
return bINavNode instanceof BDirectory ? (BDirectory)bINavNode : null;
|
||||
}
|
||||
|
||||
public void started() {
|
||||
this.notifyFileSelected();
|
||||
}
|
||||
|
||||
public void addListener(Listener listener) {
|
||||
this.listeners.add((Object)listener);
|
||||
}
|
||||
|
||||
public void removeListener(Listener listener) {
|
||||
this.listeners.remove((Object)listener);
|
||||
}
|
||||
|
||||
public void notifyFileSelected() {
|
||||
boolean bl = this.fileNameTextField.getText().trim().length() > 0 && this.model.getDirectory() != null && this.model.getDirectory() instanceof BDirectory && this.selectionPathFilter.accept(((BDirectory)this.model.getDirectory()).getFilePath().merge(this.fileNameTextField.getText().trim()));
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
((Listener)this.listeners.get(i)).fileSelected(bl);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class Controller
|
||||
extends TreeController {
|
||||
protected void mouseSelection(TreeNode treeNode, BMouseEvent bMouseEvent) {
|
||||
super.mouseSelection(treeNode, bMouseEvent);
|
||||
BFileChooserPane.this.listView.getSelection().deselectAll();
|
||||
}
|
||||
|
||||
protected void doSelectAction(TreeNode treeNode, double d, double d2) {
|
||||
BINavNode bINavNode = BFileChooserPane.this.treeView.getFileForNode(treeNode);
|
||||
if (bINavNode != null) {
|
||||
BFileChooserPane.this.model.setDirectory(bINavNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HomeCommand
|
||||
extends Command {
|
||||
public HomeCommand() {
|
||||
super((BWidget)BFileChooserPane.this, TYPE.getModule(), "FileChooserPane.home");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BDirectory bDirectory = BFileSystem.INSTANCE.getSysHome();
|
||||
BFileChooserPane.this.model.setDirectory((BINavNode)bDirectory);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
CommandUtil.error(this, throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class UpLevelCommand
|
||||
extends Command {
|
||||
public UpLevelCommand() {
|
||||
super((BWidget)BFileChooserPane.this, TYPE.getModule(), "FileChooserPane.upLevel");
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() {
|
||||
try {
|
||||
BFileChooserPane.this.model.moveUpDirectory();
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
CommandUtil.error(this, throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface Listener {
|
||||
public void fileSelected(boolean var1);
|
||||
}
|
||||
|
||||
class FileBrowserSupport
|
||||
extends FileChooserModel.Support {
|
||||
FileBrowserSupport() {
|
||||
}
|
||||
|
||||
public void pathModified() {
|
||||
BFileChooserPane.this.listView.populateChildren();
|
||||
BFileChooserPane.this.listView.relayout();
|
||||
BIFile bIFile = (BIFile)BFileChooserPane.this.model.getDirectory();
|
||||
if (bIFile != null) {
|
||||
BFileChooserPane.this.treeView.scrollToVisible((BINavNode)bIFile);
|
||||
BFileChooserPane.this.currentDirectoryLabel.setImage(BImage.make((BIcon)bIFile.getNavIcon()));
|
||||
BFileChooserPane.this.currentDirectoryLabel.setText(bIFile.getNavDisplayName(null));
|
||||
BFileChooserPane.this.currentDirectoryLabel.relayout();
|
||||
}
|
||||
BFileChooserPane.this.model.deselectAll();
|
||||
BFileChooserPane.this.listView.getSelection().deselectAll();
|
||||
BFileChooserPane.this.notifyFileSelected();
|
||||
}
|
||||
|
||||
public void selectionModified() {
|
||||
BIFile[] bIFileArray = BFileChooserPane.this.model.getSelectedFiles();
|
||||
if (bIFileArray.length == 0) {
|
||||
BFileChooserPane.this.notifyFileSelected();
|
||||
return;
|
||||
}
|
||||
BFileChooserPane.this.treeView.getSelection().deselectAll();
|
||||
for (int i = 0; i < bIFileArray.length; ++i) {
|
||||
if (BFileChooserPane.this.selectionPathFilter.accept(bIFileArray[i].getFilePath()) && BFileChooserPane.this.selectionFileFilter.accept(bIFileArray[i])) continue;
|
||||
BFileChooserPane.this.notifyFileSelected();
|
||||
return;
|
||||
}
|
||||
BFileChooserPane.this.fileNameTextField.setText(bIFileArray[0].getFileName());
|
||||
BFileChooserPane.this.notifyFileSelected();
|
||||
}
|
||||
|
||||
public void chooseSelectedFiles() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.pane.BEdgePane
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.pane.BEdgePane;
|
||||
|
||||
public class BIBeamPane
|
||||
extends BEdgePane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BIBeamPane == null ? (class$com$tridium$platform$ui$util$BIBeamPane = BIBeamPane.class$("com.tridium.platform.ui.util.BIBeamPane")) : class$com$tridium$platform$ui$util$BIBeamPane));
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BIBeamPane;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void childCalledRelayout(BWidget bWidget) {
|
||||
if (bWidget == this.getLeft() || bWidget == this.getRight()) {
|
||||
return;
|
||||
}
|
||||
this.relayout();
|
||||
}
|
||||
|
||||
public void doLayout(BWidget[] bWidgetArray) {
|
||||
double d;
|
||||
double d2;
|
||||
double d3 = this.getWidth();
|
||||
double d4 = this.getHeight();
|
||||
double d5 = 0.0;
|
||||
double d6 = d4;
|
||||
double d7 = d2 = d3 / 2.0;
|
||||
BWidget bWidget = this.getTop();
|
||||
if (!bWidget.isNull() && bWidget.isVisible()) {
|
||||
bWidget.computePreferredSize();
|
||||
d = Math.min(d6 - d5, bWidget.getPreferredHeight());
|
||||
bWidget.setBounds(0.0, d5, d3, d);
|
||||
d5 += d;
|
||||
}
|
||||
if (!(bWidget = this.getBottom()).isNull() && bWidget.isVisible()) {
|
||||
bWidget.computePreferredSize();
|
||||
d = Math.min(d6 - d5, bWidget.getPreferredHeight());
|
||||
bWidget.setBounds(0.0, d6 - d, d3, d);
|
||||
d6 -= d;
|
||||
}
|
||||
if (!(bWidget = this.getCenter()).isNull() && bWidget.isVisible()) {
|
||||
bWidget.computePreferredSize();
|
||||
d = Math.min(d3, bWidget.getPreferredWidth());
|
||||
d7 += d / 2.0;
|
||||
bWidget.setBounds(d2 -= d / 2.0, d5, d, d6 - d5);
|
||||
}
|
||||
if (!(bWidget = this.getLeft()).isNull() && bWidget.isVisible()) {
|
||||
bWidget.setBounds(0.0, d5, d2, d6 - d5);
|
||||
}
|
||||
if (!(bWidget = this.getRight()).isNull() && bWidget.isVisible()) {
|
||||
bWidget.setBounds(d7, d5, d3 - d7, d6 - d5);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.enums.BValign
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BBox;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
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.BGridPane;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
public class BIndentPane
|
||||
extends BGridPane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BIndentPane == null ? (class$com$tridium$platform$ui$util$BIndentPane = BIndentPane.class$("com.tridium.platform.ui.util.BIndentPane")) : class$com$tridium$platform$ui$util$BIndentPane));
|
||||
private BIndentPane contentPane;
|
||||
private int indentWidth;
|
||||
public static int DEFAULT_WIDTH = 6;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BIndentPane;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BIndentPane() {
|
||||
this(DEFAULT_WIDTH);
|
||||
}
|
||||
|
||||
private BIndentPane(int n) {
|
||||
super(1);
|
||||
this.setValign(BValign.top);
|
||||
this.setHalign(BHalign.left);
|
||||
this.contentPane = this;
|
||||
this.indentWidth = n;
|
||||
}
|
||||
|
||||
public void setIndentWidth(int n) {
|
||||
this.indentWidth = n;
|
||||
if (this.contentPane != this) {
|
||||
this.contentPane.setIndentWidth(n);
|
||||
}
|
||||
}
|
||||
|
||||
public int getIndentWidth() {
|
||||
return this.indentWidth;
|
||||
}
|
||||
|
||||
public void indent(int n) {
|
||||
if (n < 0) {
|
||||
this.unindent(-1 * n);
|
||||
} else {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
this.indent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void indent() {
|
||||
if (this.contentPane == this) {
|
||||
BGridPane bGridPane = new BGridPane(2);
|
||||
bGridPane.setValign(BValign.top);
|
||||
bGridPane.setHalign(BHalign.left);
|
||||
bGridPane.add("box", (BValue)new BBox(this.indentWidth, 0.0));
|
||||
this.contentPane = new BIndentPane(this.getIndentWidth());
|
||||
bGridPane.add("content", (BValue)this.contentPane);
|
||||
super.add(null, (BValue)bGridPane);
|
||||
} else {
|
||||
this.contentPane.indent();
|
||||
}
|
||||
}
|
||||
|
||||
public void unindentAll() {
|
||||
this.contentPane = this;
|
||||
}
|
||||
|
||||
public void unindent(int n) {
|
||||
if (n < 0) {
|
||||
this.indent(-1 * n);
|
||||
} else {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
this.unindent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean unindent() {
|
||||
if (this.contentPane == this) {
|
||||
return false;
|
||||
}
|
||||
if (!this.contentPane.unindent()) {
|
||||
this.contentPane = this;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(BWidget bWidget) {
|
||||
if (this.contentPane == this) {
|
||||
super.add((String)null, (BValue)bWidget);
|
||||
} else {
|
||||
this.contentPane.add(bWidget);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(String string) {
|
||||
this.add((BWidget)new BLabel(string, BHalign.left));
|
||||
}
|
||||
|
||||
public void add(LexiconText lexiconText) {
|
||||
this.add((BWidget)new BLabel(lexiconText.getText(null), BHalign.left));
|
||||
}
|
||||
|
||||
public void add(LexiconText lexiconText, Context context) {
|
||||
this.add((BWidget)new BLabel(lexiconText.getText(context), BHalign.left));
|
||||
}
|
||||
|
||||
public void add(LexiconText lexiconText, Object[] objectArray) {
|
||||
this.add((BWidget)new BLabel(lexiconText.getText(null, objectArray), BHalign.left));
|
||||
}
|
||||
|
||||
public void add(LexiconText lexiconText, Object[] objectArray, Context context) {
|
||||
this.add((BWidget)new BLabel(lexiconText.getText(context, objectArray), BHalign.left));
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.removeAll();
|
||||
this.unindentAll();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidget
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandDialog;
|
||||
import com.tridium.platform.ui.util.DialogCommand;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidget;
|
||||
|
||||
public class BInitialFocusDialog
|
||||
extends BCommandDialog {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BInitialFocusDialog == null ? (class$com$tridium$platform$ui$util$BInitialFocusDialog = BInitialFocusDialog.class$("com.tridium.platform.ui.util.BInitialFocusDialog")) : class$com$tridium$platform$ui$util$BInitialFocusDialog));
|
||||
boolean hasSetInitialFocus = false;
|
||||
BWidget initialFocusWidget = null;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BInitialFocusDialog;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BInitialFocusDialog() {
|
||||
}
|
||||
|
||||
public BInitialFocusDialog(BWidget bWidget, String string, BWidget bWidget2, DialogCommand[] dialogCommandArray, BImage bImage) {
|
||||
super(bWidget, string, true, bWidget2, dialogCommandArray, bImage);
|
||||
}
|
||||
|
||||
public void setInitialFocusWidget(BWidget bWidget) {
|
||||
this.initialFocusWidget = bWidget;
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics) {
|
||||
if (this.initialFocusWidget != null && !this.hasSetInitialFocus) {
|
||||
this.initialFocusWidget.requestFocus();
|
||||
this.hasSetInitialFocus = true;
|
||||
}
|
||||
super.paint(graphics);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BWidgetShell
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BTextOutputPane;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BWidgetShell;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public abstract class BInputStreamPane
|
||||
extends BTextOutputPane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BInputStreamPane == null ? (class$com$tridium$platform$ui$util$BInputStreamPane = BInputStreamPane.class$("com.tridium.platform.ui.util.BInputStreamPane")) : class$com$tridium$platform$ui$util$BInputStreamPane));
|
||||
public static final int BUFFER_TIME_MAX = 3000;
|
||||
protected int bufferTime = 3000;
|
||||
protected OutputWatcher watcher = null;
|
||||
private static Lexicon lex = Lexicon.make((String)"platform");
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BInputStreamPane;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BInputStreamPane() {
|
||||
this(20, 80);
|
||||
}
|
||||
|
||||
public BInputStreamPane(int n, int n2) {
|
||||
super(n, n2);
|
||||
this.setUseAutoScroll(true);
|
||||
}
|
||||
|
||||
protected abstract InputStream getInputStream();
|
||||
|
||||
public synchronized void load() {
|
||||
InputStream inputStream = this.getInputStream();
|
||||
if (inputStream != null) {
|
||||
this.stopUpdates();
|
||||
this.startUpdates(new OutputWatcher(inputStream));
|
||||
}
|
||||
}
|
||||
|
||||
public void setBufferTime(int n) {
|
||||
this.bufferTime = n;
|
||||
}
|
||||
|
||||
public int getBufferTime() {
|
||||
return this.bufferTime;
|
||||
}
|
||||
|
||||
protected synchronized void startUpdates(OutputWatcher outputWatcher) {
|
||||
this.watcher = outputWatcher;
|
||||
this.watcher.start();
|
||||
}
|
||||
|
||||
public synchronized void stopUpdates() {
|
||||
if (this.watcher != null) {
|
||||
this.watcher.stopWatcher();
|
||||
this.watcher = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearValue() {
|
||||
this.stopUpdates();
|
||||
this.clear();
|
||||
}
|
||||
|
||||
public synchronized void clearText() throws Exception {
|
||||
if (this.watcher == null) {
|
||||
this.clear();
|
||||
} else {
|
||||
this.watcher.clearOutput();
|
||||
}
|
||||
}
|
||||
|
||||
public void deactivated() {
|
||||
this.stopUpdates();
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
super.stopped();
|
||||
this.stopUpdates();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class OutputWatcher
|
||||
extends Thread {
|
||||
private InputStream in;
|
||||
private boolean stopped = true;
|
||||
private boolean clearBuffer = false;
|
||||
private String clearSync = new String("sync");
|
||||
private BWidgetShell shell;
|
||||
|
||||
public OutputWatcher(InputStream inputStream) {
|
||||
super("InputStreamPane:OutputWatcher");
|
||||
this.in = inputStream;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void run() {
|
||||
long l;
|
||||
boolean bl = true;
|
||||
this.stopped = false;
|
||||
byte[] byArray = new byte[1024];
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n = 0;
|
||||
long l2 = l = Clock.ticks();
|
||||
BInputStreamPane.this.setText("");
|
||||
try {
|
||||
this.shell = BInputStreamPane.this.getShell();
|
||||
if (this.shell != null) {
|
||||
this.shell.enterBusy();
|
||||
}
|
||||
while (!this.stopped) {
|
||||
String string;
|
||||
block30: {
|
||||
string = this.clearSync;
|
||||
synchronized (string) {
|
||||
this.clearBuffer = false;
|
||||
}
|
||||
try {
|
||||
l2 = Clock.ticks();
|
||||
n = this.in.read(byArray, 0, 1024);
|
||||
if (!bl) break block30;
|
||||
if (this.shell != null) {
|
||||
this.shell.exitBusy();
|
||||
}
|
||||
bl = false;
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
if (bl) {
|
||||
if (this.shell != null) {
|
||||
this.shell.exitBusy();
|
||||
}
|
||||
bl = false;
|
||||
}
|
||||
throw new IOException();
|
||||
}
|
||||
catch (InterruptedIOException interruptedIOException) {
|
||||
if (stringBuffer.length() > 0) {
|
||||
BInputStreamPane.this.append(stringBuffer.toString());
|
||||
stringBuffer = new StringBuffer();
|
||||
}
|
||||
if (!bl) continue;
|
||||
if (this.shell != null) {
|
||||
this.shell.exitBusy();
|
||||
}
|
||||
bl = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
string = this.clearSync;
|
||||
synchronized (string) {
|
||||
if (this.clearBuffer) {
|
||||
n = 0;
|
||||
this.clearBuffer = false;
|
||||
}
|
||||
}
|
||||
if (this.stopped) continue;
|
||||
if (n >= 0) {
|
||||
if (l2 - l > (long)BInputStreamPane.this.bufferTime) {
|
||||
if (stringBuffer.length() > 0) {
|
||||
BInputStreamPane.this.append(stringBuffer.toString());
|
||||
stringBuffer = new StringBuffer();
|
||||
}
|
||||
BInputStreamPane.this.append(new String(byArray, 0, n));
|
||||
continue;
|
||||
}
|
||||
stringBuffer.append(new String(byArray, 0, n));
|
||||
continue;
|
||||
}
|
||||
if (stringBuffer.length() > 0) {
|
||||
BInputStreamPane.this.append(stringBuffer.toString());
|
||||
stringBuffer = new StringBuffer();
|
||||
}
|
||||
this.stopWatcher(false);
|
||||
}
|
||||
}
|
||||
catch (EOFException eOFException) {
|
||||
String string = "\n" + lex.getText("InputStreamPane.eof");
|
||||
BInputStreamPane.this.append(stringBuffer.toString());
|
||||
stringBuffer = new StringBuffer();
|
||||
BInputStreamPane.this.append(string.getBytes(), 0, string.length());
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
BInputStreamPane.this.append(stringBuffer.toString());
|
||||
stringBuffer = new StringBuffer();
|
||||
if (!this.stopped) {
|
||||
iOException.printStackTrace(System.out);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (bl && this.shell != null) {
|
||||
this.shell.exitBusy();
|
||||
}
|
||||
this.stopWatcher(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopWatcher() {
|
||||
this.stopWatcher(true);
|
||||
}
|
||||
|
||||
public void stopWatcher(boolean bl) {
|
||||
if (this.stopped) {
|
||||
return;
|
||||
}
|
||||
this.clearBuffer = false;
|
||||
this.stopped = true;
|
||||
try {
|
||||
this.in.close();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
if (bl) {
|
||||
try {
|
||||
this.join();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void clearOutput() {
|
||||
String string = this.clearSync;
|
||||
synchronized (string) {
|
||||
BInputStreamPane.this.clear();
|
||||
this.clearBuffer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BEnum
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.BObject
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BListDropDown
|
||||
* javax.baja.ui.BTextDropDown
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.workbench.fieldeditor.BWbFieldEditor
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BListDropDown;
|
||||
import javax.baja.ui.BTextDropDown;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.workbench.fieldeditor.BWbFieldEditor;
|
||||
|
||||
public class BLimitedFrozenEnumFE
|
||||
extends BWbFieldEditor {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BLimitedFrozenEnumFE == null ? (class$com$tridium$platform$ui$util$BLimitedFrozenEnumFE = BLimitedFrozenEnumFE.class$("com.tridium.platform.ui.util.BLimitedFrozenEnumFE")) : class$com$tridium$platform$ui$util$BLimitedFrozenEnumFE));
|
||||
private BListDropDown combo = new BListDropDown();
|
||||
private BEnum val;
|
||||
private int[] ordinals;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BLimitedFrozenEnumFE;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BLimitedFrozenEnumFE() {
|
||||
this.setContent((BWidget)this.combo);
|
||||
this.linkTo("lk0", (BComponent)this.combo, (Slot)BTextDropDown.valueModified, (Slot)setModified);
|
||||
this.linkTo("lk1", (BComponent)this.combo, (Slot)BTextDropDown.actionPerformed, (Slot)actionPerformed);
|
||||
}
|
||||
|
||||
protected void doSetReadonly(boolean bl) {
|
||||
this.combo.setDropDownEnabled(!bl);
|
||||
}
|
||||
|
||||
protected void doLoadValue(BObject bObject, Context context) {
|
||||
BEnumRange bEnumRange;
|
||||
this.val = (BEnum)bObject;
|
||||
BEnumRange bEnumRange2 = this.val.getRange();
|
||||
if (context != null && (bEnumRange = (BEnumRange)context.getFacet("range")) != null) {
|
||||
bEnumRange2 = bEnumRange;
|
||||
}
|
||||
this.ordinals = bEnumRange2.getOrdinals();
|
||||
int n = -1;
|
||||
this.combo.getList().removeAllItems();
|
||||
for (int i = 0; i < this.ordinals.length; ++i) {
|
||||
int n2 = this.ordinals[i];
|
||||
String string = bEnumRange2.getDisplayTag(n2, null);
|
||||
this.combo.getList().addItem((Object)string);
|
||||
if (n2 != this.val.getOrdinal()) continue;
|
||||
n = i;
|
||||
}
|
||||
this.combo.setSelectedIndex(n);
|
||||
}
|
||||
|
||||
protected BObject doSaveValue(BObject bObject, Context context) {
|
||||
int n = this.combo.getSelectedIndex();
|
||||
return this.val.getRange().get(this.ordinals[n]);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.sys.Action
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BTextField
|
||||
* 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.text.BTextEditor
|
||||
* javax.baja.ui.text.TextController
|
||||
* javax.baja.ui.wizard.BWizardHeader
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandDialog;
|
||||
import com.tridium.platform.ui.util.BInitialFocusDialog;
|
||||
import com.tridium.platform.ui.util.DialogCommand;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.sys.Action;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BTextField;
|
||||
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.text.BTextEditor;
|
||||
import javax.baja.ui.text.TextController;
|
||||
import javax.baja.ui.wizard.BWizardHeader;
|
||||
|
||||
public class BStringPromptDialog
|
||||
extends BEdgePane {
|
||||
public static final Action handleTextModified = BStringPromptDialog.newAction((int)4, null);
|
||||
public static final Action handleActionPerformed = BStringPromptDialog.newAction((int)4, null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BStringPromptDialog == null ? (class$com$tridium$platform$ui$util$BStringPromptDialog = BStringPromptDialog.class$("com.tridium.platform.ui.util.BStringPromptDialog")) : class$com$tridium$platform$ui$util$BStringPromptDialog));
|
||||
private BTextField textField;
|
||||
private BCommandDialog dialog = null;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BStringPromptDialog;
|
||||
|
||||
public void handleTextModified() {
|
||||
this.invoke(handleTextModified, null, null);
|
||||
}
|
||||
|
||||
public void handleActionPerformed() {
|
||||
this.invoke(handleActionPerformed, null, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
private BStringPromptDialog(BImage bImage, String string, String string2, String string3, TextController textController, boolean bl) {
|
||||
if (bl) {
|
||||
BLabel bLabel = new BLabel(string2);
|
||||
bLabel.setHalign(BHalign.left);
|
||||
this.setTop((BWidget)new BBorderPane((BWidget)bLabel, 5.0, 5.0, 5.0, 5.0));
|
||||
} else {
|
||||
this.setTop((BWidget)new BWizardHeader(bImage, string, string2 == null ? "" : string2));
|
||||
}
|
||||
this.textField = new BTextField(string3, 30, true);
|
||||
this.setCenter((BWidget)new BBorderPane((BWidget)this.textField, 10.0, 10.0, 10.0, 10.0));
|
||||
if (textController != null) {
|
||||
this.textField.setController(textController);
|
||||
}
|
||||
this.linkTo((BComponent)this.textField, (Slot)BTextEditor.textModified, (Slot)handleTextModified);
|
||||
this.linkTo((BComponent)this.textField, (Slot)BTextField.actionPerformed, (Slot)handleActionPerformed);
|
||||
}
|
||||
|
||||
public static String getString(BWidget bWidget, BImage bImage, String string, String string2) {
|
||||
return BStringPromptDialog.getString(bWidget, bImage, string, string2, "", null, false);
|
||||
}
|
||||
|
||||
public static String getString(BWidget bWidget, BImage bImage, String string, String string2, String string3) {
|
||||
return BStringPromptDialog.getString(bWidget, bImage, string, string2, string3, null, false);
|
||||
}
|
||||
|
||||
public static String getString(BWidget bWidget, BImage bImage, String string, String string2, TextController textController) {
|
||||
return BStringPromptDialog.getString(bWidget, bImage, string, string2, "", textController, false);
|
||||
}
|
||||
|
||||
public static String getString(BWidget bWidget, BImage bImage, String string, String string2, String string3, TextController textController) {
|
||||
return BStringPromptDialog.getString(bWidget, bImage, string, string2, string3, textController, false);
|
||||
}
|
||||
|
||||
public static String getString(BWidget bWidget, BImage bImage, String string, String string2, String string3, TextController textController, boolean bl) {
|
||||
BStringPromptDialog bStringPromptDialog = new BStringPromptDialog(bImage, string, string2, string3, textController, bl);
|
||||
BInitialFocusDialog bInitialFocusDialog = new BInitialFocusDialog(bWidget, string, (BWidget)bStringPromptDialog, new DialogCommand[]{DialogCommand.makeOk(bWidget), DialogCommand.makeCancel(bWidget)}, null);
|
||||
bStringPromptDialog.setDialog(bInitialFocusDialog);
|
||||
bInitialFocusDialog.setBoundsCenteredOnOwner();
|
||||
bInitialFocusDialog.setInitialFocusWidget(bStringPromptDialog.getInitialFocusWidget());
|
||||
bInitialFocusDialog.open();
|
||||
if (1 == bInitialFocusDialog.getResult()) {
|
||||
return bStringPromptDialog.getText();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String getText() {
|
||||
return this.textField.getText();
|
||||
}
|
||||
|
||||
void setDialog(BCommandDialog bCommandDialog) {
|
||||
this.dialog = bCommandDialog;
|
||||
this.doHandleTextModified();
|
||||
}
|
||||
|
||||
BWidget getInitialFocusWidget() {
|
||||
return this.textField;
|
||||
}
|
||||
|
||||
public void doHandleTextModified() {
|
||||
Command command;
|
||||
if (this.dialog != null && (command = this.dialog.getButtonCommand(1)) != null) {
|
||||
command.setEnabled(this.textField.getText().trim().length() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void doHandleActionPerformed() {
|
||||
Command command;
|
||||
if (this.dialog != null && (command = this.dialog.getButtonCommand(1)) != null && command.isEnabled()) {
|
||||
command.invoke();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.Graphics
|
||||
* javax.baja.sys.Clock
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.pane.BTextEditorPane
|
||||
* javax.baja.ui.text.Line
|
||||
* javax.baja.ui.text.Position
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.CharArrayWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Writer;
|
||||
import javax.baja.gx.Graphics;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.pane.BTextEditorPane;
|
||||
import javax.baja.ui.text.Line;
|
||||
import javax.baja.ui.text.Position;
|
||||
|
||||
public class BTextOutputPane
|
||||
extends BTextEditorPane {
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BTextOutputPane == null ? (class$com$tridium$platform$ui$util$BTextOutputPane = BTextOutputPane.class$("com.tridium.platform.ui.util.BTextOutputPane")) : class$com$tridium$platform$ui$util$BTextOutputPane));
|
||||
private boolean autoScroll = false;
|
||||
private Object monitor = new Object();
|
||||
private CharArrayWriter outputA = new CharArrayWriter();
|
||||
private CharArrayWriter outputB = new CharArrayWriter();
|
||||
private CharArrayWriter output = this.outputA;
|
||||
private TextModelWriter textModelWriter = new TextModelWriter();
|
||||
private long maxSize = 32768L;
|
||||
private long currentSize = 0L;
|
||||
private boolean toEnd = false;
|
||||
private long lastUpdate = 0L;
|
||||
private AutoScrollThread autoScrollThread = null;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BTextOutputPane;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BTextOutputPane(byte[] byArray, int n, int n2) {
|
||||
this();
|
||||
this.append(byArray, n, n2);
|
||||
}
|
||||
|
||||
public BTextOutputPane(Throwable throwable) {
|
||||
this();
|
||||
this.append(throwable);
|
||||
}
|
||||
|
||||
public BTextOutputPane(String string) {
|
||||
this();
|
||||
this.append(string);
|
||||
}
|
||||
|
||||
public BTextOutputPane() {
|
||||
this(20, 80);
|
||||
}
|
||||
|
||||
public BTextOutputPane(int n, int n2, Throwable throwable) {
|
||||
this(n, n2);
|
||||
this.append(throwable);
|
||||
}
|
||||
|
||||
public BTextOutputPane(int n, int n2, String string) {
|
||||
this(n, n2);
|
||||
this.append(string);
|
||||
}
|
||||
|
||||
public BTextOutputPane(int n, int n2) {
|
||||
super("", n, n2, false);
|
||||
}
|
||||
|
||||
public void started() throws Exception {
|
||||
super.started();
|
||||
if (this.autoScrollThread != null) {
|
||||
this.autoScrollThread.terminate();
|
||||
}
|
||||
this.autoScrollThread = new AutoScrollThread();
|
||||
this.autoScrollThread.start();
|
||||
}
|
||||
|
||||
public void stopped() throws Exception {
|
||||
super.stopped();
|
||||
if (this.autoScrollThread != null) {
|
||||
this.autoScrollThread.terminate();
|
||||
}
|
||||
this.autoScrollThread = null;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.setText("");
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void setText(String string) {
|
||||
Object object = this.monitor;
|
||||
synchronized (object) {
|
||||
super.setText(string);
|
||||
this.currentSize = string.length();
|
||||
}
|
||||
}
|
||||
|
||||
public void append(Throwable throwable) {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
throwable.printStackTrace(new PrintStream(byteArrayOutputStream));
|
||||
this.append(byteArrayOutputStream.toString());
|
||||
}
|
||||
|
||||
public void append(byte[] byArray, int n, int n2) {
|
||||
this.append(new String(byArray, n, n2));
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void append(String string) {
|
||||
Object object = this.monitor;
|
||||
synchronized (object) {
|
||||
this.output.write(string, 0, string.length());
|
||||
}
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void paint(Graphics graphics) {
|
||||
boolean bl;
|
||||
CharArrayWriter charArrayWriter = null;
|
||||
boolean bl2 = bl = this.output.size() > 0;
|
||||
if (bl) {
|
||||
this.toEnd = true;
|
||||
Object object = this.monitor;
|
||||
synchronized (object) {
|
||||
if (this.output == this.outputA) {
|
||||
this.output = this.outputB;
|
||||
charArrayWriter = this.outputA;
|
||||
} else {
|
||||
this.output = this.outputA;
|
||||
charArrayWriter = this.outputB;
|
||||
}
|
||||
}
|
||||
try {
|
||||
charArrayWriter.writeTo(this.textModelWriter);
|
||||
charArrayWriter.reset();
|
||||
this.currentSize = this.getEditor().getModel().getTextLength();
|
||||
if (this.currentSize > this.maxSize) {
|
||||
int n = 0;
|
||||
while ((double)this.currentSize > (double)this.maxSize * 0.95) {
|
||||
Line line = this.getEditor().getModel().getLine(n);
|
||||
this.currentSize -= (long)line.getColumnCount();
|
||||
++n;
|
||||
}
|
||||
this.getEditor().getModel().remove(new Position(0, 0), new Position(n, 0));
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
System.out.println("*** exception adding/removing data:");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
this.lastUpdate = Clock.ticks();
|
||||
}
|
||||
if (this.autoScroll && this.toEnd) {
|
||||
this.getEditor().scrollToVisible(this.getEditor().getModel().getEndPosition());
|
||||
this.toEnd = false;
|
||||
}
|
||||
super.paint(graphics);
|
||||
}
|
||||
|
||||
public void scrollToEnd() {
|
||||
this.getEditor().moveCaretPosition(this.getEditor().getModel().getEndPosition());
|
||||
this.toEnd = true;
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void setOutputBufferSize(int n) {
|
||||
this.maxSize = n;
|
||||
}
|
||||
|
||||
public void setUseAutoScroll(boolean bl) {
|
||||
this.autoScroll = bl;
|
||||
}
|
||||
|
||||
public boolean useAutoScroll() {
|
||||
return this.autoScroll;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class AutoScrollThread
|
||||
extends Thread {
|
||||
private boolean running = true;
|
||||
private boolean dirty = true;
|
||||
|
||||
public AutoScrollThread() {
|
||||
super("TextOutputPane:AutoScroll");
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (this.running) {
|
||||
if (Clock.ticks() - BTextOutputPane.this.lastUpdate > 500L) {
|
||||
if (this.dirty) {
|
||||
BTextOutputPane.this.scrollToEnd();
|
||||
this.dirty = false;
|
||||
}
|
||||
} else {
|
||||
this.dirty = true;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(500L);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
public void terminate() {
|
||||
this.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
private class TextModelWriter
|
||||
extends Writer {
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
}
|
||||
|
||||
public void write(char[] cArray, int n, int n2) throws IOException {
|
||||
BTextOutputPane.this.getEditor().getModel().insert(BTextOutputPane.this.getEditor().getModel().getEndPosition(), cArray, n, n2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* javax.baja.gx.BInsets
|
||||
* javax.baja.gx.Point
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.BTextField
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import javax.baja.gx.BInsets;
|
||||
import javax.baja.gx.Point;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.BTextField;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
|
||||
public class BToolTipTextField
|
||||
extends BTextField {
|
||||
public static final Property toolTip = BToolTipTextField.newProperty((int)0, (String)"", null);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BToolTipTextField == null ? (class$com$tridium$platform$ui$util$BToolTipTextField = BToolTipTextField.class$("com.tridium.platform.ui.util.BToolTipTextField")) : class$com$tridium$platform$ui$util$BToolTipTextField));
|
||||
private static TextFieldToolTip window = new TextFieldToolTip(new Frame());
|
||||
private static Font font = new Font(Theme.textEditor().getFont().getName(), 0, (int)Theme.textEditor().getFont().getSize());
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BToolTipTextField;
|
||||
|
||||
public String getToolTip() {
|
||||
return this.getString(toolTip);
|
||||
}
|
||||
|
||||
public void setToolTip(String string) {
|
||||
this.setString(toolTip, string, null);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public BToolTipTextField() {
|
||||
}
|
||||
|
||||
public BToolTipTextField(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
public BToolTipTextField(String string, int n) {
|
||||
super(string, n);
|
||||
}
|
||||
|
||||
public BToolTipTextField(String string, int n, boolean bl) {
|
||||
super(string, n, bl);
|
||||
}
|
||||
|
||||
public void mouseHover(BMouseEvent bMouseEvent) {
|
||||
BInsets bInsets;
|
||||
super.mouseHover(bMouseEvent);
|
||||
boolean bl = false;
|
||||
String string = this.getToolTip();
|
||||
if (string.trim().length() == 0) {
|
||||
string = this.getText();
|
||||
bInsets = this.getInsets();
|
||||
double d = this.getWidth() - bInsets.left() - bInsets.right();
|
||||
bl = d < (double)BToolTipTextField.getToolTipTextWidth(string);
|
||||
} else {
|
||||
bl = true;
|
||||
}
|
||||
if (bl) {
|
||||
bInsets = this.translateToScreen(new Point(0.0, 16.0));
|
||||
BToolTipTextField.openTextFieldToolTip((int)bInsets.x, (int)bInsets.y, string);
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseExited(BMouseEvent bMouseEvent) {
|
||||
super.mouseExited(bMouseEvent);
|
||||
BToolTipTextField.closeTextFieldToolTip();
|
||||
}
|
||||
|
||||
public static void openTextFieldToolTip(int n, int n2, String string) {
|
||||
window.setLocation(n, n2);
|
||||
BToolTipTextField.window.setText(string);
|
||||
window.checkLocation();
|
||||
window.pack();
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
public static void closeTextFieldToolTip() {
|
||||
window.setVisible(false);
|
||||
}
|
||||
|
||||
public static int getToolTipTextWidth(String string) {
|
||||
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
|
||||
return fontMetrics.stringWidth(string);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class TextFieldToolTip
|
||||
extends Window {
|
||||
private String text;
|
||||
private int delta;
|
||||
private Color foreground;
|
||||
private Color background;
|
||||
|
||||
private TextFieldToolTip(Frame frame) {
|
||||
super(frame);
|
||||
this.setLayout(null);
|
||||
this.foreground = Color.black;
|
||||
this.background = Color.white;
|
||||
}
|
||||
|
||||
private void setText(String string) {
|
||||
this.text = string;
|
||||
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
|
||||
this.delta = fontMetrics.getHeight();
|
||||
int n = fontMetrics.stringWidth(this.text) + 8;
|
||||
int n2 = this.delta + 4;
|
||||
this.setSize(n, n2);
|
||||
}
|
||||
|
||||
public void checkLocation() {
|
||||
int n;
|
||||
int n2 = this.getLocation().x;
|
||||
int n3 = this.getLocation().y;
|
||||
int n4 = this.getSize().width;
|
||||
int n5 = this.getSize().height;
|
||||
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice[] graphicsDeviceArray = graphicsEnvironment.getScreenDevices();
|
||||
Rectangle rectangle = null;
|
||||
for (n = 0; n < graphicsDeviceArray.length && !(rectangle = graphicsDeviceArray[n].getDefaultConfiguration().getBounds()).contains(this.getLocation()); ++n) {
|
||||
}
|
||||
if (rectangle != null) {
|
||||
int n6;
|
||||
n = this.getLocation().x + n4 + 5 - (rectangle.x + rectangle.width);
|
||||
if (n > 0) {
|
||||
n2 -= n;
|
||||
}
|
||||
if ((n6 = this.getLocation().y + n5 + 5 - (rectangle.y + rectangle.height)) > 0) {
|
||||
n3 -= n6;
|
||||
n3 -= n5 * 2;
|
||||
}
|
||||
}
|
||||
this.setLocation(n2, n3);
|
||||
}
|
||||
|
||||
public void paint(Graphics graphics) {
|
||||
int n = this.getWidth();
|
||||
int n2 = this.getHeight();
|
||||
graphics.setColor(this.foreground);
|
||||
graphics.fillRect(0, 0, n, n2);
|
||||
graphics.setColor(this.background);
|
||||
graphics.fillRect(1, 1, n - 2, n2 - 2);
|
||||
graphics.setColor(this.foreground);
|
||||
graphics.setFont(font);
|
||||
graphics.drawString(this.text, 4, this.delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BFrozenEnum
|
||||
* javax.baja.sys.Sys
|
||||
* javax.baja.sys.Type
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public final class BTreeCascadePolicy
|
||||
extends BFrozenEnum {
|
||||
public static final int NEVER = 0;
|
||||
public static final int ON_TRUE = 1;
|
||||
public static final int ON_FALSE = 2;
|
||||
public static final int ALWAYS = 3;
|
||||
public static final BTreeCascadePolicy never = new BTreeCascadePolicy(0);
|
||||
public static final BTreeCascadePolicy onTrue = new BTreeCascadePolicy(1);
|
||||
public static final BTreeCascadePolicy onFalse = new BTreeCascadePolicy(2);
|
||||
public static final BTreeCascadePolicy always = new BTreeCascadePolicy(3);
|
||||
public static final Type TYPE = Sys.loadType((Class)(class$com$tridium$platform$ui$util$BTreeCascadePolicy == null ? (class$com$tridium$platform$ui$util$BTreeCascadePolicy = BTreeCascadePolicy.class$("com.tridium.platform.ui.util.BTreeCascadePolicy")) : class$com$tridium$platform$ui$util$BTreeCascadePolicy));
|
||||
public static final BTreeCascadePolicy DEFAULT = never;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$BTreeCascadePolicy;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static BTreeCascadePolicy make(int n) {
|
||||
return (BTreeCascadePolicy)never.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static BTreeCascadePolicy make(String string) {
|
||||
return (BTreeCascadePolicy)never.getRange().get(string);
|
||||
}
|
||||
|
||||
private BTreeCascadePolicy(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
public boolean cascade(boolean bl) {
|
||||
return this == always || this == onTrue && bl || this == onFalse && !bl;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.ui.BRadioButton
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.ToggleCommandGroup
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.ui.BRadioButton;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.ToggleCommandGroup;
|
||||
|
||||
public class BooleanRadioGroup
|
||||
extends ToggleCommandGroup {
|
||||
private BRadioButton trueButton;
|
||||
private BRadioButton falseButton;
|
||||
private boolean value;
|
||||
|
||||
public BooleanRadioGroup(BWidget bWidget, String string, String string2, boolean bl) {
|
||||
this(bWidget, string, string2);
|
||||
this.setValue(bl);
|
||||
}
|
||||
|
||||
public BooleanRadioGroup(BWidget bWidget, ToggleCommand toggleCommand, ToggleCommand toggleCommand2) {
|
||||
this.trueButton = new BRadioButton(toggleCommand, true, false);
|
||||
this.add(toggleCommand);
|
||||
this.falseButton = new BRadioButton(toggleCommand2, true, false);
|
||||
this.add(toggleCommand2);
|
||||
}
|
||||
|
||||
public BooleanRadioGroup(BWidget bWidget, String string, String string2) {
|
||||
this(bWidget, new ToggleCommand(bWidget, string), new ToggleCommand(bWidget, string2));
|
||||
}
|
||||
|
||||
public void linkAction(BComponent bComponent, Slot slot) {
|
||||
bComponent.linkTo(null, (BComponent)this.trueButton, (Slot)BRadioButton.actionPerformed, slot);
|
||||
bComponent.linkTo(null, (BComponent)this.falseButton, (Slot)BRadioButton.actionPerformed, slot);
|
||||
}
|
||||
|
||||
public boolean getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(boolean bl) {
|
||||
if (bl) {
|
||||
this.trueButton.setSelected(true);
|
||||
} else {
|
||||
this.falseButton.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void selected(ToggleCommand toggleCommand) {
|
||||
this.value = toggleCommand == this.trueButton.getCommand();
|
||||
}
|
||||
|
||||
public BWidget getTrueWidget() {
|
||||
return this.trueButton;
|
||||
}
|
||||
|
||||
public BWidget getFalseWidget() {
|
||||
return this.falseButton;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,457 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.ui.BActionMenuItem
|
||||
* javax.baja.ui.BMenu
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.event.BMouseEvent
|
||||
* javax.baja.ui.list.ListController
|
||||
* javax.baja.ui.list.ListSelection
|
||||
* javax.baja.ui.table.TableController
|
||||
* javax.baja.ui.table.TableSelection
|
||||
* javax.baja.ui.treetable.TreeTableController
|
||||
* javax.baja.ui.treetable.TreeTableSelection
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandEnablePolicy;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.ui.BActionMenuItem;
|
||||
import javax.baja.ui.BMenu;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.event.BMouseEvent;
|
||||
|
||||
public class CommandBindings {
|
||||
private Support support = new Support(){
|
||||
|
||||
public void setBoundCommandEnabled(Command command, boolean bl) {
|
||||
command.setEnabled(bl);
|
||||
}
|
||||
};
|
||||
Array commands = new Array(class$com$tridium$platform$ui$util$CommandBindings$CommandPolicy == null ? (class$com$tridium$platform$ui$util$CommandBindings$CommandPolicy = CommandBindings.class$("com.tridium.platform.ui.util.CommandBindings$CommandPolicy")) : class$com$tridium$platform$ui$util$CommandBindings$CommandPolicy);
|
||||
Command doubleClickCommand = null;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$CommandBindings$CommandPolicy;
|
||||
|
||||
public void addCommand(Command command, BCommandEnablePolicy bCommandEnablePolicy) {
|
||||
this.commands.add((Object)new CommandPolicy(command, bCommandEnablePolicy));
|
||||
command.setEnabled(bCommandEnablePolicy == BCommandEnablePolicy.always);
|
||||
}
|
||||
|
||||
public void setDoubleClickCommand(Command command) {
|
||||
this.doubleClickCommand = command;
|
||||
}
|
||||
|
||||
public void setSupport(Support support) {
|
||||
this.support = support;
|
||||
}
|
||||
|
||||
public Support getSupport() {
|
||||
return this.support;
|
||||
}
|
||||
|
||||
public int getCommandCount() {
|
||||
return this.commands.size();
|
||||
}
|
||||
|
||||
public Command[] getCommands() {
|
||||
Command[] commandArray = new Command[this.getCommandCount()];
|
||||
for (int i = 0; i < commandArray.length; ++i) {
|
||||
commandArray[i] = this.getCommand(i);
|
||||
}
|
||||
return commandArray;
|
||||
}
|
||||
|
||||
public Command getCommand(int n) {
|
||||
CommandPolicy commandPolicy = (CommandPolicy)this.commands.get(n);
|
||||
return commandPolicy.command;
|
||||
}
|
||||
|
||||
public BCommandEnablePolicy getPolicy(int n) {
|
||||
CommandPolicy commandPolicy = (CommandPolicy)this.commands.get(n);
|
||||
return commandPolicy.policy;
|
||||
}
|
||||
|
||||
public void doubleClick() {
|
||||
if (this.doubleClickCommand != null && this.doubleClickCommand.isEnabled()) {
|
||||
this.doubleClickCommand.invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMenuCommands(BMenu bMenu) {
|
||||
Command[] commandArray = this.getCommands();
|
||||
for (int i = 0; i < commandArray.length; ++i) {
|
||||
if (!commandArray[i].isEnabled()) continue;
|
||||
bMenu.add(null, (BValue)new BActionMenuItem(commandArray[i]), null);
|
||||
}
|
||||
}
|
||||
|
||||
public void commandPopup(BWidget bWidget, double d, double d2) {
|
||||
BMenu bMenu = new BMenu();
|
||||
boolean bl = false;
|
||||
Command[] commandArray = this.getCommands();
|
||||
for (int i = 0; i < commandArray.length; ++i) {
|
||||
if (!commandArray[i].isEnabled()) continue;
|
||||
bMenu.add(null, (BValue)new BActionMenuItem(commandArray[i]), null);
|
||||
bl = true;
|
||||
}
|
||||
if (bl) {
|
||||
bMenu.open(bWidget, d, d2);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class TreeTableController
|
||||
extends javax.baja.ui.treetable.TreeTableController {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public TreeTableController() {
|
||||
this.bindings = new CommandBindings();
|
||||
}
|
||||
|
||||
public TreeTableController(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
protected void cellDoubleClicked(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
this.bindings.doubleClick();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.bindings;
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
this.commandPopup(bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void backgroundPopup(BMouseEvent bMouseEvent) {
|
||||
this.commandPopup(bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void commandPopup(double d, double d2) {
|
||||
this.bindings.commandPopup((BWidget)this.getTable(), d, d2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TreeTableSelection
|
||||
extends javax.baja.ui.treetable.TreeTableSelection {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public TreeTableSelection() {
|
||||
this.bindings = new CommandBindings();
|
||||
}
|
||||
|
||||
public TreeTableSelection(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
super.select(n, n2, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselect(int n) {
|
||||
super.deselect(n);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselectAll() {
|
||||
super.deselectAll();
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.bindings;
|
||||
}
|
||||
|
||||
public void setCommandEnabledStates() {
|
||||
int n = this.getRows().length;
|
||||
Command[] commandArray = this.bindings.getCommands();
|
||||
block8: for (int i = 0; i < commandArray.length; ++i) {
|
||||
switch (this.bindings.getPolicy(i).getOrdinal()) {
|
||||
case 1: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 1);
|
||||
continue block8;
|
||||
}
|
||||
case 2: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 2);
|
||||
continue block8;
|
||||
}
|
||||
case 3: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n > 1);
|
||||
continue block8;
|
||||
}
|
||||
case 4: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n > 0);
|
||||
continue block8;
|
||||
}
|
||||
case 5: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], true);
|
||||
continue block8;
|
||||
}
|
||||
case 0: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 0);
|
||||
continue block8;
|
||||
}
|
||||
default: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TableController
|
||||
extends javax.baja.ui.table.TableController {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public TableController() {
|
||||
this.bindings = new CommandBindings();
|
||||
}
|
||||
|
||||
public TableController(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
protected void cellDoubleClicked(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
this.bindings.doubleClick();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.bindings;
|
||||
}
|
||||
|
||||
protected void cellPopup(BMouseEvent bMouseEvent, int n, int n2) {
|
||||
this.commandPopup(bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void backgroundPopup(BMouseEvent bMouseEvent) {
|
||||
this.commandPopup(bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void commandPopup(double d, double d2) {
|
||||
this.bindings.commandPopup((BWidget)this.getTable(), d, d2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TableSelection
|
||||
extends javax.baja.ui.table.TableSelection {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public TableSelection() {
|
||||
this.bindings = new CommandBindings();
|
||||
}
|
||||
|
||||
public TableSelection(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
super.select(n, n2, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselect(int n) {
|
||||
super.deselect(n);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselectAll() {
|
||||
super.deselectAll();
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.bindings;
|
||||
}
|
||||
|
||||
public void setCommandEnabledStates() {
|
||||
int[] nArray = this.getRows();
|
||||
int n = nArray != null ? nArray.length : 0;
|
||||
Command[] commandArray = this.bindings.getCommands();
|
||||
for (int i = 0; i < commandArray.length; ++i) {
|
||||
this.setEnabled(commandArray[i], n, this.bindings.getPolicy(i));
|
||||
}
|
||||
}
|
||||
|
||||
protected void setEnabled(Command command, int n, BCommandEnablePolicy bCommandEnablePolicy) {
|
||||
switch (bCommandEnablePolicy.getOrdinal()) {
|
||||
case 1: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, n == 1);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, n == 2);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, n > 1);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, n > 0);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, true);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, n == 0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(command, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListSelection
|
||||
extends javax.baja.ui.list.ListSelection {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public ListSelection() {
|
||||
this.bindings = new CommandBindings();
|
||||
}
|
||||
|
||||
public ListSelection(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
public CommandBindings getCommandBindings() {
|
||||
return this.bindings;
|
||||
}
|
||||
|
||||
public void setCommandEnabledStates() {
|
||||
int n = this.getItems().length;
|
||||
Command[] commandArray = this.bindings.getCommands();
|
||||
block8: for (int i = 0; i < commandArray.length; ++i) {
|
||||
switch (this.bindings.getPolicy(i).getOrdinal()) {
|
||||
case 1: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 1);
|
||||
continue block8;
|
||||
}
|
||||
case 2: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 2);
|
||||
continue block8;
|
||||
}
|
||||
case 3: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n > 1);
|
||||
continue block8;
|
||||
}
|
||||
case 4: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n > 0);
|
||||
continue block8;
|
||||
}
|
||||
case 5: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], true);
|
||||
continue block8;
|
||||
}
|
||||
case 0: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], n == 0);
|
||||
continue block8;
|
||||
}
|
||||
default: {
|
||||
this.bindings.getSupport().setBoundCommandEnabled(commandArray[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void select(int n, boolean bl) {
|
||||
super.select(n, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int n, int n2, boolean bl) {
|
||||
super.select(n, n2, bl);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void select(int[] nArray) {
|
||||
super.select(nArray);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselect(int n) {
|
||||
super.deselect(n);
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
|
||||
public void deselectAll() {
|
||||
super.deselectAll();
|
||||
this.setCommandEnabledStates();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListController
|
||||
extends javax.baja.ui.list.ListController {
|
||||
private CommandBindings bindings;
|
||||
|
||||
public ListController(CommandBindings commandBindings) {
|
||||
this.bindings = commandBindings;
|
||||
}
|
||||
|
||||
protected void itemDoubleClicked(BMouseEvent bMouseEvent, int n) {
|
||||
this.bindings.doubleClick();
|
||||
}
|
||||
|
||||
protected void itemPopup(BMouseEvent bMouseEvent, int n) {
|
||||
this.bindings.commandPopup((BWidget)this.getList(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
|
||||
protected void backgroundPopup(BMouseEvent bMouseEvent) {
|
||||
this.bindings.commandPopup((BWidget)this.getList(), bMouseEvent.getX(), bMouseEvent.getY());
|
||||
}
|
||||
}
|
||||
|
||||
private class CommandPolicy {
|
||||
public Command command;
|
||||
public BCommandEnablePolicy policy;
|
||||
|
||||
public CommandPolicy(Command command, BCommandEnablePolicy bCommandEnablePolicy) {
|
||||
this.command = command;
|
||||
this.policy = bCommandEnablePolicy;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface Support {
|
||||
public void setBoundCommandEnabled(Command var1, boolean var2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.sys.Localizable
|
||||
* javax.baja.ui.BDialog
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.util.Lexicon
|
||||
* javax.baja.workbench.CannotSaveException
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.sys.Localizable;
|
||||
import javax.baja.ui.BDialog;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.util.Lexicon;
|
||||
import javax.baja.workbench.CannotSaveException;
|
||||
|
||||
public class CommandUtil {
|
||||
private static final Lexicon lex = Lexicon.make((String)"platform");
|
||||
|
||||
public static void error(Command command, Throwable throwable) {
|
||||
CommandUtil.error(command, command.getOwner(), throwable);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public static void error(Command command, BWidget bWidget, Throwable throwable) {
|
||||
try {
|
||||
String string = throwable instanceof Localizable ? lex.getText("CommandUtil.error.dlgMessage.localized", new Object[]{command.getLabel()}) : (throwable instanceof CannotSaveException ? lex.getText("CommandUtil.error.dlgMessage.detailed", new Object[]{command.getLabel(), throwable.getMessage()}) : lex.getText("CommandUtil.error.dlgMessage.generic", new Object[]{command.getLabel()}));
|
||||
BDialog.error((BWidget)bWidget, (String)lex.getText("CommandUtil.error.dlgTitle"), (Object)string, (Throwable)throwable);
|
||||
}
|
||||
finally {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.gx.BImage
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BModule
|
||||
* javax.baja.ui.BAccelerator
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.Command
|
||||
* javax.baja.ui.CommandArtifact
|
||||
* javax.baja.ui.util.UiLexicon
|
||||
* javax.baja.util.Lexicon
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCommandDialog;
|
||||
import java.util.Properties;
|
||||
import javax.baja.gx.BImage;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BModule;
|
||||
import javax.baja.ui.BAccelerator;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.Command;
|
||||
import javax.baja.ui.CommandArtifact;
|
||||
import javax.baja.ui.util.UiLexicon;
|
||||
import javax.baja.util.Lexicon;
|
||||
|
||||
public class DialogCommand
|
||||
extends Command {
|
||||
private BCommandDialog dialog = null;
|
||||
private int result;
|
||||
private static String okText;
|
||||
private static String cancelText;
|
||||
private static String yesText;
|
||||
private static String noText;
|
||||
private static String closeText;
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$DialogCommand;
|
||||
|
||||
public DialogCommand(BWidget bWidget, int n, BModule bModule, String string) {
|
||||
super(bWidget, bModule, string);
|
||||
this.result = n;
|
||||
}
|
||||
|
||||
public DialogCommand(BWidget bWidget, int n, Lexicon lexicon, String string) {
|
||||
super(bWidget, lexicon, string);
|
||||
this.result = n;
|
||||
}
|
||||
|
||||
public DialogCommand(BWidget bWidget, int n, Properties properties, String string) {
|
||||
super(bWidget, properties, string);
|
||||
this.result = n;
|
||||
}
|
||||
|
||||
public DialogCommand(BWidget bWidget, int n, String string, BImage bImage, BAccelerator bAccelerator, String string2) {
|
||||
super(bWidget, string, bImage, bAccelerator, string2);
|
||||
this.result = n;
|
||||
}
|
||||
|
||||
public DialogCommand(BWidget bWidget, int n, String string) {
|
||||
super(bWidget, string);
|
||||
this.result = n;
|
||||
}
|
||||
|
||||
public static DialogCommand makeOk(BWidget bWidget) {
|
||||
DialogCommand.initButtonText();
|
||||
return new DialogCommand(bWidget, 1, okText);
|
||||
}
|
||||
|
||||
public static DialogCommand makeClose(BWidget bWidget) {
|
||||
DialogCommand.initButtonText();
|
||||
return new DialogCommand(bWidget, 16, closeText);
|
||||
}
|
||||
|
||||
public static DialogCommand makeCancel(BWidget bWidget) {
|
||||
DialogCommand.initButtonText();
|
||||
return new DialogCommand(bWidget, 2, cancelText);
|
||||
}
|
||||
|
||||
public static DialogCommand makeYes(BWidget bWidget) {
|
||||
DialogCommand.initButtonText();
|
||||
return new DialogCommand(bWidget, 4, yesText);
|
||||
}
|
||||
|
||||
public static DialogCommand makeNo(BWidget bWidget) {
|
||||
DialogCommand.initButtonText();
|
||||
return new DialogCommand(bWidget, 8, noText);
|
||||
}
|
||||
|
||||
public static DialogCommand[] make(BWidget bWidget, int n) {
|
||||
Array array = new Array(class$com$tridium$platform$ui$util$DialogCommand == null ? (class$com$tridium$platform$ui$util$DialogCommand = DialogCommand.class$("com.tridium.platform.ui.util.DialogCommand")) : class$com$tridium$platform$ui$util$DialogCommand);
|
||||
if ((n & 1) > 0) {
|
||||
array.add((Object)DialogCommand.makeOk(bWidget));
|
||||
}
|
||||
if ((n & 2) > 0) {
|
||||
array.add((Object)DialogCommand.makeCancel(bWidget));
|
||||
}
|
||||
if ((n & 4) > 0) {
|
||||
array.add((Object)DialogCommand.makeYes(bWidget));
|
||||
}
|
||||
if ((n & 8) > 0) {
|
||||
array.add((Object)DialogCommand.makeNo(bWidget));
|
||||
}
|
||||
if ((n & 0x10) > 0) {
|
||||
array.add((Object)DialogCommand.makeClose(bWidget));
|
||||
}
|
||||
return (DialogCommand[])array.trim();
|
||||
}
|
||||
|
||||
public void setDialog(BCommandDialog bCommandDialog) {
|
||||
this.dialog = bCommandDialog;
|
||||
}
|
||||
|
||||
public BCommandDialog getDialog() {
|
||||
return this.dialog;
|
||||
}
|
||||
|
||||
public CommandArtifact doInvoke() throws Exception {
|
||||
if (this.dialog != null) {
|
||||
this.dialog.close(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
private static void initButtonText() {
|
||||
if (okText != null) {
|
||||
return;
|
||||
}
|
||||
okText = UiLexicon.bajaui.getText("dialog.ok");
|
||||
cancelText = UiLexicon.bajaui.getText("dialog.cancel");
|
||||
yesText = UiLexicon.bajaui.getText("dialog.yes");
|
||||
noText = UiLexicon.bajaui.getText("dialog.no");
|
||||
closeText = Lexicon.make((String)"platform").getText("dialog.close");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BEnum
|
||||
* javax.baja.sys.BEnumRange
|
||||
* javax.baja.sys.Context
|
||||
* javax.baja.sys.Slot
|
||||
* javax.baja.ui.BRadioButton
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.ToggleCommand
|
||||
* javax.baja.ui.ToggleCommandGroup
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.ui.BRadioButton;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.ToggleCommand;
|
||||
import javax.baja.ui.ToggleCommandGroup;
|
||||
|
||||
public class EnumRadioGroup
|
||||
extends ToggleCommandGroup {
|
||||
private BRadioButton[] buttons;
|
||||
private BEnum enumValue;
|
||||
private Array listeners = new Array(class$com$tridium$platform$ui$util$EnumRadioGroup$EnumRadioGroupListener == null ? (class$com$tridium$platform$ui$util$EnumRadioGroup$EnumRadioGroupListener = EnumRadioGroup.class$("com.tridium.platform.ui.util.EnumRadioGroup$EnumRadioGroupListener")) : class$com$tridium$platform$ui$util$EnumRadioGroup$EnumRadioGroupListener);
|
||||
static /* synthetic */ Class class$com$tridium$platform$ui$util$EnumRadioGroup$EnumRadioGroupListener;
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, BEnum bEnum, Context context) {
|
||||
this(bWidget, bEnum.getRange(), context);
|
||||
this.setValue(bEnum);
|
||||
}
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, BEnumRange bEnumRange, Context context) {
|
||||
int[] nArray = bEnumRange.getOrdinals();
|
||||
String[] stringArray = new String[nArray.length];
|
||||
BEnum[] bEnumArray = new BEnum[nArray.length];
|
||||
for (int i = 0; i < nArray.length; ++i) {
|
||||
bEnumArray[i] = bEnumRange.get(nArray[i]);
|
||||
stringArray[i] = bEnumArray[i].getDisplayTag(context);
|
||||
}
|
||||
this.init(bWidget, stringArray, bEnumArray);
|
||||
}
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, String[] stringArray, BEnum[] bEnumArray, BEnum bEnum) {
|
||||
this(bWidget, stringArray, bEnumArray);
|
||||
this.setValue(bEnum);
|
||||
}
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, BEnum[] bEnumArray, BEnum bEnum, Context context) {
|
||||
this(bWidget, bEnumArray, context);
|
||||
this.setValue(bEnum);
|
||||
}
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, BEnum[] bEnumArray, Context context) {
|
||||
String[] stringArray = new String[bEnumArray.length];
|
||||
for (int i = 0; i < bEnumArray.length; ++i) {
|
||||
stringArray[i] = bEnumArray[i].getDisplayTag(context);
|
||||
}
|
||||
this.init(bWidget, stringArray, bEnumArray);
|
||||
}
|
||||
|
||||
public EnumRadioGroup(BWidget bWidget, String[] stringArray, BEnum[] bEnumArray) {
|
||||
this.init(bWidget, stringArray, bEnumArray);
|
||||
}
|
||||
|
||||
private void init(BWidget bWidget, String[] stringArray, BEnum[] bEnumArray) {
|
||||
this.buttons = new BRadioButton[bEnumArray.length];
|
||||
for (int i = 0; i < bEnumArray.length; ++i) {
|
||||
EnumCommand enumCommand = new EnumCommand(bWidget, stringArray[i], bEnumArray[i]);
|
||||
this.buttons[i] = new BRadioButton((ToggleCommand)enumCommand, true, false);
|
||||
this.add(enumCommand);
|
||||
}
|
||||
}
|
||||
|
||||
public void linkAction(BComponent bComponent, Slot slot) {
|
||||
for (int i = 0; i < this.buttons.length; ++i) {
|
||||
bComponent.linkTo(null, (BComponent)this.buttons[i], (Slot)BRadioButton.actionPerformed, slot);
|
||||
}
|
||||
}
|
||||
|
||||
public BEnum getValue() {
|
||||
return this.enumValue;
|
||||
}
|
||||
|
||||
public void setValue(BEnum bEnum) {
|
||||
BRadioButton bRadioButton = (BRadioButton)this.getWidget(bEnum);
|
||||
if (bRadioButton != null) {
|
||||
bRadioButton.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
public BWidget[] getWidgets() {
|
||||
return this.buttons;
|
||||
}
|
||||
|
||||
public BWidget getWidget(BEnum bEnum) {
|
||||
for (int i = 0; i < this.buttons.length; ++i) {
|
||||
if (!((EnumCommand)this.buttons[i].getCommand()).getEnumValue().equals((Object)bEnum)) continue;
|
||||
return this.buttons[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEnabled(BEnum bEnum, boolean bl) {
|
||||
BRadioButton bRadioButton = (BRadioButton)this.getWidget(bEnum);
|
||||
if (bRadioButton != null) {
|
||||
bRadioButton.setEnabled(bl);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled(BEnum bEnum) {
|
||||
BRadioButton bRadioButton = (BRadioButton)this.getWidget(bEnum);
|
||||
return bRadioButton == null ? false : bRadioButton.isEnabled();
|
||||
}
|
||||
|
||||
public void addListener(EnumRadioGroupListener enumRadioGroupListener) {
|
||||
this.listeners.add((Object)enumRadioGroupListener);
|
||||
}
|
||||
|
||||
public void removeListener(EnumRadioGroupListener enumRadioGroupListener) {
|
||||
this.listeners.remove((Object)enumRadioGroupListener);
|
||||
}
|
||||
|
||||
protected void selected(ToggleCommand toggleCommand) {
|
||||
this.enumValue = ((EnumCommand)toggleCommand).getEnumValue();
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
((EnumRadioGroupListener)this.listeners.get(i)).enumSelected(this.enumValue);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String string) {
|
||||
try {
|
||||
return Class.forName(string);
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static class EnumCommand
|
||||
extends ToggleCommand {
|
||||
private BEnum enumValue;
|
||||
|
||||
public EnumCommand(BWidget bWidget, String string, BEnum bEnum) {
|
||||
super(bWidget, string);
|
||||
this.enumValue = bEnum;
|
||||
}
|
||||
|
||||
public BEnum getEnumValue() {
|
||||
return this.enumValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface EnumRadioGroupListener {
|
||||
public void enumSelected(BEnum var1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.file.FileUtil
|
||||
* javax.baja.nre.util.TextUtil
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.IFilePathFilter;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.file.FileUtil;
|
||||
import javax.baja.nre.util.TextUtil;
|
||||
|
||||
public class ExtPathFilter
|
||||
implements IFilePathFilter {
|
||||
private String[] ext;
|
||||
|
||||
public ExtPathFilter(String string) {
|
||||
this(TextUtil.split((String)string, (char)','));
|
||||
}
|
||||
|
||||
public ExtPathFilter(String[] stringArray) {
|
||||
this.ext = stringArray;
|
||||
}
|
||||
|
||||
public boolean accept(FilePath filePath) {
|
||||
String string = FileUtil.getExtension((String)filePath.getName());
|
||||
for (int i = 0; i < this.ext.length; ++i) {
|
||||
if (string == null || !string.equalsIgnoreCase(this.ext[i])) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.BDirectory
|
||||
* javax.baja.file.BFileSystem
|
||||
* javax.baja.file.FilePath
|
||||
* javax.baja.naming.BOrd
|
||||
* javax.baja.naming.OrdQuery
|
||||
* javax.baja.sys.BComponent
|
||||
* javax.baja.sys.BString
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.sys.BajaRuntimeException
|
||||
* javax.baja.sys.Property
|
||||
* javax.baja.sys.Type
|
||||
* javax.baja.ui.options.BOptions
|
||||
* javax.baja.util.BFolder
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.file.BDirectory;
|
||||
import javax.baja.file.BFileSystem;
|
||||
import javax.baja.file.FilePath;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.ui.options.BOptions;
|
||||
import javax.baja.util.BFolder;
|
||||
|
||||
public class FavoriteDirectory {
|
||||
public static BDirectory loadByPath(String string, String string2, FilePath filePath) {
|
||||
BDirectory bDirectory = null;
|
||||
try {
|
||||
BValue bValue;
|
||||
BOptions bOptions = BOptions.load((String)string, (Type)BOptions.TYPE);
|
||||
BValue bValue2 = bOptions.get(string2);
|
||||
if (bValue2 != null && bValue2 instanceof BComponent && (bValue = ((BComponent)bValue2).get("path")) != null && bValue instanceof BString) {
|
||||
bDirectory = (BDirectory)BFileSystem.INSTANCE.findFile(new FilePath(bValue.toString()));
|
||||
}
|
||||
if (bDirectory == null || !bDirectory.isDirectory()) {
|
||||
if (filePath == null) {
|
||||
return null;
|
||||
}
|
||||
bDirectory = BFileSystem.INSTANCE.makeDir(filePath, null);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
try {
|
||||
if (filePath == null) {
|
||||
return null;
|
||||
}
|
||||
bDirectory = BFileSystem.INSTANCE.makeDir(filePath, null);
|
||||
}
|
||||
catch (RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new BajaRuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
return bDirectory;
|
||||
}
|
||||
|
||||
public static void savePath(String string, String string2, BDirectory bDirectory) {
|
||||
if (bDirectory != null) {
|
||||
FavoriteDirectory.savePath(string, string2, bDirectory.getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
public static void savePath(String string, String string2, FilePath filePath) {
|
||||
try {
|
||||
BOptions bOptions = BOptions.load((String)string, (Type)BOptions.TYPE);
|
||||
BValue bValue = bOptions.get(string2);
|
||||
if (bValue != null && bValue instanceof BComponent) {
|
||||
BComponent bComponent = (BComponent)bValue;
|
||||
Property property = bComponent.getProperty("path");
|
||||
if (property == null) {
|
||||
bComponent.add("path", (BValue)BString.make((String)filePath.getBody()));
|
||||
} else {
|
||||
bComponent.set(property, (BValue)BString.make((String)filePath.getBody()));
|
||||
}
|
||||
} else {
|
||||
BFolder bFolder = new BFolder();
|
||||
bFolder.add("path", (BValue)BString.make((String)filePath.getBody()));
|
||||
if (bValue == null) {
|
||||
bOptions.add(string2, (BValue)bFolder);
|
||||
} else {
|
||||
bOptions.set(string2, (BValue)bFolder);
|
||||
}
|
||||
}
|
||||
bOptions.save();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static BOrd loadByOrd(String string, String string2, FilePath filePath) {
|
||||
if (filePath == null) {
|
||||
return FavoriteDirectory.loadByOrd(string, string2, (BOrd)null);
|
||||
}
|
||||
return FavoriteDirectory.loadByOrd(string, string2, BOrd.make((OrdQuery)filePath));
|
||||
}
|
||||
|
||||
public static BOrd loadByOrd(String string, String string2, BOrd bOrd) {
|
||||
OrdQuery[] ordQueryArray;
|
||||
BOrd bOrd2 = bOrd;
|
||||
try {
|
||||
BValue bValue;
|
||||
ordQueryArray = BOptions.load((String)string, (Type)BOptions.TYPE);
|
||||
BValue bValue2 = ordQueryArray.get(string2);
|
||||
if (bValue2 != null && bValue2 instanceof BComponent && (bValue = ((BComponent)bValue2).get("ord")) != null && bValue instanceof BOrd) {
|
||||
bOrd2 = (BOrd)bValue;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
if (bOrd2 != null) {
|
||||
try {
|
||||
ordQueryArray = bOrd2.parse();
|
||||
if (ordQueryArray.length == 1 && ordQueryArray[0] instanceof FilePath || ordQueryArray.length == 2 && ordQueryArray[0].getScheme().equals("local") && ordQueryArray[1] instanceof FilePath) {
|
||||
BFileSystem.INSTANCE.makeDir((FilePath)ordQueryArray[ordQueryArray.length - 1], null);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return bOrd2;
|
||||
}
|
||||
|
||||
public static void saveOrd(String string, String string2, BDirectory bDirectory) {
|
||||
if (bDirectory != null) {
|
||||
FavoriteDirectory.saveOrd(string, string2, bDirectory.getNavOrd());
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrd(String string, String string2, BOrd bOrd) {
|
||||
if (bOrd == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BOptions bOptions = BOptions.load((String)string, (Type)BOptions.TYPE);
|
||||
BValue bValue = bOptions.get(string2);
|
||||
if (bValue != null && bValue instanceof BComponent) {
|
||||
BComponent bComponent = (BComponent)bValue;
|
||||
Property property = bComponent.getProperty("ord");
|
||||
if (property == null) {
|
||||
bComponent.add("ord", (BValue)bOrd);
|
||||
} else {
|
||||
bComponent.set(property, (BValue)bOrd);
|
||||
}
|
||||
} else {
|
||||
BFolder bFolder = new BFolder();
|
||||
bFolder.add("ord", (BValue)bOrd);
|
||||
if (bValue == null) {
|
||||
bOptions.add(string2, (BValue)bFolder);
|
||||
} else {
|
||||
bOptions.set(string2, (BValue)bFolder);
|
||||
}
|
||||
}
|
||||
bOptions.save();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.file.FilePath
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.file.FilePath;
|
||||
|
||||
public interface IFilePathFilter {
|
||||
public boolean accept(FilePath var1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.theme.Theme
|
||||
* com.tridium.util.ObjectUtil
|
||||
* com.tridium.util.ObjectUtil$NameContainer
|
||||
* javax.baja.gx.BFont
|
||||
* javax.baja.naming.SlotPath
|
||||
* javax.baja.sys.BAbsTime
|
||||
* javax.baja.sys.BComplex
|
||||
* javax.baja.sys.BValue
|
||||
* javax.baja.ui.BLabel
|
||||
* javax.baja.ui.BWidget
|
||||
* javax.baja.ui.enums.BHalign
|
||||
* javax.baja.ui.pane.BGridPane
|
||||
* javax.baja.util.LexiconText
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.platform.ui.util.BCoordinatedGridPane;
|
||||
import com.tridium.ui.theme.Theme;
|
||||
import com.tridium.util.ObjectUtil;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import javax.baja.gx.BFont;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComplex;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.ui.BLabel;
|
||||
import javax.baja.ui.BWidget;
|
||||
import javax.baja.ui.enums.BHalign;
|
||||
import javax.baja.ui.pane.BGridPane;
|
||||
import javax.baja.util.LexiconText;
|
||||
|
||||
public class LabelUtil {
|
||||
public static BFont BOLD_TEXT_FONT = Theme.widget().getBoldText();
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, LexiconText lexiconText, BWidget bWidget, boolean bl) {
|
||||
LabelUtil.addLabelWidgetPair(bGridPane, lexiconText == null ? "" : lexiconText.getText(null), bWidget, bl);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, LexiconText lexiconText, BWidget bWidget) {
|
||||
LabelUtil.addLabelWidgetPair(bGridPane, lexiconText == null ? "" : lexiconText.getText(null), bWidget, true);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BCoordinatedGridPane bCoordinatedGridPane, LexiconText lexiconText, BWidget bWidget) {
|
||||
LabelUtil.addLabelWidgetPair(bCoordinatedGridPane, lexiconText == null ? "" : lexiconText.getText(null), bWidget, true);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, LexiconText lexiconText, Object[] objectArray, BWidget bWidget, boolean bl) {
|
||||
LabelUtil.addLabelWidgetPair(bGridPane, lexiconText == null ? "" : lexiconText.getText(null, objectArray), bWidget, bl);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, LexiconText lexiconText, Object[] objectArray, BWidget bWidget) {
|
||||
LabelUtil.addLabelWidgetPair(bGridPane, lexiconText == null ? "" : lexiconText.getText(null, objectArray), bWidget, true);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, String string, BWidget bWidget) {
|
||||
LabelUtil.addLabelWidgetPair(bGridPane, string, bWidget, true);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BGridPane bGridPane, String string, BWidget bWidget, boolean bl) {
|
||||
String string2 = string.trim();
|
||||
if (string2.length() > 10) {
|
||||
string2 = string2.substring(0, 10);
|
||||
}
|
||||
string2 = ObjectUtil.generateUniqueSlotName((String)SlotPath.escape((String)string2), (ObjectUtil.NameContainer)new NameContainer((BComplex)bGridPane));
|
||||
bGridPane.add(string2, (BValue)LabelUtil.makeLabel(string, bl));
|
||||
bGridPane.add(null, (BValue)bWidget);
|
||||
}
|
||||
|
||||
public static void addLabelWidgetPair(BCoordinatedGridPane bCoordinatedGridPane, String string, BWidget bWidget, boolean bl) {
|
||||
String string2 = string.trim();
|
||||
if (string2.length() > 10) {
|
||||
string2 = string2.substring(0, 10);
|
||||
}
|
||||
string2 = ObjectUtil.generateUniqueSlotName((String)SlotPath.escape((String)string2), (ObjectUtil.NameContainer)new NameContainer((BComplex)bCoordinatedGridPane));
|
||||
bCoordinatedGridPane.add(string2, (BValue)LabelUtil.makeLabel(string, bl));
|
||||
bCoordinatedGridPane.add(null, (BValue)bWidget);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText) {
|
||||
return LabelUtil.makeLabel(lexiconText, false, BHalign.left);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText, boolean bl) {
|
||||
return LabelUtil.makeLabel(lexiconText, bl, BHalign.left);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText, boolean bl, BHalign bHalign) {
|
||||
return LabelUtil.makeLabel(lexiconText == null ? null : lexiconText.getText(null), bl, bHalign);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText, Object[] objectArray) {
|
||||
return LabelUtil.makeLabel(lexiconText, objectArray, false, BHalign.left);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText, Object[] objectArray, boolean bl) {
|
||||
return LabelUtil.makeLabel(lexiconText, objectArray, bl, BHalign.left);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(LexiconText lexiconText, Object[] objectArray, boolean bl, BHalign bHalign) {
|
||||
return LabelUtil.makeLabel(lexiconText == null ? null : lexiconText.getText(null, objectArray), bl, bHalign);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(String string, boolean bl) {
|
||||
return LabelUtil.makeLabel(string, bl, BHalign.left);
|
||||
}
|
||||
|
||||
public static BLabel makeLabel(String string, boolean bl, BHalign bHalign) {
|
||||
BLabel bLabel = new BLabel(string == null ? "" : string, bHalign);
|
||||
if (bl) {
|
||||
bLabel.setFont(BOLD_TEXT_FONT);
|
||||
}
|
||||
return bLabel;
|
||||
}
|
||||
|
||||
public static String formatTime(BAbsTime bAbsTime) {
|
||||
if (bAbsTime == null || bAbsTime.isNull()) {
|
||||
return String.valueOf(bAbsTime);
|
||||
}
|
||||
return DateFormat.getInstance().format(new Date(bAbsTime.getMillis()));
|
||||
}
|
||||
|
||||
private static class NameContainer
|
||||
implements ObjectUtil.NameContainer {
|
||||
BComplex complex;
|
||||
|
||||
public NameContainer(BComplex bComplex) {
|
||||
this.complex = bComplex;
|
||||
}
|
||||
|
||||
public boolean contains(String string) {
|
||||
return this.complex.getSlot(string) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.ui.text.Line
|
||||
* javax.baja.ui.text.TextModel
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import javax.baja.ui.text.Line;
|
||||
import javax.baja.ui.text.TextModel;
|
||||
|
||||
public class LimitedTextModel
|
||||
extends TextModel {
|
||||
private int maxLines;
|
||||
private static int MAX_LINES_DEFAULT = 500;
|
||||
|
||||
public LimitedTextModel() {
|
||||
this(MAX_LINES_DEFAULT);
|
||||
}
|
||||
|
||||
public LimitedTextModel(int n) {
|
||||
this.setMaxLines(n);
|
||||
}
|
||||
|
||||
public void setMaxLines(int n) {
|
||||
this.maxLines = n;
|
||||
}
|
||||
|
||||
public int getMaxLines() {
|
||||
return this.maxLines;
|
||||
}
|
||||
|
||||
protected void update(Line[] lineArray) {
|
||||
if (lineArray.length <= this.getMaxLines()) {
|
||||
super.update(lineArray);
|
||||
} else {
|
||||
Line[] lineArray2 = new Line[this.getMaxLines()];
|
||||
System.arraycopy(lineArray, lineArray.length - this.getMaxLines(), lineArray2, 0, this.getMaxLines());
|
||||
super.update(lineArray2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.tridium.ui.util.ValidatingTextController
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import com.tridium.ui.util.ValidatingTextController;
|
||||
|
||||
public class PortConfigController
|
||||
extends ValidatingTextController {
|
||||
protected boolean valid(String string) {
|
||||
if (string.startsWith("0")) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < string.length(); ++i) {
|
||||
if (Character.isDigit(string.charAt(i))) continue;
|
||||
return false;
|
||||
}
|
||||
return Integer.parseInt(string) <= 65535;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.tridium.platform.ui.util;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SortableTableUtil {
|
||||
|
||||
private static class ColumnComparator
|
||||
implements Comparator {
|
||||
private int comparatorSortColumn;
|
||||
private boolean comparatorAscending;
|
||||
|
||||
public ColumnComparator(int n, boolean bl) {
|
||||
this.comparatorSortColumn = n;
|
||||
this.comparatorAscending = bl;
|
||||
}
|
||||
|
||||
public int compare(Object object, Object object2) {
|
||||
SortableRow sortableRow = (SortableRow)object;
|
||||
SortableRow sortableRow2 = (SortableRow)object2;
|
||||
int n = this.comparatorAscending ? 1 : -1;
|
||||
return n * sortableRow.compareToRowForColumn(sortableRow2, this.comparatorSortColumn);
|
||||
}
|
||||
}
|
||||
|
||||
public static class OriginalOrderComparator
|
||||
implements Comparator {
|
||||
HashMap sequenceMapById = new HashMap();
|
||||
|
||||
public OriginalOrderComparator(Model model) {
|
||||
if (model != null) {
|
||||
for (int i = 0; i < model.getRowCount(); ++i) {
|
||||
this.sequenceMapById.put(model.getSortableRow(i).getRowId(), new Integer(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int compare(Object object, Object object2) {
|
||||
SortableRow sortableRow = (SortableRow)object;
|
||||
SortableRow sortableRow2 = (SortableRow)object2;
|
||||
Integer n = (Integer)this.sequenceMapById.get(sortableRow.getRowId());
|
||||
Integer n2 = (Integer)this.sequenceMapById.get(sortableRow2.getRowId());
|
||||
if (n == null) {
|
||||
if (n2 == null) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (n2 == null) {
|
||||
return 1;
|
||||
}
|
||||
return n.compareTo(n2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class RowComparator
|
||||
implements Comparator {
|
||||
private Comparator[] comparators;
|
||||
|
||||
public RowComparator(Model model, Comparator comparator) {
|
||||
int n;
|
||||
int[] nArray = new int[model.getColumnCount()];
|
||||
nArray[0] = model.getSortColumn();
|
||||
int n2 = 1;
|
||||
for (n = 0; n < nArray.length; ++n) {
|
||||
if (n == model.getSortColumn()) continue;
|
||||
nArray[n2++] = n;
|
||||
}
|
||||
if (comparator == null) {
|
||||
this.comparators = new Comparator[model.getColumnCount()];
|
||||
n = 0;
|
||||
} else {
|
||||
this.comparators = new Comparator[model.getColumnCount() + 1];
|
||||
this.comparators[0] = comparator;
|
||||
n = 1;
|
||||
}
|
||||
for (int i = n; i < this.comparators.length; ++i) {
|
||||
this.comparators[i] = new ColumnComparator(nArray[i - n], model.isSortAscending());
|
||||
}
|
||||
}
|
||||
|
||||
public int compare(Object object, Object object2) {
|
||||
int n = 0;
|
||||
for (int i = 0; i < this.comparators.length && n == 0; ++i) {
|
||||
n = this.comparators[i].compare(object, object2);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface SortableRow {
|
||||
public Object getRowId();
|
||||
|
||||
public int compareToRowForColumn(SortableRow var1, int var2);
|
||||
}
|
||||
|
||||
public static interface Model {
|
||||
public int getColumnCount();
|
||||
|
||||
public int getRowCount();
|
||||
|
||||
public SortableRow getSortableRow(int var1);
|
||||
|
||||
public void sortByColumn(int var1, boolean var2);
|
||||
|
||||
public int getSortColumn();
|
||||
|
||||
public boolean isSortAscending();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user